text:
@implementation TJPGiftModel

- (instancetype)initWithSenderName:(NSString *)senderName senderIcon:(NSString *)senderIcon giftIcon:(NSString *)giftIcon giftName:(NSString *)giftName {
    if (self = [super init]) {
        _senderName = senderName;
        _senderIcon = senderIcon;
        _giftIcon = giftIcon;
        _giftName = giftName;
    }
    return self;
}

//重写系统的isEqual方法 用来判断
- (BOOL)isEqual:(id)object {
    //将object转成model
    if (![object isKindOfClass:[TJPGiftModel class]]) {
        return NO;
    }
    TJPGiftModel *model = (TJPGiftModel *)object;
    //比较礼物和用户
    if ([model.senderName isEqualToString:_senderName] && [model.giftName isEqualToString:_giftName]) {
        return YES;
    }

    return NO;
}

@end

redpajama_set_name: RedPajamaGithub


text:
/**
 * Collects HTML output during EDBML rendering phase.
 * Any methods added to this prototype will become
 * available in EDBML scripts as: out.mymethod()
 */
edbml.Out = function Out() {};

edbml.Out.prototype = {

	/**
	 * HTML string (not well-formed while parsing).
	 * @type {String}
	 */
	html: "",

	/**
	 * Identification.
	 * @returns {String}
	 */
	toString: function() {
		return "[object edbml.Out]";
	},

	/**
	 * Get HTML result (output override scenario).
	 * @returns {String}
	 */
	write: function() {
		return this.html;
	}
};


text:
module Mlk

  class Document

    attr_reader :content, :data

    def initialize(raw_document, path = '')
      split_text = split_text_and_meta(raw_document, path)

      @content = split_text[:content]
      @data = split_text[:data]
    end

    def serialize
      "#{ self.data.to_yaml }\n---\n#{ self.content }"
    end

    def ==(other_document)
      meta_equals = self.data == other_document.data
      content_equals = self.content == other_document.content

      meta_equals && content_equals
    end

    private

    def split_text_and_meta(raw_document, path)
      content = ''
      data = { }

      begin
        if match = raw_document.match(/^(---\s*\n(.*?)\n?)^(---\s*$\n?)(.*)/m)
          data = YAML.load(match[2])
          content = match[4].strip
        else
          raise "No metadata header available in file: #{ path }! Document:\n#{ raw_document }"
        end
      rescue Psych::SyntaxError => e
        raise "YAML error while reading #{ path }: #{ e.message }"
      end

      { content: content, data: data }
    end

  end

end


text:
using System.Threading.Tasks;

namespace Helios.Security
{
    public interface IPasswordComplexitySettingStore
    {
        Task<PasswordComplexitySetting> GetSettingsAsync();
    }
}


text:
EXEROOT='.'
EXEMAKE='scandsp'

#
# list of libraries that make EDG CCcc parser
#
LIBROOT='libs'
LIBDIRS="nameserver\
	stream_message"

#
# -- begin: invoke the actual build
#
ADMMAKE=`pwd`/../makescripts/Windows
export ADMMAKE

#
# configure make (default)
#

. $ADMMAKE/make_config.sh

#
# start the driver
#
. $ADMMAKE/make_driver.sh $*

#
# -- end:
#


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: android.webkit.WebIconDatabase
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_DECL
#define J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_DECL

namespace j2cpp { namespace java { namespace lang { class String; } } }
namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace android { namespace webkit { namespace WebIconDatabase_ { class IconListener; } } } }
namespace j2cpp { namespace android { namespace graphics { class Bitmap; } } }

#include <android/graphics/Bitmap.hpp>
#include <android/webkit/WebIconDatabase.hpp>
#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>

namespace j2cpp {

namespace android { namespace webkit {

	class WebIconDatabase;
	namespace WebIconDatabase_ {

		class IconListener;
		class IconListener
			: public object<IconListener>
		{
		public:

			J2CPP_DECLARE_CLASS

			J2CPP_DECLARE_METHOD(0)

			explicit IconListener(jobject jobj)
			: object<IconListener>(jobj)
			{
			}

			operator local_ref<java::lang::Object>() const;

			void onReceivedIcon(local_ref< java::lang::String >  const&, local_ref< android::graphics::Bitmap >  const&);
		}; //class IconListener

	} //namespace WebIconDatabase_

	class WebIconDatabase
		: public object<WebIconDatabase>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)
		J2CPP_DECLARE_METHOD(2)
		J2CPP_DECLARE_METHOD(3)
		J2CPP_DECLARE_METHOD(4)
		J2CPP_DECLARE_METHOD(5)
		J2CPP_DECLARE_METHOD(6)
		J2CPP_DECLARE_METHOD(7)

		typedef WebIconDatabase_::IconListener IconListener;

		explicit WebIconDatabase(jobject jobj)
		: object<WebIconDatabase>(jobj)
		{
		}

		operator local_ref<java::lang::Object>() const;

		void open(local_ref< java::lang::String >  const&);
		void close();
		void removeAllIcons();
		void requestIconForPageUrl(local_ref< java::lang::String >  const&, local_ref< android::webkit::WebIconDatabase_::IconListener >  const&);
		void retainIconForPageUrl(local_ref< java::lang::String >  const&);
		void releaseIconForPageUrl(local_ref< java::lang::String >  const&);
		static local_ref< android::webkit::WebIconDatabase > getInstance();
	}; //class WebIconDatabase

} //namespace webkit
} //namespace android

} //namespace j2cpp

#endif //J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_IMPL
#define J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_IMPL

namespace j2cpp {

android::webkit::WebIconDatabase_::IconListener::operator local_ref<java::lang::Object>() const
{
	return local_ref<java::lang::Object>(get_jobject());
}

void android::webkit::WebIconDatabase_::IconListener::onReceivedIcon(local_ref< java::lang::String > const &a0, local_ref< android::graphics::Bitmap > const &a1)
{
	return call_method<
		android::webkit::WebIconDatabase_::IconListener::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase_::IconListener::J2CPP_METHOD_NAME(0),
		android::webkit::WebIconDatabase_::IconListener::J2CPP_METHOD_SIGNATURE(0),
		void
	>(get_jobject(), a0, a1);
}

J2CPP_DEFINE_CLASS(android::webkit::WebIconDatabase_::IconListener,"android/webkit/WebIconDatabase$IconListener")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase_::IconListener,0,"onReceivedIcon","(Ljava/lang/String;Landroid/graphics/Bitmap;)V")

android::webkit::WebIconDatabase::operator local_ref<java::lang::Object>() const
{
	return local_ref<java::lang::Object>(get_jobject());
}

void android::webkit::WebIconDatabase::open(local_ref< java::lang::String > const &a0)
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(1),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(1),
		void
	>(get_jobject(), a0);
}

void android::webkit::WebIconDatabase::close()
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(2),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(2),
		void
	>(get_jobject());
}

void android::webkit::WebIconDatabase::removeAllIcons()
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(3),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(3),
		void
	>(get_jobject());
}

void android::webkit::WebIconDatabase::requestIconForPageUrl(local_ref< java::lang::String > const &a0, local_ref< android::webkit::WebIconDatabase_::IconListener > const &a1)
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(4),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(4),
		void
	>(get_jobject(), a0, a1);
}

void android::webkit::WebIconDatabase::retainIconForPageUrl(local_ref< java::lang::String > const &a0)
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(5),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(5),
		void
	>(get_jobject(), a0);
}

void android::webkit::WebIconDatabase::releaseIconForPageUrl(local_ref< java::lang::String > const &a0)
{
	return call_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(6),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(6),
		void
	>(get_jobject(), a0);
}

local_ref< android::webkit::WebIconDatabase > android::webkit::WebIconDatabase::getInstance()
{
	return call_static_method<
		android::webkit::WebIconDatabase::J2CPP_CLASS_NAME,
		android::webkit::WebIconDatabase::J2CPP_METHOD_NAME(7),
		android::webkit::WebIconDatabase::J2CPP_METHOD_SIGNATURE(7),
		local_ref< android::webkit::WebIconDatabase >
	>();
}

J2CPP_DEFINE_CLASS(android::webkit::WebIconDatabase,"android/webkit/WebIconDatabase")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,0,"<init>","()V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,1,"open","(Ljava/lang/String;)V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,2,"close","()V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,3,"removeAllIcons","()V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,4,"requestIconForPageUrl","(Ljava/lang/String;Landroid/webkit/WebIconDatabase$IconListener;)V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,5,"retainIconForPageUrl","(Ljava/lang/String;)V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,6,"releaseIconForPageUrl","(Ljava/lang/String;)V")
J2CPP_DEFINE_METHOD(android::webkit::WebIconDatabase,7,"getInstance","()Landroid/webkit/WebIconDatabase;")

} //namespace j2cpp

#endif //J2CPP_ANDROID_WEBKIT_WEBICONDATABASE_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
package jdo.party.model.communication;

import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;

import jdo.model.BasePersistentModel;
import jdo.party.model.PartyContactMechanism;
import jdo.party.model.relationship.PartyRelationship;

/**
 * Represents a communication between two or more parties.
 *
 * @author Jim
 * @version 1.0
 * @created 25-Dec-2007 9:54:27 AM
 * @see "Data Model Resource Book Volume 1 Figure 2.7, Page 48"
 * @see "Data Model Resource Book Volume 1 Figure 2.12, page 60"
 * @see "Data Model Resource Book Volume 1 Figure 2.13, page 64"
 */
@SuppressWarnings("serial")
@Entity
public class CommunicationEvent extends BasePersistentModel {

	@ManyToMany
	private List<Case> asPartOf = new ArrayList<Case>();

	@OneToMany
	private List<CommunicationEventPurpose> categorizedBy = new ArrayList<CommunicationEventPurpose>();

	private ZonedDateTime dateTimeEnded;

	@NotNull
	private ZonedDateTime dateTimeStarted;

	@ManyToOne
	private PartyRelationship inTheContextOf;

	@OneToMany(mappedBy = "of", cascade = CascadeType.ALL)
	private List<CommunicationEventRole> involving = new ArrayList<CommunicationEventRole>();

	@ManyToOne
	private CommunicationEventStatusType monitoredBy;

	@NotEmpty
	@Lob
	private String note;

	@ManyToOne
	private PartyContactMechanism occursVia;

	public void addCommunicationEventRole(CommunicationEventRole communicationEventRole) {
		if (!getInvolving().contains(communicationEventRole)) {
			getInvolving().add(communicationEventRole);
			communicationEventRole.setOf(this);
		}

	}

	/**
	 * @return the asPartOf
	 */
	public List<Case> getAsPartOf() {
		return asPartOf;
	}

	/**
	 * @return the categorizedBy
	 */
	public List<CommunicationEventPurpose> getCategorizedBy() {
		return categorizedBy;
	}

	/**
	 * @return the dateTimeEnded
	 */

	public ZonedDateTime getDateTimeEnded() {
		return dateTimeEnded;
	}

	/**
	 * @return the dateTimeStarted
	 */
	public ZonedDateTime getDateTimeStarted() {
		return dateTimeStarted;
	}

	/**
	 * @return the inTheContextOf
	 */
	public PartyRelationship getInTheContextOf() {
		return inTheContextOf;
	}

	/**
	 * @return the involving
	 */
	public List<CommunicationEventRole> getInvolving() {
		return involving;
	}

	/**
	 * @return the monitoredBy
	 */
	public CommunicationEventStatusType getMonitoredBy() {
		return monitoredBy;
	}

	/**
	 * @return the note
	 */
	public String getNote() {
		return note;
	}

	/**
	 * @return the occursVia
	 */
	public PartyContactMechanism getOccursVia() {
		return occursVia;
	}

	@Transient
	@AssertTrue
	public boolean isRangeValid() {
		if (dateTimeEnded != null) {
			return true;
		} else {
			return dateTimeEnded.isAfter(dateTimeStarted);
		}
	}

	/**
	 * @param asPartOf
	 *            the asPartOf to set
	 */
	public void setAsPartOf(List<Case> asPartOf) {
		this.asPartOf = asPartOf;
	}

	/**
	 * @param categorizedBy
	 *            the categorizedBy to set
	 */
	public void setCategorizedBy(List<CommunicationEventPurpose> categorizedBy) {
		this.categorizedBy = categorizedBy;
	}

	/**
	 * @param dateTimeEnded
	 *            the dateTimeEnded to set
	 */
	public void setDateTimeEnded(ZonedDateTime dateTimeEnded) {
		this.dateTimeEnded = dateTimeEnded;
	}

	/**
	 * @param dateTimeStarted
	 *            the dateTimeStarted to set
	 */
	public void setDateTimeStarted(ZonedDateTime dateTimeStarted) {
		this.dateTimeStarted = dateTimeStarted;
	}

	/**
	 * @param inTheContextOf
	 *            the inTheContextOf to set
	 */
	public void setInTheContextOf(PartyRelationship inTheContextOf) {
		this.inTheContextOf = inTheContextOf;
	}

	/**
	 * @param involving
	 *            the involving to set
	 */
	public void setInvolving(List<CommunicationEventRole> involving) {
		this.involving = involving;
	}

	/**
	 * @param monitoredBy
	 *            the monitoredBy to set
	 */
	public void setMonitoredBy(CommunicationEventStatusType monitoredBy) {
		this.monitoredBy = monitoredBy;
	}

	// public void addCase(Case newCase) {
	// getAsPartOf().add(newCase);
	// newCase.getEncompassing().add(this);
	// }

	/**
	 * @param note
	 *            the note to set
	 */
	public void setNote(String note) {
		this.note = note;
	}

	/**
	 * @param occursVia
	 *            the occursVia to set
	 */
	public void setOccursVia(PartyContactMechanism occursVia) {
		this.occursVia = occursVia;
	}
}


text:
ActiveRecord::Schema.define(version: 0) do
  create_table "foos", :force => true do |t|
    t.string   "foo"
  end
end


text:
require 'net/http'
require 'json'

resource_name :hab_config
provides :hab_config

property :config, Mash,
         required: true,
         coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m }
property :service_group, String, name_property: true, desired_state: false
property :remote_sup, String, default: '127.0.0.1:9632', desired_state: false
# Http port needed for querying/comparing current config value
property :remote_sup_http, String, default: '127.0.0.1:9631', desired_state: false
property :gateway_auth_token, String, desired_state: false
property :user, String, desired_state: false

load_current_value do
  http_uri = "http://#{remote_sup_http}"

  begin
    headers = {}
    headers['Authorization'] = "Bearer #{gateway_auth_token}" if property_is_set?(:gateway_auth_token)
    census = Mash.new(Chef::HTTP::SimpleJSON.new(http_uri).get('/census', headers))
    sc = census['census_groups'][service_group]['service_config']['value']
  rescue
    # Default to a blank config if anything (http error, json parsing, finding
    # the config object) goes wrong
    sc = {}
  end
  config sc
end

action :apply do
  converge_if_changed do
    # Use the current timestamp as the serial number/incarnation
    incarnation = Time.now.tv_sec

    opts = []
    # opts gets flattened by shell_out_compact later
    opts << ['--remote-sup', new_resource.remote_sup] if new_resource.remote_sup
    opts << ['--user', new_resource.user] if new_resource.user

    tempfile = Tempfile.new(['hab_config', '.toml'])
    begin
      tempfile.write(toml_dump(new_resource.config))
      tempfile.close

      hab('config', 'apply', opts, new_resource.service_group, incarnation, tempfile.path)
    ensure
      tempfile.close
      tempfile.unlink
    end
  end
end

action_class do
  include Habitat::Shared
  include Habitat::Toml
end


text:
namespace RapidVulkan
{
  namespace Debug
  {
    inline const char* TryToString(const VkComponentTypeNV& value)
    {
      switch(value)
      {
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_FLOAT16_NV:
        return "VK_COMPONENT_TYPE_FLOAT16_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_FLOAT32_NV:
        return "VK_COMPONENT_TYPE_FLOAT32_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_FLOAT64_NV:
        return "VK_COMPONENT_TYPE_FLOAT64_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_SINT8_NV:
        return "VK_COMPONENT_TYPE_SINT8_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_SINT16_NV:
        return "VK_COMPONENT_TYPE_SINT16_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_SINT32_NV:
        return "VK_COMPONENT_TYPE_SINT32_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_SINT64_NV:
        return "VK_COMPONENT_TYPE_SINT64_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_UINT8_NV:
        return "VK_COMPONENT_TYPE_UINT8_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_UINT16_NV:
        return "VK_COMPONENT_TYPE_UINT16_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_UINT32_NV:
        return "VK_COMPONENT_TYPE_UINT32_NV";
#endif
#if VK_HEADER_VERSION >= 101
      case VK_COMPONENT_TYPE_UINT64_NV:
        return "VK_COMPONENT_TYPE_UINT64_NV";
#endif
      default:
        return nullptr;
      }
    };

    inline const char* ToString(const VkComponentTypeNV& value)
    {
      auto result = TryToString(value);
      return (result != nullptr ? result : "*Unknown*");
    };
  }
}

#endif
#endif


text:
#ifndef COMMANDS_H
#define COMMANDS_H

using namespace xlw;

//<xlw:onopen( welcome)
//<xlw:onclose(goodbye)

//<xlw:libraryname=MyTestLibrary

void // Test Menu Command
testCommand();

#endif // COMMANDS_H


text:
package cmd

import (
	"crypto/tls"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"testing"
	"time"

	"github.com/ory/hydra/internal"

	"github.com/phayes/freeport"
	"github.com/stretchr/testify/assert"

	"github.com/ory/x/healthx"
)

var frontendPort, backendPort int

func freePort() (int, int) {
	var err error
	r := make([]int, 2)

	if r[0], err = freeport.GetFreePort(); err != nil {
		panic(err.Error())
	}

	tries := 0
	for {
		r[1], err = freeport.GetFreePort()
		if r[0] != r[1] {
			break
		}
		tries++
		if tries > 10 {
			panic("Unable to find free port")
		}
	}
	return r[0], r[1]
}

func init() {
	frontendPort, backendPort = freePort()

	os.Setenv("SERVE_PUBLIC_PORT", fmt.Sprintf("%d", frontendPort))
	os.Setenv("SERVE_ADMIN_PORT", fmt.Sprintf("%d", backendPort))
	os.Setenv("DSN", "memory")
	//os.Setenv("HYDRA_URL", fmt.Sprintf("https://localhost:%d/", frontendPort))
	os.Setenv("URLS_SELF_ISSUER", fmt.Sprintf("https://localhost:%d/", frontendPort))
}

func TestExecute(t *testing.T) {
	frontend := fmt.Sprintf("https://localhost:%d/", frontendPort)
	backend := fmt.Sprintf("https://localhost:%d/", backendPort)
	conf := internal.NewConfigurationWithDefaults()

	rootCmd := NewRootCmd()

	for _, c := range []struct {
		args      []string
		wait      func() bool
		expectErr bool
		skipTest  bool
	}{
		{
			args: []string{"serve", "all", "--sqa-opt-out"},
			wait: func() bool {
				client := &http.Client{
					Transport: &transporter{
						FakeTLSTermination: true,
						Transport: &http.Transport{
							TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
						},
					},
				}

				for _, u := range []string{
					fmt.Sprintf("https://127.0.0.1:%d/.well-known/openid-configuration", frontendPort),
					fmt.Sprintf("https://127.0.0.1:%d%s", backendPort, healthx.ReadyCheckPath),
				} {
					if resp, err := client.Get(u); err != nil {
						t.Logf("HTTP request to %s failed: %s", u, err)
						return true
					} else if resp.StatusCode != http.StatusOK {
						t.Logf("HTTP request to %s got status code %d but expected was 200", u, resp.StatusCode)
						return true
					}
				}

				// Give a bit more time to initialize
				time.Sleep(time.Second * 5)
				return false
			},
		},
		{args: []string{"clients", "create", "--skip-tls-verify", "--endpoint", backend, "--id", "foobarbaz", "--secret", "foobar", "-g", "client_credentials"}},
		{args: []string{"clients", "get", "--skip-tls-verify", "--endpoint", backend, "foobarbaz"}},
		{args: []string{"clients", "create", "--skip-tls-verify", "--endpoint", backend, "--id", "public-foo"}},
		{args: []string{"clients", "create", "--skip-tls-verify", "--endpoint", backend, "--id", "confidential-foo", "--pgp-key", base64EncodedPGPPublicKey(t), "--grant-types", "client_credentials", "--response-types", "token"}},
		{args: []string{"clients", "delete", "--skip-tls-verify", "--endpoint", backend, "public-foo"}},
		{args: []string{"keys", "create", "--skip-tls-verify", "foo", "--endpoint", backend, "-a", "RS256"}},
		{args: []string{"keys", "create", "--skip-tls-verify", "foo", "--endpoint", backend, "-a", "HS256"}, skipTest: conf.HsmEnabled()},
		{args: []string{"keys", "get", "--skip-tls-verify", "--endpoint", backend, "foo"}},
		// {args: []string{"keys", "rotate", "--skip-tls-verify", "--endpoint", backend, "foo"}},
		{args: []string{"keys", "get", "--skip-tls-verify", "--endpoint", backend, "foo"}},
		{args: []string{"keys", "delete", "--skip-tls-verify", "--endpoint", backend, "foo"}},
		{args: []string{"keys", "import", "--skip-tls-verify", "--endpoint", backend, "import-1", "../test/stub/ecdh.key", "../test/stub/ecdh.pub"}, skipTest: conf.HsmEnabled()},
		{args: []string{"keys", "import", "--skip-tls-verify", "--endpoint", backend, "import-2", "../test/stub/rsa.key", "../test/stub/rsa.pub"}, skipTest: conf.HsmEnabled()},
		{args: []string{"keys", "import", "--skip-tls-verify", "--endpoint", backend, "import-2", "../test/stub/rsa.key", "../test/stub/rsa.pub"}, skipTest: conf.HsmEnabled()},
		{args: []string{"token", "revoke", "--skip-tls-verify", "--endpoint", frontend, "--client-secret", "foobar", "--client-id", "foobarbaz", "foo"}},
		{args: []string{"token", "client", "--skip-tls-verify", "--endpoint", frontend, "--client-secret", "foobar", "--client-id", "foobarbaz"}},
		{args: []string{"help", "migrate", "sql"}},
		{args: []string{"version"}},
		{args: []string{"token", "flush", "--skip-tls-verify", "--endpoint", backend}},
	} {
		rootCmd.SetArgs(c.args)

		t.Run(fmt.Sprintf("command=%v", c.args), func(t *testing.T) {
			if c.skipTest {
				t.Skip("Skipping test. Not applicable when Hardware Security Module is enabled")
			}

			if c.wait != nil {
				go func() {
					assert.Nil(t, rootCmd.Execute())
				}()
			}

			if c.wait != nil {
				var count = 0
				for c.wait() {
					t.Logf("Ports are not yet open, retrying attempt #%d...", count)
					count++
					if count > 15 {
						t.FailNow()
					}
					time.Sleep(time.Second)
				}
			} else {
				err := rootCmd.Execute()
				if c.expectErr {
					assert.Error(t, err)
				} else {
					assert.NoError(t, err)
				}
			}
		})
	}
}

func base64EncodedPGPPublicKey(t *testing.T) string {
	t.Helper()

	gpgPublicKey, err := ioutil.ReadFile("../test/stub/pgp.pub")
	if err != nil {
		t.Fatal(err)
	}
	return base64.StdEncoding.EncodeToString(gpgPublicKey)
}


text:
"""
Defines tasks for uwsgi to run at regular intervals
"""
import datetime
import os

import uwsgidecorators

from flask import Flask

import model
from database import db_session

EXECUTOR_TIMEOUT_MINS = 3

@uwsgidecorators.timer(15, target="spooler")
def reset_overdue_runs(signum):
    app = Flask(__name__)
    app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv(
        "CODE_COURT_DB_URI"
    ) or "sqlite:////tmp/code_court.db"
    app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False

    # reset overdue runs
    overdue_runs = model.Run.query.filter(
        model.Run.finished_execing_time == None
    ).filter(
        model.Run.started_execing_time != None
    ).filter(
        (datetime.datetime.utcnow() - datetime.timedelta(minutes=EXECUTOR_TIMEOUT_MINS))
        > model.Run.started_execing_time
    ).all()

    for run in overdue_runs:
        run.started_execing_time = None

    db_session.commit()


text:
package com.tapglue.model;

import android.support.annotation.NonNull;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType;

public class TGLike extends TGBaseObjectWithId<TGLike, Long> {
    @Expose
    @SerializedName("post_id")
    private String postId;

    @Expose
    @SerializedName("user_id")
    private String userId;

    public TGLike() {
        super(TGCacheObjectType.Like);
    }

    /**
     * Get ID of post
     *
     * @return post id
     */
    public String getPostId() {
        return postId;
    }

    /**
     * Set ID of post Setting this won't change server value - use only for ui updates if needed
     *
     * @param postId
     *
     * @return
     */
    @NonNull
    public TGLike setPostId(String postId) {
        this.postId = postId;
        return this;
    }

    @NonNull
    @Override
    protected TGLike getThis() {
        return this;
    }

    /**
     * Get ID of user
     *
     * @return
     */
    public String getUserId() {
        return userId;
    }

    /**
     * Set id of user assigned to like Setting this won't change server value - use only for ui
     * updates if needed
     *
     * @param userId
     *
     * @return
     */
    @NonNull
    public TGLike setUserId(String userId) {
        this.userId = userId;
        return this;
    }
}


text:
title: "Bloomberg Billionaires"
date: 2013-06-17 13:10
author: saguiitay
categories: [Development, Windows Phone]
tags: [Billionaires, Windows Phone]
redirect_from:
 - /2013-06-17-bloomberg-billionaires/
 - /development/bloomberg-billionaires/
---
Bloomberg's website contains a little gem that allows you to view and analyst the [world's top billionaires](http://www.bloomberg.com/billionaires/).
This site provides information on each of the top 100 billionaires, their history, net worth and analysis, news, etc.

The website was implemented with HTML, JavaScript and JSON, and displays fluent animation, charts and graphs, and is generally a pleasure to the eyes.

Why am I telling you all this? Unfortunately, no, I don't appear on that list... Since the website was implemented using Javascript, and the data is
in JSON, we can easily take a look under the hood, and learn about the implementation, and even use the data for our own purpose - and that's
exactly what I'll show in my next post.


text:
<!doctype html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Animated Digital LED Clock Demo</title>
<link href="http://www.cssscript.com/wp-includes/css/sticky.css" rel="stylesheet" type="text/css">

Animated Digital LED Clock Demo


text:
bool get_global_seed_chain(seqan::String<seqan::Seed<seqan::Simple> > &seedChain,
							seqan::DnaString &seq1, seqan::DnaString &seq2,
							std::pair<unsigned, unsigned> startPos,
							std::pair<unsigned, unsigned> endPos,
							unsigned q);

bool insert_seeds_in_seedChain(seqan::String<seqan::Seed<seqan::Simple> > &seedChain,
										std::vector<std::pair<unsigned, unsigned> > &startPos,
										std::vector<std::pair<unsigned, unsigned> > &endPos,
										seqan::DnaString &seqOne, seqan::DnaString &seqTwo,
										unsigned q);

bool create_positionsContainers(std::vector<std::pair<unsigned, unsigned> > &startPos,
									std::vector<std::pair<unsigned, unsigned> > &endPos,
									seqan::String<seqan::Seed<seqan::Simple> > &seedChain,
									unsigned q, unsigned lenSeqOne, unsigned lenSeqTwo,
									bool firstRun);

bool read_FASTA(seqan::CharString path, seqan::CharString  &id, seqan::DnaString &seq);

std::string get_file_contents(seqan::CharString filepath);

template<typename TInfix, typename TQueryId>
bool get_stellarMatches(seqan::StringSet<QueryMatches<StellarMatch<TInfix, TQueryId> > > & matches,
							seqan::SeedSet<seqan::Simple> &seedSet)
{
	typedef StellarMatch<TInfix, TQueryId> TMatch;
	typedef typename Size<typename TMatch::TAlign>::Type TSize;
	typedef typename Iterator<String<TMatch> >::Type TIterator;
	typedef Seed<Simple> SSeed;

	QueryMatches<TMatch> &queryMatches = value(matches, 0);

	TIterator it = begin(queryMatches.matches);
	TIterator itEnd = end(queryMatches.matches);

	int z = 0;
	if (it == itEnd)
	{
		std::cerr << "STELLAR: no matches found with entered options...." << std::endl;
		return false;
	}
	while (it != itEnd)
	{
		//debugging:
		std::cout << "beginPositionDatabase[" << z << "]: " << seqan::beginPosition((*it).row1) << std::endl;
		std::cout << "endPositionDatabase[" << z << "]: " << seqan::endPosition((*it).row1) << std::endl;
		std::cout << "beginPositionQuery[" << z << "]: " << seqan::beginPosition((*it).row2) << std::endl;
		std::cout << "endPositionQuery[" << z << "]: " << seqan::endPosition((*it).row2) << std::endl;

		SSeed stellarSeed(seqan::beginPosition((*it).row1),
				seqan::beginPosition((*it).row2),
				seqan::endPosition((*it).row1),
				seqan::endPosition((*it).row2));

		addSeed(seedSet, stellarSeed, seqan::Single());
		++it;
		++z;
	}
	return true;

}

bool write_seed_positions(std::vector< std::pair<unsigned, unsigned> > &array1,
							std::vector< std::pair<unsigned, unsigned> > &array2,
							const char* filepath);

bool output_alignment(seqan::CharString path,
						seqan::CharString &idOne, seqan::CharString &idTwo,
						seqan::Align<seqan::DnaString, seqan::ArrayGaps> &alignment,
						int score);

#endif  // #ifndef SANDBOX_MY_SANDBOX_APPS_LAGAN_NEU_LAGAN_FUNCTIONS_H_


text:
package org.vertexium.query;

public class HistogramResult extends AggregationResult {
    private final Iterable<HistogramBucket> buckets;

    public HistogramResult(Iterable<HistogramBucket> buckets) {
        this.buckets = buckets;
    }

    public Iterable<HistogramBucket> getBuckets() {
        return buckets;
    }

    public HistogramBucket getBucketByKey(Object key) {
        String keyStr = key.toString();
        for (HistogramBucket histogramBucket : getBuckets()) {
            String bucketKey = histogramBucket.getKey().toString();
            if (bucketKey.equals(keyStr)) {
                return histogramBucket;
            }
        }
        return null;
    }
}


text:
package ucesoft.cbm.cpu.asm

import scala.util.matching.Regex
import scala.util.parsing.combinator._
import scala.util.parsing.input.{Position, Positional}

object AsmParser {
  import ucesoft.cbm.cpu.CPU65xx._
  import Mode._

  private val OPCODES = Instruction.values.map { _.toString.toLowerCase } ++ (Instruction.values map { _.toString.toUpperCase })
  private val BRANCHES = OP_MATRIX flatMap { r => r.filter { o => o._2 == REL } } map { _._1.toString }

  sealed trait Statement extends Positional {
    var fileName : Option[String] = None
  }
  sealed trait ASMStatement extends Statement
  case class ModuleLabel(label:String,module:Option[String])
  case class EvalTarget(variable:ModuleLabel, fieldSelector: Option[List[String]])
  // Expressions
  sealed trait Expr extends Positional {
    var sizeHint : Option[Int] = None
  }
  case object Null extends Expr
  case class Str(value: String) extends Expr
  case class Value(value: Double) extends Expr
  case class ListValue(elements: List[Expr], isRange: Boolean = false) extends Expr
  case class MapValue(keyVals:List[ListValue]) extends Expr
  case class Label(label: String,module:Option[String]) extends Expr
  case class BinOp(op: String, op1: Expr, op2: Expr) extends Expr
  case class UnaryOp(op: String, op1: Expr, isPre: Boolean = true) extends Expr
  case class FunOp(fun: String,module:Option[String],args: List[Expr]) extends Expr
  case class NewStruct(name: String,module:Option[String],values: Array[Expr]) extends Expr
  case class FieldOrMethod(e:Expr,name:String,pars:List[Expr]) extends Expr
  // Statements
  case class LABELED(label: String) extends Statement
  case class CONST(name: String, value: Expr,isPrivate:Boolean) extends Statement
  case class VAR(name: String, initValue: Expr,isPrivate:Boolean) extends Statement
  case class PRINT(what: Expr) extends Statement
  case class EVAL(assignTo: Option[EvalTarget], value: Expr) extends Statement
  case class IF(cond: Expr, thenClause: List[Statement], elseClause: List[Statement]) extends Statement
  case class STRUCT(name: String, fields: List[String],isPrivate:Boolean) extends Statement
  case class ENUM(fields: List[(String, Option[Int])]) extends Statement
  case class WHILE(cond: Expr, body: List[Statement]) extends Statement
  case class FOR(vars: List[VAR], cond: Expr, post: List[Statement], body: List[Statement]) extends Statement
  case class MACRO(name:String,parameters:List[String],body:List[Statement]) extends Statement
  case class MACRO_CALL(name:String,actualParameters:List[Expr]) extends Statement
  case class FUNCTION(name:String,parameters:List[String],body:List[Statement],isPrivate:Boolean) extends Statement
  case class DECLARE_LABEL(name:String,value:Expr) extends Statement
  case object BREAK extends Statement
  case class DUP(times:Expr, body: List[Statement]) extends Statement
  case class ALIGN(alignTo:Expr) extends Statement
  case class ERROR(msg:Expr) extends Statement
  case class MODULE(name:String,body:List[Statement]) extends Statement
  case class INCLUDE(file:String) extends Statement
  case class DISCARDEXPR(expr:Expr) extends Statement
  // ASMStatement
  sealed trait ORGType
  case object Default extends ORGType
  case object Virtual extends ORGType
  case object Patch extends ORGType
  case class ORG(org: Expr, sectionName: Option[Expr],virtual:ORGType = Default) extends ASMStatement
  case class WORD(values: List[Expr], isByte: Boolean = true) extends ASMStatement
  case class BYTE_LIST(list: Expr) extends ASMStatement
  case class FILL(size:Expr,value:Option[Expr]) extends ASMStatement
  case class WORD_GEN(gen: FunOp, isByte: Boolean = true) extends ASMStatement
  case class TEXT(text: Expr,enc:TEXTEncoding) extends ASMStatement
  case class ASM(opcode: String, var mode: Mode.MODE, operand: Option[Expr]) extends ASMStatement
  case class TEXTEncoding(upper:Boolean,screenCode:Boolean)
  case class COMMENTED_ASM(_line:Int) extends ASMStatement {
    setPos(new Position {
      override def line: Int = _line
      override def column: Int = 1
      override protected def lineContents: String = ""
    })
  }
}

class AsmParser(fileName:String) extends JavaTokenParsers {
  import AsmParser._
  import ucesoft.cbm.cpu.CPU65xx._
  import Mode._

  private val other_opcodes: Parser[String] = OPCODES.drop(1).foldLeft(OPCODES.head: Parser[String]) { (p, b) => p | b }

  override val whiteSpace: Regex = "[ \t]+".r
  // =================================================================

  private def nl : Parser[String] = "[\n\r]*".r

  private def lineComment: Parser[String] = "(//|;).*".r ^^ { s => if (s == ";") s.substring(1) else s.substring(2) }
  private def multilineComment: Parser[String] = """/\*[^\*]*\*(\*|[^\*/][^\*]*\*)*/""".r ^^ { c => c.substring(2, c.length - 2) }
  private def comment: Parser[String] = lineComment | multilineComment

  // =========================== EXPR ================================

  private def label: Parser[String] = ident
  private def moduleLabel : Parser[ModuleLabel] = label ~ opt("::" ~> label) ^^ {
    case l ~ None => ModuleLabel(l,None)
    case m ~ Some(l) => ModuleLabel(l,Some(m))
  }
  private def decNumber: Parser[Int] = "[0-9]{1,5}".r ^^ { i => i.toInt }
  private def hexWord: Parser[Int] = "\\$[0-9A-Fa-f]{1,4}".r ^^ { i => Integer.parseInt(i.substring(1), 16) }
  private def binWord: Parser[Int] = "%[01]{1,16}".r ^^ { i => Integer.parseInt(i.substring(1), 2) }
  private def float: Parser[Double] = floatingPointNumber ^^ { _.toDouble }
  private def number: Parser[Double] = float | (decNumber | hexWord | binWord) ^^ { _.toFloat }
  private def string: Parser[String] = stringLiteral ^^ { s => s.substring(1, s.length - 1) }
  //===========================================================================

  private def expr: Parser[Expr] = positioned {
    expr2 ~ opt(":" ~> decNumber) ^^ {
      case expr ~ None => expr
      case expr ~ Some(size) =>
        expr.sizeHint = Some(size)
        expr
    }
  }

  private def expr2: Parser[Expr] =
    logical ~ rep("^" ~ logical | "&" ~ logical | "|" ~ logical) ^^ {
      case s ~ l => l.foldLeft(s) { case (acc, op ~ f) => BinOp(op, acc, f) }
    }

  private def logical: Parser[Expr] = positioned {
    logical2 ~ rep("==" ~ logical2 | "!=" ~ logical2) ~ opt("?" ~> (expr ~ (":" ~> expr))) ^^ {
      case l1 ~ l ~ ifclause =>
        val cond = l.foldLeft(l1) { case (acc, op ~ f) => BinOp(op, acc, f) }
        ifclause match {
          case None =>
            cond
          case Some(t ~ f) =>
            FunOp("if",None,List(cond, t, f))
        }
    }
  }
  private def logical2: Parser[Expr] =
    not ~ rep("<<" ~ not | ">>" ~ not | ">=" ~ not | "<=" ~ not | ">" ~ not | "<" ~ not) ^^ {
      case s ~ l => l.foldLeft(s) { case (acc, op ~ f) => BinOp(op, acc, f) }
    }

  private def not: Parser[Expr] =
    opt("!") ~ sum ^^ {
      case None ~ s => s
      case Some(n) ~ s => UnaryOp(n, s)
    }

  private def sum: Parser[Expr] =
    term ~ rep("+" ~ term | "-" ~ term) ^^ {
      case f ~ l => l.foldLeft(f) { case (acc, op ~ f) => BinOp(op, acc, f) }
    }

  private def term: Parser[Expr] = factorFieldOrMethod ~ rep("*" ~ factorFieldOrMethod | "/" ~ factorFieldOrMethod | "%" ~ factorFieldOrMethod) ^^ {
    case f ~ l => l.foldLeft(f) { case (acc, op ~ f) => BinOp(op, acc, f) }
  }
  private def factorFieldOrMethod : Parser[Expr] =
    factor ~ rep("." ~> fieldOrMethod) ^^ {
      case e~Nil => e
      case e~l =>
        l.foldLeft(e) { (acc,f) =>
          f match {
            case Label(l,None) =>
              FieldOrMethod(acc,l,Nil)
            case FunOp(fn,None,pars) =>
              FieldOrMethod(acc,fn,pars)
            case _ => throw new IllegalArgumentException // TODO
          }
        }
    }
  private def fieldOrMethod : Parser[Expr] = function | label ^^ { Label(_,None) }
  private def factor: Parser[Expr] =
    "null" ^^ { n => Null } |
    generate |
    map |
    list |
    "<" ~> factor ^^ { e => FunOp("lsb",None, e :: Nil) } |
    ">" ~> factor ^^ { e => FunOp("msb",None, e :: Nil) } |
    function |
    newStruct |
    string ^^ { Str(_) } |
    number ^^ { Value(_) } |
    "(" ~> expr <~ ")" ^^ { e => e } |
    "-" ~> expr ^^ { UnaryOp("-", _) } |
    ("++" | "--") ~ moduleLabel ^^ { case op ~ l => UnaryOp(op, Label(l.label,l.module)) } |
    //structField |
    moduleLabel ~ opt("++" | "--") ^^ {
      case l ~ None => Label(l.label,l.module)
      case l ~ Some(op) => UnaryOp(op, Label(l.label,l.module), false)
    }

  private def map : Parser[Expr] = "#[" ~ nl ~ "]" ^^ { _ => MapValue(Nil) } |
    "#[" ~> repsep(list, (nl ~ "," ~ nl)) <~ "]" ~ nl ^^ { MapValue(_) }

  private def list: Parser[ListValue] = "[" ~ nl ~ "]" ^^ { _ => ListValue(Nil) } |
    ("[" ~> expr <~ "..") ~ expr ~ opt("," ~> expr) <~ "]" ^^ {
      case (from ~ to) ~ step =>
        ListValue(List(from, to, step.getOrElse(Value(1))), true)
    } |
    "[" ~> repsep(expr, (nl ~ "," ~ nl)) <~ "]" ~ nl ^^ { ListValue(_) }

  private def function: Parser[FunOp] = moduleLabel ~ ("(" ~> repsep(expr, ",") <~ ")") ^^ { case ModuleLabel(l,m) ~ args => FunOp(l,m, args) }
  private def newStruct: Parser[NewStruct] = moduleLabel ~ ("{" ~> repsep(expr, ",") <~ "}") ^^ { case ModuleLabel(l,m) ~ vals => NewStruct(l,m,vals.toArray) }
  private def generate: Parser[FunOp] = ("[" ~> label <~ "<-") ~ (expr ~ ("||" ~> expr <~ "]")) ^^ {
    case v ~ (l ~ e) => FunOp("gen",None, List(Str(v), l, e))
  }

  // ================ ASM STATEMENT ==================================
  private def org: Parser[ASMStatement] = ((".pc" | "*") ~ "=" | "org") ~> (expr ~ opt("virtual" | "patch") ~ opt(expr)) ^^ {
    case addr ~ None ~ l => ORG(addr, l)
    case addr ~ Some("virtual") ~ l => ORG(addr, l,Virtual)
    case addr ~ Some("patch") ~ l => ORG(addr, l,Patch)
  }
  private def text: Parser[ASMStatement] = (".text" | ".t" | "!text") ~> opt("ascii"|"screen"|"upper-ascii"|"upper-screen") ~ expr ^^ {
    case enc~e => enc match {
      case Some("ascii")|None => TEXT(e,TEXTEncoding(false,false))
      case Some("screen") => TEXT(e,TEXTEncoding(false,true))
      case Some("upper-screen") => TEXT(e,TEXTEncoding(true,true))
      case Some("upper-ascii") => TEXT(e,TEXTEncoding(true,false))
      case Some(e) => throw new CompilerException(s"Invalid encoding: $e",None)
    }
  }
  private def bytes: Parser[ASMStatement] =
    (".bytelist" | ".bl" | "!bytelist") ~> expr ^^ { BYTE_LIST(_) } |
    (".byte" | ".b" | "!byte") ~> (
      generate ^^ { g => WORD_GEN(g, true) } |
      list ^^ { BYTE_LIST(_) }|
      repsep(expr, ",") ^^ { l => WORD(l, true) }
    )

  private def words: Parser[ASMStatement] = (".word" | ".w" | "!word") ~> (
    generate ^^ { g => WORD_GEN(g, false) } |
    repsep(expr, ",") ^^ { l => WORD(l, false) })

  private def fill: Parser[ASMStatement] = (".fill" | ".f" | "!fill") ~> expr ~ opt("," ~> expr) ^^ {
    case size ~ None => FILL(size,None)
    case size ~ (v@Some(_)) => FILL(size,v)
  }

  private def asmMode: Parser[(Mode.MODE, Expr)] =
    "#" ~> expr ^^ { (IMM, _) } |
      "(" ~> expr <~ ")" <~ ("," ~ "y|Y".r) ^^ { (IZY, _) } |
      "(" ~> expr <~ ")" ^^ { (IND, _) } |
      "(" ~> expr <~ ("," ~ "x|X".r) <~ ")" ^^ { (IZX, _) } |
      expr ~ opt(("," ~> "x|X".r) | ("," ~> "y|Y".r)) ^^ {
        case e ~ None => (UNKNOWN_ABS_OR_ZP, e) // we will decide later if it's ABS or ZP
        case e ~ Some(index) =>
          if (index.toUpperCase.endsWith("X")) (UNKNOWN_ABX_OR_ZPX, e) else (UNKNOWN_ABY_OR_ZPY, e)
      }

  private def asm: Parser[ASMStatement] = other_opcodes ~ opt(".z" | ".a") ~ opt(asmMode) <~ opt(comment) <~ ("\n" | "") ^^ {
    case o ~ _ ~ None => // m is ignored, IMP forced
      ASM(o, IMP, None)
    case o ~ m ~ Some(mode) =>
      var mm = m match {
        case None => mode._1
        case Some(hm) =>
          (hm, mode._1) match {
            case (".z", UNKNOWN_ABS_OR_ZP) => ZP
            case (".a", UNKNOWN_ABS_OR_ZP) => ABS
            case (".z", UNKNOWN_ABX_OR_ZPX) => ZPX
            case (".a", UNKNOWN_ABX_OR_ZPX) => ABX
            case (".z", UNKNOWN_ABY_OR_ZPY) => ZPY
            case (".a", UNKNOWN_ABY_OR_ZPY) => ABY
            case (_,m) => m
          }
      }
      mm = mm match {
        case UNKNOWN_ABS_OR_ZP =>
          if (!hasMode(o,ZP)) ABS else mm
        case UNKNOWN_ABX_OR_ZPX =>
          if (!hasMode(o,ZPX)) ABX else mm
        case UNKNOWN_ABY_OR_ZPY =>
          if (!hasMode(o,ZPY)) ABY else mm
        case m => m
      }
      if (BRANCHES.contains(o.toUpperCase)) {
        ASM(o, REL, Some(mode._2))
      } else {
        ASM(o, mm, Some(mode._2))
      }
  }
  // ===================== STATEMENT =================================
  private def enum: Parser[Statement] = ("enum" ~ "{") ~> nl ~> repsep(label ~ opt("=" ~> number), "," <~ nl) <~ nl <~ "}" ^^ {
    case l => ENUM(l map { case e ~ n => (e, n map { _.toInt }) })
  }
  private def struct: Parser[Statement] = opt("private") ~ ("struct" ~> label) ~ ("{" ~> repsep(label, ",") <~ "}") ^^ {
    case pr ~ name ~ fields => STRUCT(name, fields,pr.isDefined)
  }
  private def const: Parser[Statement] = opt("private") ~ ("val" ~> (label ~ ("=" ~> expr))) ^^ { case pr ~ (id ~ e) => CONST(id,e,pr.isDefined) }
  private def variable: Parser[Statement] = opt("private") ~ ("var" ~> (label ~ ("=" ~> expr))) ^^ { case pr ~ (id ~ e) => VAR(id,e,pr.isDefined) }
  private def print: Parser[Statement] = "print" ~> expr ^^ { PRINT }
  private def assignment : Parser[Statement] = moduleLabel ~ rep("." ~> label) ~ ("=" ~> expr) ^^ {
    case l ~ Nil ~ e => EVAL(Some(EvalTarget(l, None)), e)
    case l ~ fs ~ e => EVAL(Some(EvalTarget(l, Some(fs))), e)
  }
  private def eval: Parser[Statement] = "eval" ~> opt(moduleLabel ~ rep("." ~> label) <~ "=") ~ expr ^^ {
    case Some(l ~ Nil) ~ e => EVAL(Some(EvalTarget(l, None)), e)
    case Some(l ~ fs) ~ e => EVAL(Some(EvalTarget(l, Some(fs))), e)
    case None ~ e => EVAL(None, e)
  }
  private def singleBlock: Parser[List[Statement]] = (asmStatement | statement) ^^ { List(_) }
  private def multipleBlock: Parser[List[Statement]] = "{" ~> statements(false,false,false,false) <~ "}"
  private def block: Parser[List[Statement]] = nl ~> (multipleBlock | singleBlock) <~ nl
  private def macroBlock: Parser[List[Statement]] = nl ~> "{" ~> statements(true,false,false,false) <~ "}" <~ nl
  private def funBlock: Parser[List[Statement]] = nl ~> "{" ~> statements(false,true,false,false) <~ "}" <~ nl
  private def moduleBlock: Parser[List[Statement]] = nl ~> "{" ~> statements(false,true,false,true) <~ "}" <~ nl

  private def ifStmt: Parser[Statement] = (("if" ~ "(") ~> expr <~ ")" <~ opt(comment)) ~ block ~ opt("else" ~> opt(comment) ~> block) ^^ {
    case cond ~ t ~ None => IF(cond, t, Nil)
    case cond ~ t ~ Some(e) => IF(cond, t, e)
  }
  private def whileStmt: Parser[Statement] = (("while" ~ "(") ~> expr <~ ")" <~ opt(comment)) ~ block ^^ { case c ~ b => WHILE(c, b) }
  private def forStmt: Parser[Statement] = ("for" ~ "(") ~> repsep((label <~ "=") ~ expr, ",") ~ (";" ~> expr <~ ";") ~ repsep(statement, ",") ~ (")" ~> opt(comment) ~> block) ^^ {
    case vars ~ cond ~ post ~ body =>
      val vs = vars map { case n ~ e => VAR(n,e,false) }
      FOR(vs, cond, post, body)
  }

  private def declareLabel : Parser[Statement] = ("label" ~> label <~ "=") ~ expr ^^ {
    case l~e => DECLARE_LABEL(l,e)
  }

  private def break : Parser[Statement] = "break" ^^ { b => BREAK }

  private def dup : Parser[Statement] = "dup" ~> expr ~ block ^^ { case e~b => DUP(e,b) }

  private def align : Parser[Statement] = ("align" | ".align") ~> expr ^^ { case e => ALIGN(e) }

  private def error : Parser[Statement] = "error" ~> expr ^^ { case e => ERROR(e) }

  private def macroCall : Parser[Statement] = function ^^ {
    case FunOp(n,None,pars) => MACRO_CALL(n,pars)
    case FunOp(n,_,pars) => throw new IllegalArgumentException // TODO
  }

  private def macroStmt : Parser[Statement] = positioned {
    ("def" ~ "macro") ~> label ~ ("(" ~> repsep(label,",") <~ ")") ~ macroBlock ^^ {
      case name~pars~body => MACRO(name,pars,body)
    }
  }

  private def funStmt : Parser[Statement] = positioned {
    opt("private") ~ ("def" ~> label ~ ("(" ~> repsep(label,",") <~ ")") ~ funBlock) ^^ {
      case pr~(name~pars~body) => FUNCTION(name,pars,body,pr.isDefined)
    }
  }

  private def exprStmt : Parser[Statement] = positioned {
    expr ^^ { DISCARDEXPR(_) }
  }

  private def moduleStmt : Parser[Statement] = positioned {
    "module" ~> label ~ moduleBlock ^^ { case l~b => MODULE(l,b) }
  }

  private def include : Parser[Statement] = "source" ~> expr ^? ({ case Str(fn) => INCLUDE(fn) }, _ => "Type mismatch: include statement expects a string as filename")

  private def asmStatement: Parser[Statement] = positioned { asm | org | bytes | words | text | fill }
  private def statement: Parser[Statement] = positioned {
    include | error | align | dup | break | const | variable | print | eval | ifStmt | struct | enum | whileStmt | forStmt | macroCall | declareLabel | assignment | exprStmt
  }

  private def statements(macroMode:Boolean, asmNotAllowed:Boolean, top:Boolean, module:Boolean): Parser[List[Statement]] = allStatements(macroMode,asmNotAllowed,top,module) ^^ { _.flatten }

  private def allStatements(macroMode:Boolean, asmNotAllowed:Boolean, top:Boolean, module:Boolean) : Parser[List[Option[Statement]]] = {
    rep(
      nl ~>
        (comment ^^ { _ => None } |
         label <~ ":" ^^ { case l => Some(LABELED(l)) } |
          (
              (
              if (module) (const | variable | struct | funStmt) | ((statement | asmStatement) <~ failure("In a module can be defined functions, vars/vals and structs only"))
              else
              if (top) (moduleStmt | macroStmt | funStmt| asmStatement | statement )
              else
              if (macroMode) (asmStatement|statement)|(macroStmt | funStmt)<~ err("In macros functions and other macros are not permitted")
              else
              if (asmNotAllowed) statement|asmStatement<~failure("Assembler statement are not allowed here")|macroStmt<~failure("Macros are not allowed here")|funStmt<~failure("Functions are not allowed here")
              else
              asmStatement | statement | macroStmt<~failure("Macros can be declared on outermost scope only")|funStmt<~failure("Functions can be declared on outermost scope only")
              )  ^^ { s => s.fileName = Some(fileName) ; s }
          ) ^^ {
            case s => Some(s)
          }
        ) <~ nl)
  }

  def topStatements : Parser[List[Statement]] = statements(false,false,true,false)
}


text:
Nouvelle appui EAF

                <form method="get" action="#!" style="margin-bottom: 20px;">
                    Région:

                        <select class="browser-default" name="id_region">
                            <option value="" disabled selected>Choisir une région</option>
                            <?php foreach($regions as $region){?>
                            <option value="<?php echo $region->ID_REGION ?>"><?php echo $region->NOM_REGION ?></option>
                            <?php } ?>
                        </select>

                    District:

                        <select class="browser-default" name="id_district">
                            <option value="" disabled selected>Choisir une district</option>
                        </select>

                    Commune:

                        <select class="browser-default" name="id_commune">
                            <option value="" disabled selected>Choisir une commune</option>
                        </select>

                    <input type="submit" value="Filtrer" class="waves-effect blue waves-light btn btn-block" style="vertical-align: middle;">
                </form>

Liste EAF

                        Code
                        Nom et prénoms
                        Surnom
                        Fokontany
                        Commune
                        District
                        Région

                    <?php foreach($eafListe as $eaf){ ?>

                        <?php echo $eaf->CODE_MENAGE?>
                        <?php echo $eaf->NOM_MENAGE?>
                        <?php echo $eaf->SURNOM?>
                        <?php echo $eaf->NOM_FOKONTANY?>
                        <?php echo $eaf->NOM_COMMUNE?>
                        <?php echo $eaf->NOM_DISTRICT?>
                        <?php echo $eaf->NOM_REGION?>
                        <a href="<?php echo base_url(); ?>c_appui/appui_eaf/<?php echo $eaf->ID_MENAGE ?>" class="waves-effect green waves-light btn">done

                    <?php } ?>

chevron_left

1

2

3

4

5

chevron_right


text:
package alluxio.rest;

import alluxio.Constants;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;

import javax.ws.rs.core.Response;

/**
 * Represents a REST API test case.
 */
public final class TestCase {
  private String mEndpoint;
  private Map<String, String> mParameters;
  private String mMethod;
  private Object mExpectedResult;
  private String mHostname;
  private int mPort;
  private String mJsonString;
  private boolean mPrettyPrint;

  /**
   * Creates a new instance of {@link TestCase}.
   *
   * @param hostname the hostname to use
   * @param port the port to use
   * @param endpoint the endpoint to use
   * @param parameters the parameters to use
   * @param method the method to use
   * @param expectedResult the expected result to use
   */
  public TestCase(String hostname, int port, String endpoint, Map<String, String> parameters,
      String method, Object expectedResult) {
    this(hostname, port, endpoint, parameters, method, expectedResult, null, false);
  }

  /**
   * Creates a new instance of {@link TestCase} with JSON data.
   *
   * @param hostname the hostname to use
   * @param port the port to use
   * @param endpoint the endpoint to use
   * @param parameters the parameters to use
   * @param method the method to use
   * @param expectedResult the expected result to use
   * @param jsonString the json payload in string
   * @param prettyPrint if pretty prints the JSON response
   */
  public TestCase(String hostname, int port, String endpoint, Map<String, String> parameters,
      String method, Object expectedResult, String jsonString, boolean prettyPrint) {
    mHostname = hostname;
    mPort = port;
    mEndpoint = endpoint;
    mParameters = parameters;
    mMethod = method;
    mExpectedResult = expectedResult;
    mJsonString = jsonString;
    mPrettyPrint = prettyPrint;
  }

  /**
   * @return the endpoint
   */
  public String getEndpoint() {
    return mEndpoint;
  }

  /**
   * @return the method
   */
  public String getMethod() {
    return mMethod;
  }

  public URL createURL() throws Exception {
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, String> parameter : mParameters.entrySet()) {
      sb.append(parameter.getKey() + "=" + parameter.getValue() + "&");
    }
    return new URL(
        "http://" + mHostname + ":" + mPort + Constants.REST_API_PREFIX + "/" + mEndpoint
            + "?" + sb.toString());
  }

  public String getResponse(HttpURLConnection connection) throws Exception {
    StringBuilder sb = new StringBuilder();
    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    char[] buffer = new char[1024];
    int len;

    while ((len = br.read(buffer)) > 0) {
      sb.append(buffer, 0, len);

    }
    br.close();

    return sb.toString();
  }

  /**
   * Runs the test case and returns the output.
   */
  public String call() throws Exception {
    HttpURLConnection connection = (HttpURLConnection) createURL().openConnection();
    connection.setRequestMethod(mMethod);
    if (mJsonString != null) {
      connection.setDoOutput(true);
      connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
      OutputStream os = connection.getOutputStream();
      os.write(mJsonString.getBytes("UTF-8"));
      os.close();
    }

    connection.connect();
    Assert.assertEquals(mEndpoint, Response.Status.OK.getStatusCode(),
        connection.getResponseCode());
    return getResponse(connection);
  }

  /**
   * Runs the test case.
   */
  public void run() throws Exception {
    String expected = "";
    if (mExpectedResult != null) {
      ObjectMapper mapper = new ObjectMapper();
      expected =
          mPrettyPrint ? mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mExpectedResult)
              : mapper.writeValueAsString(mExpectedResult);
    }

    String result = call();
    Assert.assertEquals(mEndpoint, expected, result);
  }
}


text:
var fs = require('fs')
var fsExtra = require('fs-extra')
var rimraf = require('rimraf')
var path = require('path')

exports.rm = function (file) {
  return rimraf.sync(path.join(__dirname, '/resources/' + file))
}

exports.write = function (text, file) {
  return fs.writeFileSync(path.join(__dirname, '/resources/' + file), text)
}

exports.cp = function (src, dest) {
  return fsExtra.copySync(
    path.join(__dirname, '/resources/' + src),
    path.join(__dirname, '/resources/' + dest))
}

exports.read = function (file) {
  return fs.readFileSync(path.join(__dirname, '/resources/' + file), {
    'encoding': 'utf8'
  })
}