text:
<?php if(!defined('THEMEPLE_FRAMEWORK')) exit("Direct script access not allowed");

if(! class_exists('themple_controller')){

    class themeple_controller{

        var $base_data;
        var $db_options_prefix;
        var $admin_pages = array();
        var $page_elements = array();
        var $subs = array();
        var $options = array();
        var $current;
        /**
         * themeple_controller::themeple_controller()
         *
         * @param mixed $base_data
         * @return
         */
        function themeple_controller($base_data){
            $this->base_data = $base_data;
            $this->db_options_prefix = 'themeple_options_'.$this->base_data['prefix'];

            $this->generate_options_array();

            if(is_admin()){
                add_action('admin_print_scripts',array(&$this, 'themeple_global_js'));

                new themeple_adminpages_gen($this);
                new themeple_metabox($this);

                new themeple_export($this);
                if(function_exists('set_time_limit')){
                    set_time_limit(0);
                }

            }
            new themeple_custom_menu($this);

        }

        /**
         * themeple_controller::generate_options_array()
         *
         * @return
         */
        private function generate_options_array(){
            include(THEMEPLE_BASE.'template_inc/admin/admin_options.php');
            if(isset($admin_pages)){
                $this->admin_pages = $admin_pages;
            }
            if(isset($page_elements)){
                $this->page_elements = $page_elements;
            }

            $dynamic_pages = get_option($this->db_options_prefix.'_dynamic_pages');
            $dynamic_elements = get_option($this->db_options_prefix.'_dynamic_elements');

            if(is_array($dynamic_pages)){
                $this->admin_pages = array_merge($this->admin_pages, $dynamic_pages);
            }

            if(is_array($dynamic_elements)){
                $this->page_elements = array_merge($this->page_elements, $dynamic_elements);
            }

            $options_result = get_option($this->db_options_prefix);

            foreach($this->admin_pages as $page){
                $this->subs[$page['parent']][] = $page['slug'];

            }
            $bool = false;
            foreach($admin_pages as $page){
                if(!isset($options_result[$page['parent']]) || $options_result[$page['parent']] == ""){
                    $options_result[$page['parent']] = $this->get_default($this->page_elements, $page, $this->subs );
                    $bool = true;
                }
            }
            if($bool)
                update_option($this->db_options_prefix, $options_result);
            $this->options = apply_filters('themeple_filter_admin_options', $options_result );

        }

        /**
         * themeple_controller::get_default()
         *
         * @param mixed $el
         * @param mixed $page
         * @param mixed $subs
         * @return
         */
        private function get_default($el, $page, $subs){
            $values = array();
			foreach($el as $element)
			{
				if(in_array($element['slug'], $subs[$page['parent']]))
				{
					if($element['type'] == 'layout_section')
					{
						$values[0][$element['id']] = $this->get_default($element['subelements'], $page, $subs);
					}
					else if(isset($element['id']))
					{
						if(!isset($element['std'])) $element['std'] = "";
						$values[$element['id']] = $element['std'];

					}
				}
			}

			return $values;
        }

        /**
         * themeple_controller::getElements()
         *
         * @param mixed $slug
         * @return
         */
        function getElements($slug)
		{
			$page_elements = array();
			if(count($this->page_elements) > 0)
			{
				foreach($this->page_elements as $key => $value)
				{
					if($value['slug'] == $slug)
					{
						$page_elements[$key] = $value;
					}
				}
			}

			return $page_elements;
		}
        /**
         * themeple_controller::themeple_global_js()
         *
         * @return
         */
        function themeple_global_js(){
            echo "\n <script type='text/javascript'>\n /* <![CDATA[ */  \n";
    		echo "var themeple_global = {\n \tframeworkUrl: '".THEMEPLE_FRAMEWORK_URL."', \n \tinstalledAt: '".THEMEPLE_BASE_URL."', \n \tajaxurl: '".admin_url( 'admin-ajax.php' )."'\n \t}; \n /* ]]> */ \n ";
            echo "</script>\n \n ";
        }
    }

}

?>


text:
<!DOCTYPE html>
<html lang="lv">

{% include head.html %}

<body id="page-top">
  {% include nav-funds.html %}
  {% include header-funds.html %}
  {% include call-to-action-funds.html %}
  {% include feature-funds.html %}
  {% include portfolio-funds.html %}
  {% include services-funds.html %}
  {% include aside-funds.html %}
  {% include footer.html %}
  {% include scripts.html %}
</body>

</html>

redpajama_set_name: RedPajamaGithub


text:
#

__author__ = 'elip'

import fnmatch
import os

def build_includes(workdir, app):
    includes = []
    for root, dirnames, filenames in os.walk(os.path.join(workdir, app)):
        for filename in fnmatch.filter(filenames, 'tasks.py'):
            includes.append(os.path.join(root, filename))

    # remove .py suffix from include
    includes = map(lambda include: include[:-3], includes)

    # remove path prefix to start with cosmo
    includes = map(lambda include: include.replace(workdir, ''), includes)

    # replace slashes with dots in include path
    includes = map(lambda include: include.replace('/', '.'), includes)

    # remove the dot at the start
    includes = map(lambda include: include[1:], includes)

    return includes

includes = build_includes(os.getcwd(), 'cosmo')


text:
package org.virtue.game.entity.player.stat;

import org.virtue.network.event.context.GameEventContext;

/**
 * @author Im Frizzy <skype:kfriz1998>
 * @author Frosty Teh Snowman <skype:travis.mccorkle>
 * @author Arthur <skype:arthur.behesnilian>
 * @author Sundays211
 * @since 27/10/2014
 */
public class PlayerStat implements GameEventContext {
	/**
	 * The maximum amount of experience a player can gain in any stat. Includes 1dp, so 200 is actually 20.0xp
	 */
	public static final int EXPERIENCE_CAP = 2_000_000_000;

	private int xp = 0;
	private int level = 0;
	private int baseLevel = 1;
	private final Stat type;

	public PlayerStat (Stat stat) {
		this(stat, 0, 1);
	}

	public PlayerStat (Stat skill, int xp, int level) {
		this.type = skill;
		this.xp = xp;
		this.level = level;
		calculateBaseLevel();
	}

	/**
	 * Gets the id of the skill (the id should be between 1 and the total number of skills)
	 * @return	The id.
	 */
	public Stat getType () {
		return type;
	}

	/**
	 * Gets the experience the player has in the skill, as an integer which accounts for 1dp.
	 * @return The experience as an int
	 */
	public int getExperience () {
		return xp;
	}

	/**
	 * Sets the experience the player has in the skill. Must be an integer acounting for 1dp (eg 20.0 is 200)
	 * @param xp The experience to set
	 */
	public void setExperience(int xp) {
		this.xp = xp;
		if (xp < 0) {
			xp = 0;
		} else if (xp > EXPERIENCE_CAP) {
			xp = EXPERIENCE_CAP;
		}
		calculateBaseLevel();
	}

	/**
	 * Gets the current boosted/reduced skill level for the player.
	 * @return	The level.
	 */
	public int getLevel () {
		return level;
	}

	/**
	 * Gets the player's current base level
	 * @return	The base level
	 */
	public int getBaseLevel () {
		return baseLevel;
	}

	private void calculateBaseLevel () {
		baseLevel = type.getBaseLevel(xp/10);
	}

	/**
	 * Sets the current level for this skill (the boosted/lowered level)
	 * @param level The level to set
	 */
	public void setLevel (int level) {
		if (level > 255 || level < 0) {
			throw new IllegalArgumentException("Level must be between 0 and 255");
		}
		this.level = level;
	}

}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CSharp.RuntimeBinder.Syntax;

namespace Microsoft.CSharp.RuntimeBinder.Semantics
{
    /*****************************************************************************
    A GlobalSymbolContext represents the global symbol tables for a compilation.
    This includes symbols, types, declarations.
    *****************************************************************************/

    internal sealed class GlobalSymbolContext
    {
        private readonly PredefinedTypes _predefTypes;
        private readonly NameManager _nameManager;

        public GlobalSymbolContext(NameManager namemgr)
        {
            GlobalSymbols = new BSYMMGR(namemgr);
            _predefTypes = new PredefinedTypes(GlobalSymbols);
            TypeManager = new TypeManager(GlobalSymbols, _predefTypes);

            _nameManager = namemgr;
        }

        public TypeManager TypeManager { get; }
        public TypeManager GetTypes() { return TypeManager; }
        private BSYMMGR GlobalSymbols { get; }
        public BSYMMGR GetGlobalSymbols() { return GlobalSymbols; }
        public NameManager GetNameManager() { return _nameManager; }
        public PredefinedTypes GetPredefTypes() { return _predefTypes; }

        public SymFactory GetGlobalSymbolFactory()
        {
            return GetGlobalSymbols().GetSymFactory();
        }
    }
}


text:
#include <kernel.h>
#include <mmustructs.h>
#include <linker/linker-defs.h>

/* Common regions for all x86 processors.
 * Peripheral I/O ranges configured at the SOC level
 */

/* Mark text and rodata as read-only.
 * Userspace may read all text and rodata.
 */
MMU_BOOT_REGION((u32_t)&_image_rom_start, (u32_t)&_image_rom_size,
		MMU_ENTRY_READ | MMU_ENTRY_USER);

#ifdef CONFIG_APPLICATION_MEMORY
/* User threads by default can read/write app-level memory. */
MMU_BOOT_REGION((u32_t)&__app_ram_start, (u32_t)&__app_ram_size,
		MMU_ENTRY_WRITE | MMU_ENTRY_USER | MMU_ENTRY_EXECUTE_DISABLE);
#endif

/* __kernel_ram_size includes all unused memory, which is used for heaps.
 * User threads cannot access this unless granted at runtime. This is done
 * automatically for stacks.
 */
MMU_BOOT_REGION((u32_t)&__kernel_ram_start, (u32_t)&__kernel_ram_size,
		MMU_ENTRY_WRITE |
		MMU_ENTRY_RUNTIME_USER |
		MMU_ENTRY_EXECUTE_DISABLE);

void _x86_mmu_get_flags(void *addr,
			x86_page_entry_data_t *pde_flags,
			x86_page_entry_data_t *pte_flags)
{
	*pde_flags = (x86_page_entry_data_t)(X86_MMU_GET_PDE(addr)->value &
				~(x86_page_entry_data_t)MMU_PDE_PAGE_TABLE_MASK);

	if (*pde_flags & MMU_ENTRY_PRESENT) {
		*pte_flags = (x86_page_entry_data_t)
			(X86_MMU_GET_PTE(addr)->value &
			 ~(x86_page_entry_data_t)MMU_PTE_PAGE_MASK);
	} else {
		*pte_flags = 0;
	}
}

int _arch_buffer_validate(void *addr, size_t size, int write)
{
	u32_t start_pde_num;
	u32_t end_pde_num;
	u32_t starting_pte_num;
	u32_t ending_pte_num;
	u32_t pde;
	u32_t pte;
#ifdef CONFIG_X86_PAE_MODE
	union x86_mmu_pae_pte pte_value;
	u32_t start_pdpte_num = MMU_PDPTE_NUM(addr);
	u32_t end_pdpte_num = MMU_PDPTE_NUM((char *)addr + size - 1);
	u32_t pdpte;
#else
	union x86_mmu_pte pte_value;
#endif
	struct x86_mmu_page_table *pte_address;

	start_pde_num = MMU_PDE_NUM(addr);
	end_pde_num = MMU_PDE_NUM((char *)addr + size - 1);
	starting_pte_num = MMU_PAGE_NUM((char *)addr);

#ifdef CONFIG_X86_PAE_MODE
	for (pdpte = start_pdpte_num; pdpte <= end_pdpte_num; pdpte++) {
		if (pdpte != start_pdpte_num) {
			start_pde_num = 0;
		}

		if (pdpte != end_pdpte_num) {
			end_pde_num = 0;
		} else {
			end_pde_num = MMU_PDE_NUM((char *)addr + size - 1);
		}

		struct x86_mmu_page_directory *pd_address =
			X86_MMU_GET_PD_ADDR_INDEX(pdpte);
#endif
		/* Iterate for all the pde's the buffer might take up.
		 * (depends on the size of the buffer and start address
		 * of the buff)
		 */
		for (pde = start_pde_num; pde <= end_pde_num; pde++) {
#ifdef CONFIG_X86_PAE_MODE
			union x86_mmu_pae_pde pde_value =
				pd_address->entry[pde];
#else
			union x86_mmu_pde_pt pde_value =
				X86_MMU_PD->entry[pde].pt;
#endif

			if (!pde_value.p ||
			    !pde_value.us ||
			    (write && !pde_value.rw)) {
				return -EPERM;
			}

			pte_address = (struct x86_mmu_page_table *)
				(pde_value.page_table << MMU_PAGE_SHIFT);

			/* loop over all the possible page tables for the
			 * required size. If the pde is not the last one
			 * then the last pte would be 1023. So each pde
			 * will be using all the page table entires except
			 * for the last pde. For the last pde, pte is
			 * calculated using the last memory address
			 * of the buffer.
			 */
			if (pde != end_pde_num) {
				ending_pte_num = 1023;
			} else {
				ending_pte_num =
					MMU_PAGE_NUM((char *)addr + size - 1);
			}

			/* For all the pde's appart from the starting pde,
			 * will have the start pte number as zero.
			 */
			if (pde != start_pde_num) {
				starting_pte_num = 0;
			}

			pte_value.value = 0xFFFFFFFF;

			/* Bitwise AND all the pte values.
			 * An optimization done to make sure a compare is
			 * done only once.
			 */
			for (pte = starting_pte_num;
			     pte <= ending_pte_num;
			     pte++) {
				pte_value.value &=
					pte_address->entry[pte].value;
			}

			if (!pte_value.p ||
			    !pte_value.us ||
			    (write && !pte_value.rw)) {
				return -EPERM;
			}
		}
#ifdef CONFIG_X86_PAE_MODE
	}
#endif

	return 0;
}

static inline void tlb_flush_page(void *addr)
{
	/* Invalidate TLB entries corresponding to the page containing the
	 * specified address
	 */
	char *page = (char *)addr;

	__asm__ ("invlpg %0" :: "m" (*page));
}

void _x86_mmu_set_flags(void *ptr,
			size_t size,
			x86_page_entry_data_t flags,
			x86_page_entry_data_t mask)
{
#ifdef CONFIG_X86_PAE_MODE
	union x86_mmu_pae_pte *pte;
#else
	union x86_mmu_pte *pte;
#endif

	u32_t addr = (u32_t)ptr;

	__ASSERT(!(addr & MMU_PAGE_MASK), "unaligned address provided");
	__ASSERT(!(size & MMU_PAGE_MASK), "unaligned size provided");

	while (size) {

#ifdef CONFIG_X86_PAE_MODE
		/* TODO we're not generating 2MB entries at the moment */
		__ASSERT(X86_MMU_GET_PDE(addr)->ps != 1, "2MB PDE found");
#else
		/* TODO we're not generating 4MB entries at the moment */
		__ASSERT(X86_MMU_GET_4MB_PDE(addr)->ps != 1, "4MB PDE found");
#endif
		pte = X86_MMU_GET_PTE(addr);

		pte->value = (pte->value & ~mask) | flags;
		tlb_flush_page((void *)addr);

		size -= MMU_PAGE_SIZE;
		addr += MMU_PAGE_SIZE;
	}
}

#ifdef CONFIG_X86_USERSPACE

/* Helper macros needed to be passed to x86_update_mem_domain_pages */
#define X86_MEM_DOMAIN_SET_PAGES   (0U)
#define X86_MEM_DOMAIN_RESET_PAGES (1U)
/* Pass 1 to page_conf if reset of mem domain pages is needed else pass a 0*/
static inline void _x86_mem_domain_pages_update(struct k_mem_domain *mem_domain,
						u32_t page_conf)
{
	u32_t partition_index;
	u32_t total_partitions;
	struct k_mem_partition partition;
	u32_t partitions_count;

	/* If mem_domain doesn't point to a valid location return.*/
	if (mem_domain == NULL) {
		goto out;
	}

	/* Get the total number of partitions*/
	total_partitions = mem_domain->num_partitions;

	/* Iterate over all the partitions for the given mem_domain
	 * For x86: interate over all the partitions and set the
	 * required flags in the correct MMU page tables.
	 */
	partitions_count = 0;
	for (partition_index = 0;
	     partitions_count < total_partitions;
	     partition_index++) {

		/* Get the partition info */
		partition = mem_domain->partitions[partition_index];
		if (partition.size == 0) {
			continue;
		}
		partitions_count++;
		if (page_conf == X86_MEM_DOMAIN_SET_PAGES) {
			/* Set the partition attributes */
			_x86_mmu_set_flags((void *)partition.start,
					   partition.size,
					   partition.attr,
					   K_MEM_PARTITION_PERM_MASK);
		} else {
			/* Reset the pages to supervisor RW only */
			_x86_mmu_set_flags((void *)partition.start,
					   partition.size,
					   K_MEM_PARTITION_P_RW_U_NA,
					   K_MEM_PARTITION_PERM_MASK);
		}
	}
 out:
	return;
}

/* Load the partitions of the thread. */
void _arch_mem_domain_configure(struct k_thread *thread)
{
	_x86_mem_domain_pages_update(thread->mem_domain_info.mem_domain,
				     X86_MEM_DOMAIN_SET_PAGES);
}

/* Destroy or reset the mmu page tables when necessary.
 * Needed when either swap takes place or k_mem_domain_destroy is called.
 */
void _arch_mem_domain_destroy(struct k_mem_domain *domain)
{
	_x86_mem_domain_pages_update(domain, X86_MEM_DOMAIN_RESET_PAGES);
}

/* Reset/destroy one partition spcified in the argument of the API. */
void _arch_mem_domain_partition_remove(struct k_mem_domain *domain,
				       u32_t  partition_id)
{
	u32_t total_partitions;
	struct k_mem_partition partition;

	if (domain == NULL) {
		goto out;
	}

	total_partitions = domain->num_partitions;
	__ASSERT(partition_id <= total_partitions,
		 "invalid partitions");

	partition = domain->partitions[partition_id];

	_x86_mmu_set_flags((void *)partition.start,
			   partition.size,
			   K_MEM_PARTITION_P_RW_U_NA,
			   K_MEM_PARTITION_PERM_MASK);

 out:
	return;
}

u8_t _arch_mem_domain_max_partitions_get(void)
{
	return CONFIG_MAX_DOMAIN_PARTITIONS;
}

#endif	/* CONFIG_X86_USERSPACE*/


text:
jQuery( document ).ready(function() {
    jQuery('.articlepicker').each(function() {
        ArticlePicker.initArticlePicker(this);
    });
});
var ArticlePicker = {

    data: {},

    initArticlePicker: function(el) {
        var $url = jQuery('#basehref').text();
        var $id = jQuery(el).data('field-id');
        var $val = jQuery(el).data('field-value');

        if (typeof ArticlePicker.data[$id] === 'undefined') {

            // No data yet, fetching it as we are the first one
            ArticlePicker.data[$id] = {};
            ArticlePicker.data[$id].ready = false;
            ArticlePicker.data[$id].callbacks = [];

            jQuery.getJSON($url + '/content_article/fieldParams/' + $id, function(data) {
                ArticlePicker.data[$id].data = data;
                ArticlePicker.data[$id].ready = true;

                // Call self again as we are done here
                ArticlePicker.initArticlePicker(el);

                // Looping through all the callbacks that we got while waiting for data
                ArticlePicker.data[$id].callbacks.forEach(function(current) {
                    ArticlePicker.initArticlePicker(current);
                });
            });
        } else {
            // There is already something, next up; we find what it is
            if (ArticlePicker.data[$id].ready) {
                // We have data. We are using it here
                var items = [];
                var $sel = '';
                var data = ArticlePicker.data[$id].data;

                jQuery.each(data, function(key, val) {
                    $sel = '';
                    if ($val == val.id) {
                        $sel = 'selected="selected"';
                    }
                    items.push('<option value="' + val.id + '" ' + $sel + '>' + val.title + '</option>');
                });

                var $html = items.join('');
                jQuery($html).appendTo(el);
            } else {
                // We don't have data. But someone is already trying to fetch it. Be nice and ask them to call back when ready
                // TODO find out if there is any, even remote possibility that the first fetch might be done before all of these callbacks have been set
                ArticlePicker.data[$id].callbacks.push(el);
            }
        }
    }
}


text:
//This game was created and developed by Jiří Kozlovský whose nickname is 'jirislav'.
//This code is licensed under MIT license. Feel free to fork & modify.

/* TODO list

1) fabricate dynamic welcomeScreen where can be chosen difficulty - each'll have seperate records

2) fabricate pause functionality
2-a)  every second elapsed while paused will substract one scorePoint

3)  addEventListener to 'real-time' resize window

4)  save 10 best records && prompt for identifier (nickname)

end of TODO */

var version="1.2.2 - debug",svg,radius,downSight,started,columns,ratio,columnsCount,redsInRound,speed,circlesCountAtOnce,optimizedRenderingSpeed,progressAppearDuration,svgWidth,svgHeight,accelerator,bonusGap,summedGaps,circleRoundID,greensInRow,nbsPoints,oldSpeed,scoreBoard,lifesBoard,progressBarHeight,levelProgress,rgRatio,tenLifesBonus,
    w = document.documentElement.clientWidth-1,
    h = document.documentElement.clientHeight-1,
    hQuarter = Math.round(h / 4),
    mouseOver = !1,
    mouseOverRound = 5,//8
    progressAppearDuration = 200,
    level = 0,
    levelTransitionDuration = 1400,
    ratio = 13E-1,
    dur = 2E3,//2E3
    HUDdurationAppear = 1000,
    HUDdurationDisappear = 250,
    score = 0,
    body = d3.select("body"),
    lifes = 5,
    flames=[!1,!1],
    stop = !1,
    resetButtonText = ["Start again","Go for it now!"],
    manualButtonText = "Read manual",
    delRecsText = "Delete records",
    circlesCountAtOnceInitial = 3, //4
    columns = {
      values: new Array(),
      recalculate: function(a) {
        var b=svgWidth/(2*a);
        this.values = new Array();
        while(a--)this.values[a]=(1+2*a)*b;
        },
      chooseRandom: function() {
        return this.values[Math.floor(Math.random()*this.values.length)]
        }
    },
assignValues = function(a) {
    w = document.documentElement.clientWidth-1;
    h = document.documentElement.clientHeight-1;
    d3.select("div#top").style("width", w+"px");
    divTopHeight = Math.round(parseInt(d3.select("div#top").style("height")));
    svgWidth = w < ratio*h ? w : Math.round(ratio*h);
    progressBarHeight = h/20;
    svgHeight = h-divTopHeight-1.2*progressBarHeight;
    columnsCount = level+2;//+5
    columns.recalculate(columnsCount);
    document.getElementById("s"+(level-1)) && circleFadeOut("s"+(level-1));
    var svgId = "s"+level;
    svg = body.append("svg:svg").attr({width:svgWidth,height:svgHeight,id:svgId}).style({
      left: Math.round((w - parseInt(d3.select("#"+svgId).attr("width"))) / 2)+"px",
      top: divTopHeight+"px"
      });
    scoreBoard = d3.select("span#score");
    lifesBoard = d3.select("span.lifes");
    hQuarter = Math.round(h / 4);
    radius = svgWidth / (columnsCount*2+1);
    downSight = svgWidth + radius;
    redsInRound=0;
    tenLifesBonus=10*level;
    optimizedRenderingSpeed=!1;
    circleRoundID=0;
    greensInRow=0;
    nbsPoints=0;
    levelProgress=0;
    speed=1.3;
    disposeProgressBar(HUDdurationDisappear);
    setTimeout(createProgressBar, HUDdurationDisappear);
    rgRatio = 5E-1;
    !1 == mouseOver && (circlesCountAtOnce=circlesCountAtOnceInitial,bonusGap=10);
    mouseOverRound <= level && (enlargeBonusGap(),rgRatio=35E-2);
    1 == level && d3.select("span#level").style("opacity",0).transition().ease("exp").duration(HUDdurationAppear).style("opacity",1)  ||  niceLevelTransition(levelTransitionDuration);
    summedGaps = sumBonusGaps();
}, sumBonusGaps = function(a) {
  var s = 0, n = null == a ? bonusGap : a;
  while(n)s+=n--;
  return s;
}, reversedSumBG = function(a) {
  var s = 0;
  while(a<bonusGap)s+=++a;
  return s;
}, niceLevelTransition = function(d) {
  var a = d3.select("span#level"),
  b = parseInt(a.style("font-size")),
  c = parseInt(a.style("width"));
  d3.select("span#level").style("opacity",0).text("Level "+level).style({
      color:"green",
      top:hQuarter+"px",
      "font-size": function() {return a*1.5+"px"},
      left: function() { return Math.round(w-c)/2+"px"}
      })
    .transition().duration(.25*d).style("opacity",1)
    .transition().duration(.75*d).style({
      color:"black",
      top:"0px",
      "font-size": function() {return a+"px"},
      left: function() { return Math.round(w-c)/2+"px"}
      });
}, enlargeBonusGap = function() {
  (bonusGap=(Math.ceil(.5*level)+8)) && (circlesCountAtOnce=((1.5 + level/40)*circlesCountAtOnceInitial)) && (!0 == mouseOver || (mouseOver=!0, setTimeout(function() {return echoMouseover(levelTransitionDuration*1.6)},.6*levelTransitionDuration)));
},echoMouseover = function(d) {
  body.append("span").text("Switched to mouseover!").style({
      color: "green",
      position: "absolute",
      display: "inline",
      "white-space": "nowrap",
      top: hQuarter +"px",
      left: function() {return "-"+d3.select(this).style("width")},
      opacity: 0
    }).transition().duration(.25*d).style({
      left: function() {return (w-parseInt(d3.select(this).style("width")))/2 + "px"},
      opacity: 1
    }).transition().delay(.5*d).duration(.25*d).style({
      left: function() {return (w+parseInt(d3.select(this).style("width"))) + "px"},
      opacity: 0
    }).remove();
}, startIt = function() {
  0 == circleRoundID % 8 && speedUp(2*Math.pow(level,1/2));
  var a = initNew(chooseColor(rgRatio)), b = speed * dur;
  goUp(a, b);
  stop || setTimeout(startIt, b / (circlesCountAtOnce+1));
}, initNew = function(a) {
  circleRoundID++;
  return svg.append("circle").attr(attrCircle).style({fill: a, "shape-rendering": function(){return !0 == optimizedRenderingSpeed ? "optimizeSpeed" : null;}}).on(!1 == mouseOver ? "mousedown" : "mouseover", handleClick(a, circleRoundID));
}, attrCircle = {
    "id": function() {return "c" + circleRoundID},
    "r": function() {return radius},
    "cx": function() {return columns.chooseRandom()},
    "cy": function() {return downSight}
}, goUp = function(a, b) {
  a.transition().duration(b).ease("linear").attr("cy", -radius).each("end", function() {
  circleReachedEnd(a);
  }).remove();
}, circleReachedEnd = function(a) {
  "rgb(0, 128, 0)" == a.style("fill") && (addLifes(-1), greensInRow=0);
}, chooseColor = function(a) {
  var b = Math.random();
  a < b ? (b="red") : (b="green");
  return b;
}, disposeProgressBar = function(a) {
  d3.select("div#progressBar").transition().ease("quad").duration(80).style("background", "rgba(0, 0, 0, 0) linear-gradient(to right, rgb(0, 128, 0) 100%, rgb(0, 128, 0) 100%, rgba(0, 0, 0, 0) 100%) repeat scroll 0% 0% / auto padding-box border-box").transition().duration(a-80).style("bottom", function() {return "-"+d3.select(this).style("height")}).remove();
}, createProgressBar = function() {
  appendDiv().attr("id", "progressBar").style({
    height: .9*progressBarHeight+"px",
    bottom: "-"+progressBarHeight+"px",
    width: .9*w+"px",
    "margin-bottom": .1*progressBarHeight+"px",
    "border-width": h/200+"px",
    left: function() {return (w-parseInt(d3.select(this).style("width")))/2+"px"}
  }).transition().duration(levelTransitionDuration).style("bottom","0px");
}, moveProgressBar = function(b, d) {
  var a = getLevelProgress(), e = a+(100-a)/30, c;
  (!0==b)?(c = getLastCP()+"%, rgb(0, 128, 0) "+a):(c = getLastCP()+"%, rgb(255, 255, 0) "+a);
    return d3.select("#progressBar").transition().ease("linear").duration(d).style("background", "rgba(0, 0, 0, 0) linear-gradient(to right, rgb(0, 128, 0) "+c+"%, rgba(255, 255, 0, 0) "+e+"%) repeat scroll 0% 0% / auto padding-box border-box");
}, getLevelProgress = function() {
  return Math.round(100*levelProgress/summedGaps);
}, getLastCP = function() {
  return Math.round(100*reversedSumBG(bonusGap-nbsPoints)/summedGaps);
}, levelUp = function(a) {
  a==null?level++:level+=a;
  d3.select("span#level").transition().duration(200).style("opacity",1==level?1:0);
  assignValues(level);
}, checkNBS = function() {//
    levelProgress++;
  greensInRow >= (bonusGap - nbsPoints) ?
    (greensInRow=0,
    moveProgressBar(!0, progressAppearDuration),
    (10>lifes) && addLifes(1),
    nbsPoints++ == (bonusGap-1) && levelUp()) :
    moveProgressBar(!1, progressAppearDuration);
}, speedUp = function(a) {
  a = 1 - a / 100;
  a = Math.pow(a, 1 - 1 / (speed * a*1.8 *Math.pow(level,-1/5)));
  speed *= a;
  0.5 < speed || (!0 == optimizedRenderingSpeed || (optimizedRenderingSpeed = !0));
}, addBonusScore = function(a) {

  scoreBoard.style("color", "green").transition().duration(1E3).transition().style("color", null);
  score += a;
  scoreBoard.text(score);

}, addScore = function(a) {
  var b = "green";
  0 >= a && (b = "red");
  scoreBoard.style("color", b).transition().duration(1E3).transition().style("color", null);
  9 < lifes && (a+=tenLifesBonus);
  score += a;
  scoreBoard.text(score);
}, flameSpan = function(a,b) {
  b != flames[a] && (d3.select("span"+(0!=a?"#score":".lifes")).classed("flames",b),(flames[a]=b));
}, addLifes = function(a) {
  var b = "red", c = !0;
  0 < a ? (b = "green", a = "+" + a, c = !1, (8 < lifes ? flameSpan(1,!0) : (1!=lifes || flameSpan(0,!1)))) : (flameSpan(1,!1),(3>lifes && flameSpan(0,!0)));
  d3.select("div#lifes").append("span").attr("class","bonus").style({top:(hQuarter*2)+"px", display:"inline", color:b}).text(a+" life(s)")
    .transition().duration(90).style({opacity: 1, top:hQuarter+"px"})
    .transition().duration(205).ease("exp").style({opacity: 1e-7, top:"0px"})
    .remove();
  setTimeout(function() {
    lifes+=parseInt(a);
    lifesBoard.text(lifes);
    -1 == lifes + a && stopIt();
  }, 310);
  !0 == c && moveProgressBarToLastCP();
}, moveProgressBarToLastCP = function() {
  levelProgress = reversedSumBG(bonusGap-nbsPoints); moveProgressBar(!0, progressAppearDuration);
}, handleClick = function(a, b) {
  return "green" == a ? handleGreenClick(b) : handleRedClick(b);
}, handleGreenClick = function(a) {
  return function() {
    greensInRow++;
    (nbsPoints == (bonusGap-1))?circleFadeOut("s"+(level)):circleFadeOut(a);
    checkNBS();
    addScore(15*level); //25
  };
}, handleRedClick = function(a) {
  return function() {
    greensInRow=0;
    redsInRound++;
    var b = level*15 * redsInRound; //*25
    circleFadeOut(a);
    moveProgressBarToLastCP();
    score < b ? (addScore(-score), addLifes(-1)) : addScore(-b*level);
  };
}, circleFadeOut = function(a) {
  return ("s" == a[0] &&
    (
    d3.selectAll("circle").on("mousedown", null).transition().duration(200).attr("r", 7 * radius / 6).style("opacity", 1E-7).remove().each("end", function() {d3.select("#"+a).remove()})
    ) || d3.select("#c" + a).on("mousedown", null).transition().duration(200).attr("r", 7 * radius / 6).style("opacity", 1E-7).remove());
}, topBackground = function(b, c) {
  !1 == b ? d3.select("div#top").style("width", w+"px").transition().duration(HUDdurationDisappear)
    .style("top", function() {return "-"+d3.select(this).style("height")})
    .each("end", function() {d3.select(this).remove()}) :
  appendTopDiv(null == c ? !1 : !0);
}, appendTopDiv = function(b) {
var a = appendDiv().attr("id","top"), topMargin = Math.round(h/10);
  if(!b) {
    var c = a.append("div").attr("id","lifes");
    c.append("span").classed("lifes",true).text(5);
    c.append("span").text(" life(s)");
    a.append("span").attr("id","level").text("Level 1");
    a.append("span").attr("id","score").text(0);
    a.append("span").attr("id","version").text("touchpad version "+version);
  }else{
    a.style({
      background:"transparent",
      "margin-left":"2em"
      });
    a.append("button").classed("red", true).on("click",function() {deleteHighScores()}).text(delRecsText);
    a.append("button").classed("green", true).on("click",function() {evadeAll();setTimeout(parent.location="manual", HUDdurationDisappear)}).text(manualButtonText);
    a.append("button").classed({"green": true, "restart":true}).on("click",function() {disposeProgressBar();evadeAll();setTimeout(parent.location.reload(), HUDdurationDisappear)}).on("mouseover",function(){d3.select(this).text(resetButtonText[1])}).on("mouseout",function(){d3.select(this).text(resetButtonText[0])}).text(resetButtonText[0]);
    d3.select("div#endScreen").style({
      top: function() {return (divTopHeight+topMargin+parseInt(d3.select(this).style("top")))+"px"},
      left: function() {return "-"+d3.select(this).style("width")}
      }).transition().duration(HUDdurationAppear).style("left",Math.round(w/15)+"px");
  }
a.transition().duration(HUDdurationAppear).style("top",(!0 == b?(topMargin):0)+"px");
}, evadeAll = function() {
  body.selectAll("* div").transition().duration(HUDdurationDisappear).style("top",-h+"px").remove();
}, saveRec = function() {
  cookie.set("rec", score);
}, getRec = function() {
  return parseInt(cookie.get("rec")) || 0;
}, pause = function(a) {
  !0 == a ? ((oldSpeed = speed) && (speed = 1E6)) : (speed=oldSpeed) || (speed=.8);
}, stopIt = function() {
  topBackground(!1);
  stop = !0;
  circleFadeOut("s"+level);
  endScreen();
}, endScreen = function() {
  var a=appendDiv("endScreen"),  b = getRec(), e = (1e-3*((new Date()).getTime()-started.getTime())), r = a.append("div").classed("record",true).append("span");
  b < score ? (saveRec(),r.text("New record achieved!\n")) : r.text("Your best: "+b);
  a.append("div").classed("scoreReached",true).append("span").text("You scored: "+score);
  a.append("div").classed("levelReached",true).append("span").text("Level reached: "+level);
  a.append("div").classed("elapsed",true).append("span").text("Time elapsed: "+(60 < e ? (Math.round(e/60)+" min(s) "):"")+
  (Math.round(e%60)+" sec(s)"));
  topBackground(!0, !0);
}, appendDiv = function(a) {
  return (null == a ? body.append("div") : body.append("div").attr("id", a));
}, delBest = function() {
  d3.select("div.record span").text("Your best: 0");
  cookie.del("rec") && console.log("Best record ("+getRec()+" score points) has been successfully deleted.");
}, deleteHighScores = function() {
  confirm("Really do you want to delete your high score?\n\n\tYou already have awesome " + getRec() + " points!") && delBest();
}, totalSecs = function(a) {
  return Math.round(((new Date).getTime() - a.getTime()) / 100) / 10;
}, prepareUI = function() {
  d3.select("div#lifes").style("display", "block");
  d3.selectAll("span").style("display", "inline")
    .transition().duration(HUDdurationAppear);
  d3.select("span#level").style("left", function() { return Math.round(w-parseInt(d3.select(this).style("width")))/2+"px"});
  levelUp();
}, decreaseCountdown = function(a) {
  var b = body.append("span").attr("class", "countdown")
    .text(a).style({
      color:0<a?(3==a?"red":"orange"):"green",
      left: function() {
        return (w-parseInt(d3.select(this).style("width")))/2 + "px";
        },
      top: hQuarter+"px",
      opacity: 0
      })
    .transition().duration(590).style({
      top: "0px",
      opacity: 1
      })
    .transition().duration(390).style({top:function(){return "-"+d3.select(this).style("font-size");}, opacity: 0})
    .remove();

}, countDown = function() {
  setTimeout(function() {
    decreaseCountdown(3);
    setTimeout(function() {
      decreaseCountdown(2);
      setTimeout(function() {
        decreaseCountdown(1);
        setTimeout(function() {
          initialize();
        }, 1E3);
      }, 1E3);
    }, 1E3);
  }, 1E3);
}, initialize = function() {
  topBackground(!0);
  prepareUI();
  started = new Date();
  startIt();
  decreaseCountdown("Go !");
}, debug = function(a,b) {
  null == a && (a=!0);
  null == b && (b=1);
  "columns" == a && debugColumns();
  !1 == a ? (lifes= 5,speed=1) : (lifes= 5000,speed=b);
};

countDown();


text:
Puppet::Type.newtype(:gce_forwardingrule) do
  desc 'forwardingrule'

  ensurable

  newparam(:name, :namevar => true) do
    validate do |value|
      unless value =~ /[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?/
        raise(Puppet::Error, "Invalid forwardingrule name: #{v}")
      end
    end
  end

  newparam(:ip) do
    desc 'the project-reserved IP address for the forwarding rule'
    validate do |value|
      unless value =~ /[0-9]{1,3}(?:\.[0-9]{1,3}){3}/
        raise "Invalid IP address #{value}"
      end
    end
  end

  newparam(:description) do
    desc 'forwardingrule description'
  end

  newparam(:protocol) do
    desc 'The IP protocol for the forwarding rule, TCP or UDP'
    validate do |value|
      unless ['TCP', 'UDP'].include? value
        raise "Protocol value can only be 'TCP' or 'UDP': #{value}"
      end
    end
  end

  newparam(:port_range) do
    desc 'If protocol is TCP, the port range for the forwarding rule'
  end

  newparam(:region) do
    desc 'The specified region for the forwarding rule'
  end

  newparam(:target) do
    desc 'The name of the target pool for the forwarding rule'
  end

end


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/imagescroll"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"
        android:background="#222222">

        <!-- 알람 이름 -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/xml_border"
            android:layout_marginTop="30dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:gravity="center">
            <TextView
                android:layout_marginLeft="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="알람이름"
                android:textSize="15sp"
                android:textColor="#ffffff"/>
            <EditText
                android:id="@+id/alarmName"
                android:layout_marginTop="3dp"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="10dp"
                android:singleLine="true"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="이름을 입력하세요"
                android:textSize="13sp"/>
            </LinearLayout>

        <!--기능 선택-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:background="@drawable/xml_border"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:orientation="vertical">
            <TextView
                android:layout_marginLeft="20dp"
                android:layout_marginTop="15dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="기능선택"
                android:textSize="15sp"
                android:textColor="#ffffff"/>
            <View
                android:layout_marginTop="10dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp"
                android:layout_width="wrap_content"
                android:layout_height="0.5dp"
                android:background="#cecccc" />
                    <!-- 여기다가 토글버튼 3개 넣기 -->
                    <LinearLayout
                        android:layout_marginTop="10dp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:layout_gravity="center">

                        <ToggleButton
                            android:layout_margin="5dp"
                            android:id="@+id/toggleButton01"
                            android:layout_width="45dp"
                            android:layout_height="60dp"
                            android:background="@drawable/off_wifi"
                            android:textOff=""
                            android:textOn=""
                            android:layout_alignTop="@+id/bell_btn"
                            android:layout_alignLeft="@+id/wifi_btn"
                            android:layout_alignStart="@+id/wifi_btn"
                            android:layout_alignRight="@+id/wifi_btn"
                            android:layout_alignEnd="@+id/wifi_btn" />

                        <ToggleButton
                            android:layout_margin="5dp"
                            android:id="@+id/toggleButton02"
                            android:layout_width="45dp"
                            android:layout_height="60dp"
                            android:background="@drawable/off_manner"
                            android:textOff=""
                            android:textOn=""
                            android:layout_alignTop="@+id/bell_btn"
                            android:layout_alignLeft="@+id/bell_btn"
                            android:layout_alignStart="@+id/bell_btn" />

                        <ToggleButton
                            android:layout_margin="5dp"
                            android:id="@+id/toggleButton03"
                            android:layout_width="45dp"
                            android:layout_height="60dp"
                            android:background="@drawable/off_push"
                            android:textOff=""
                            android:textOn=""
                            android:layout_alignTop="@+id/toggleButton02"
                            android:layout_alignRight="@+id/func_background1"
                            android:layout_alignEnd="@+id/func_background1" />
                    </LinearLayout>
        </LinearLayout>

        <!--장소 설정-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/xml_border"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:onClick="mapMove"
            >
            <TextView
                android:layout_marginTop="15dp"
                android:layout_marginLeft="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="장소설정"
                android:textSize="15sp"
                android:textColor="#ffffff"/>
        </LinearLayout>

        <!--알람 타입-->
        <LinearLayout
            android:id="@+id/alarmType"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="@drawable/xml_border"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:orientation="vertical">

            <TextView
                android:layout_marginLeft="20dp"
                android:layout_marginTop="15dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="알람타입"
                android:textSize="15sp"
                android:textColor="#ffffff"/>
            <View
                android:layout_marginTop="10dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp"
                android:layout_width="wrap_content"
                android:layout_height="0.5dp"
                android:background="#cecccc" />
            <!-- 여기다가 토글버튼 3개 넣기 & 볼륨 프로그레스바 넣기. -->
            <LinearLayout
                android:layout_marginTop="10dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="center">
                <ToggleButton
                    android:layout_margin="5dp"
                    android:id="@+id/toggleButton04"
                    android:layout_width="45dp"
                    android:layout_height="45dp"
                    android:background="@drawable/off_sound"
                    android:textOff=""
                    android:textOn=""
                    android:layout_alignTop="@+id/bell_btn"
                    android:layout_alignLeft="@+id/wifi_btn"
                    android:layout_alignStart="@+id/wifi_btn"
                    android:layout_alignRight="@+id/wifi_btn"
                    android:layout_alignEnd="@+id/wifi_btn" />
                <ToggleButton
                    android:layout_margin="5dp"
                    android:id="@+id/toggleButton05"
                    android:layout_width="45dp"
                    android:layout_height="45dp"
                    android:background="@drawable/off_vib"
                    android:textOff=""
                    android:textOn=""
                    android:layout_alignTop="@+id/bell_btn"
                    android:layout_alignLeft="@+id/wifi_btn"
                    android:layout_alignStart="@+id/wifi_btn"
                    android:layout_alignRight="@+id/wifi_btn"
                    android:layout_alignEnd="@+id/wifi_btn" />
                <ToggleButton
                    android:layout_margin="5dp"
                    android:id="@+id/toggleButton06"
                    android:layout_width="45dp"
                    android:layout_height="45dp"
                    android:background="@drawable/off_etc"
                    android:textOff=""
                    android:textOn=""
                    android:layout_alignTop="@+id/bell_btn"
                    android:layout_alignLeft="@+id/wifi_btn"
                    android:layout_alignStart="@+id/wifi_btn"
                    android:layout_alignRight="@+id/wifi_btn"
                    android:layout_alignEnd="@+id/wifi_btn" />
            </LinearLayout>

            <LinearLayout
                android:layout_marginTop="10dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="center">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="볼륨"
                    android:textSize="15sp"
                    android:textColor="#ffffff"/>
                <SeekBar
                    android:progressDrawable="@drawable/progress_horizontal"
                    android:thumb="@drawable/seek_thumb_custom"
                    android:id="@+id/volumeSeekBar"
                    android:layout_marginLeft="10dp"
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:max="15"
                    />
            </LinearLayout>
        </LinearLayout>

        <!--알람 메모-->
        <LinearLayout
            android:id="@+id/alarmMemo"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/xml_border"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:gravity="center">
            <TextView
                android:layout_marginLeft="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="알람메모"
                android:textSize="15sp"
                android:textColor="#ffffff"/>
            <EditText
                android:id="@+id/et_alarmMemo"
                android:layout_marginTop="3dp"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="10dp"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="메모를 입력하세요."
                android:textSize="13sp"/>
        </LinearLayout>

        <Button
            android:layout_gravity="center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="임시 완료 버튼"
            android:onClick="saveBtn"/>

    </LinearLayout>
</ScrollView><!-- From: file:/C:/Users/Administrator/Desktop/ONOFFZONE0617/app/src/main/res/layout/function_activity.xml -->


text:
"""
Need a driver for setup.py to use in the entry_points array
"""

import argparse

from actadiurna import generateMOTD

def actaMain():
  """Driver script for setup.py to use as an entry point"""

  parser = argparse.ArgumentParser()

  parser.add_argument("--update-directory",
                      dest="updateDirectory",
                      help="Specify directory to load fragment files from",
                      default="/etc/update-motd.d")

  parser.add_argument("--output",
                      help="Specify output file",
                      default="/etc/motd")

  args = parser.parse_args()
  generateMOTD(output=args.output, updateDirectory=args.updateDirectory)

if __name__ == "__main__":
  actaMain()


text:
package io.quarkus.hibernate.search.orm.coordination.outboxpolling.test.configuration.pu1;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;

/**
 * An indexed entity.
 */
@Entity
@Indexed
public class IndexedEntityForPU1 {

    @Id
    @GeneratedValue
    private Long id;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
An. Jard. bot. Madr. 4: 207 (1944)

#### Original name
Cicinobolus caryolophae Losa

### Remarks
null


text:
const should = require('should');
const supertest = require('supertest');
const sinon = require('sinon');
const testUtils = require('../../utils');
const config = require('../../../core/shared/config');
const mailService = require('../../../core/server/services/mail');
const localUtils = require('./utils');

describe('Invites API', function () {
    let request;

    before(async function () {
        await testUtils.startGhost();
        request = supertest.agent(config.get('url'));
        await localUtils.doAuth(request, 'invites');
    });

    beforeEach(function () {
        sinon.stub(mailService.GhostMailer.prototype, 'send').resolves('Mail is disabled');
    });

    afterEach(function () {
        sinon.restore();
    });

    it('Can fetch all invites', async function () {
        const res = await request.get(localUtils.API.getApiQuery('invites/'))
            .set('Origin', config.get('url'))
            .expect('Content-Type', /json/)
            .expect('Cache-Control', testUtils.cacheRules.private)
            .expect(200);

        should.not.exist(res.headers['x-cache-invalidate']);
        const jsonResponse = res.body;
        should.exist(jsonResponse);
        should.exist(jsonResponse.invites);
        jsonResponse.invites.should.have.length(2);

        localUtils.API.checkResponse(jsonResponse, 'invites');
        localUtils.API.checkResponse(jsonResponse.invites[0], 'invite');

        jsonResponse.invites[0].status.should.eql('sent');
        jsonResponse.invites[0].email.should.eql('test1@ghost.org');
        jsonResponse.invites[0].role_id.should.eql(testUtils.roles.ids.admin);

        jsonResponse.invites[1].status.should.eql('sent');
        jsonResponse.invites[1].email.should.eql('test2@ghost.org');
        jsonResponse.invites[1].role_id.should.eql(testUtils.roles.ids.author);

        mailService.GhostMailer.prototype.send.called.should.be.false();
    });

    it('Can read an invitation by id', async function () {
        const res = await request.get(localUtils.API.getApiQuery(`invites/${testUtils.DataGenerator.forKnex.invites[0].id}/`))
            .set('Origin', config.get('url'))
            .expect('Content-Type', /json/)
            .expect('Cache-Control', testUtils.cacheRules.private)
            .expect(200);

        should.not.exist(res.headers['x-cache-invalidate']);
        const jsonResponse = res.body;
        should.exist(jsonResponse);
        should.exist(jsonResponse.invites);
        jsonResponse.invites.should.have.length(1);

        localUtils.API.checkResponse(jsonResponse.invites[0], 'invite');

        mailService.GhostMailer.prototype.send.called.should.be.false();
    });

    it('Can add a new invite', async function () {
        const res = await request
            .post(localUtils.API.getApiQuery('invites/'))
            .set('Origin', config.get('url'))
            .send({
                invites: [{email: 'test@example.com', role_id: testUtils.existingData.roles[1].id}]
            })
            .expect('Content-Type', /json/)
            .expect('Cache-Control', testUtils.cacheRules.private)
            .expect(201);

        should.not.exist(res.headers['x-cache-invalidate']);
        const jsonResponse = res.body;
        should.exist(jsonResponse);
        should.exist(jsonResponse.invites);
        jsonResponse.invites.should.have.length(1);

        localUtils.API.checkResponse(jsonResponse.invites[0], 'invite');
        jsonResponse.invites[0].role_id.should.eql(testUtils.existingData.roles[1].id);

        mailService.GhostMailer.prototype.send.called.should.be.true();

        should.exist(res.headers.location);
        res.headers.location.should.equal(`http://127.0.0.1:2369${localUtils.API.getApiQuery('invites/')}${res.body.invites[0].id}/`);
    });

    it('Can destroy an existing invite', async function () {
        await request.del(localUtils.API.getApiQuery(`invites/${testUtils.DataGenerator.forKnex.invites[0].id}/`))
            .set('Origin', config.get('url'))
            .expect('Cache-Control', testUtils.cacheRules.private)
            .expect(204);

        mailService.GhostMailer.prototype.send.called.should.be.false();
    });
});


text:
cd $(dirname "$(readlink -f "$0")")

#Only for mesa, doesn't hurt anyone else
#Only works for radeon, not for intel. Why?
export MESA_GL_VERSION_OVERRIDE=4.1 MESA_GLSL_VERSION_OVERRIDE=410

./hellovr "$@"


text:
import Context from '../../../shared/Context';

export default class RactiveEvent {
  constructor(component, name) {
    this.component = component;
    this.name = name;
    this.handler = null;
  }

  bind(directive) {
    const ractive = this.component.instance;

    this.handler = ractive.on(this.name, (...args) => {
      // watch for reproxy
      if (args[0] instanceof Context) {
        const ctx = args.shift();
        ctx.component = ractive;
        directive.fire(ctx, args);
      } else {
        directive.fire({}, args);
      }

      // cancel bubbling
      return false;
    });
  }

  render() {}

  unbind() {
    this.handler.cancel();
  }

  unrender() {}
}


text:
function filter(pred, arr) {
    var len = arr.length;
    var filtered = []; // shorter version of new Array();
    // iterate through every element in the array...
    for (i = 0; i < len; i = i + 1) {
        var val = arr[i];
        // if the element satisfies the predicate let it through
        if (pred(val)) {
            filtered.push(val);
        }
    }
    return filtered;
}

var someRandomNumbers = [12, 32, 1, 3, 2, 2, 234, 236, 632, 7, 8];

assert(11, someRandomNumbers.length);

function makeGreaterThanPredicate(lowerBound) {
    return function(numberToCheck) {
        return (numberToCheck > lowerBound) ? true : false;
    };
}

var greaterThan10 = makeGreaterThanPredicate(10);
var greaterThan100 = makeGreaterThanPredicate(100);

a = filter(greaterThan10, someRandomNumbers);
b = filter(greaterThan100, someRandomNumbers);

assert(5, a.length);
assert(3, b.length);

function foo() {
    var x = "right";
    function bar() {
        assert("right", x);
    }
    callFunc(bar);
}

function callFunc(f) {
    var x = "wrong";
    f();
}

foo();


text:
.carousel-overlay {
	background-color: black;
	opacity: .5;
}

.carousel-viewport {
	width : 600px;
	margin: 20px auto;
	position: relative;
}

.carousel-viewport .carousel-close {
	position: absolute;
	top : -8px;
	right : -8px;
	background: url('imgs/close.png') no-repeat center center;
	width: 31px;
	height: 31px;
	text-indent: -9999px;
}

.carousel-viewport .slide-left {
	position: absolute;
	top : 100%;
	left : 0px;
	background: url('imgs/left.png') no-repeat center center;
	height: 30px;
	width: 60px;
	text-indent: -9999px;
}

.no-left .slide-left {
	display: none;
}

.carousel-viewport .slide-right {
	position: absolute;
	top : 100%;
	right : 0px;
	background: url('imgs/right.png') no-repeat center center;
	height: 30px;
	width: 60px;
	text-indent: -9999px;
}

.no-right .slide-right {
	display: none;
}

.carousel-content-wrapper {
	height : 400px;
	background-color: white;
	border: 15px solid black;
	padding: 5px;
	border-radius: 10px;
}

.carousel-content {
	overflow: hidden;
	background-color: white;
}

.image-wrapper b {
	text-align: center;
	font-family: "Comic Sans MS", cursive, sans-serif;
	font-size: 24px;
	line-height: 50px;
	display: block;
}

.image-wrapper img {
	display: block;
	margin: 0px auto;
	height: 350px;
}


text:
require 'test_helper'
require 'gds_api/router'

describe GdsApi::Router do

  before do
    @base_api_url = "http://router-api.example.com"
    @api = GdsApi::Router.new(@base_api_url)
  end

  describe "managing backends" do
    describe "fetching details about a backend" do
      it "should return backend details" do
        req = WebMock.stub_request(:get, "#{@base_api_url}/backends/foo").
          to_return(:body => {"backend_id" => "foo", "backend_url" => "http://foo.example.com/"}.to_json,
                    :headers => {"Content-type" => "application/json"})

        response = @api.get_backend("foo")
        assert_equal 200, response.code
        assert_equal "http://foo.example.com/", response.backend_url

        assert_requested(req)
      end

      it "should return nil for a non-existend backend" do
        req = WebMock.stub_request(:get, "#{@base_api_url}/backends/foo").
          to_return(:status => 404)

        response = @api.get_backend("foo")
        assert_nil response

        assert_requested(req)
      end

      it "should URI escape the given ID" do
        req = WebMock.stub_request(:get, "#{@base_api_url}/backends/foo+bar").
          to_return(:status => 404)

        response = @api.get_backend("foo bar")
        assert_nil response

        assert_requested(req)
      end
    end

    describe "creating/updating a backend" do
      it "should allow creating/updating a backend" do
        req = WebMock.stub_request(:put, "#{@base_api_url}/backends/foo").
          with(:body => {"backend" => {"backend_url" => "http://foo.example.com/"}}.to_json).
          to_return(:status => 201, :body => {"backend_id" => "foo", "backend_url" => "http://foo.example.com/"}.to_json,
                    :headers => {"Content-type" => "application/json"})

        response = @api.add_backend("foo", "http://foo.example.com/")
        assert_equal 201, response.code
        assert_equal "http://foo.example.com/", response.backend_url

        assert_requested(req)
      end

      it "should raise an error if creating/updating a backend fails" do
        response_data = {"backend_id" => "foo", "backend_url" => "ftp://foo.example.com/", "errors" => {"backend_url" => "is not an HTTP URL"}}
        req = WebMock.stub_request(:put, "#{@base_api_url}/backends/foo").
          with(:body => {"backend" => {"backend_url" => "http://foo.example.com/"}}.to_json).
          to_return(:status => 400, :body => response_data.to_json, :headers => {"Content-type" => "application/json"})

        e = nil
        begin
          @api.add_backend("foo", "http://foo.example.com/")
        rescue GdsApi::HTTPErrorResponse => ex
          e = ex
        end

        refute_nil e
        assert_equal 400, e.code
        assert_equal response_data, e.error_details

        assert_requested(req)
      end

      it "should URI escape the passed id" do
        req = WebMock.stub_request(:put, "#{@base_api_url}/backends/foo+bar").
          with(:body => {"backend" => {"backend_url" => "http://foo.example.com/"}}.to_json).
          to_return(:status => 404, :body => "Not found")

        # We expect a GdsApi::HTTPErrorResponse, but we want to ensure nothing else is raised
        begin
          @api.add_backend("foo bar", "http://foo.example.com/")
        rescue GdsApi::HTTPErrorResponse
        end

        assert_requested(req)
      end
    end

    describe "deleting a backend" do
      it "allow deleting a backend" do
        req = WebMock.stub_request(:delete, "#{@base_api_url}/backends/foo").
          to_return(:status => 200, :body => {"backend_id" => "foo", "backend_url" => "http://foo.example.com/"}.to_json,
                    :headers => {"Content-type" => "application/json"})

        response = @api.delete_backend("foo")
        assert_equal 200, response.code
        assert_equal "http://foo.example.com/", response.backend_url

        assert_requested(req)
      end

      it "should raise an error if deleting the backend fails" do
        response_data = {"backend_id" => "foo", "backend_url" => "ftp://foo.example.com/", "errors" => {"base" => "Backend has routes - can't delete"}}
        req = WebMock.stub_request(:delete, "#{@base_api_url}/backends/foo").
          to_return(:status => 400, :body => response_data.to_json, :headers => {"Content-type" => "application/json"})

        e = nil
        begin
          @api.delete_backend("foo")
        rescue GdsApi::HTTPErrorResponse => ex
          e = ex
        end

        refute_nil e
        assert_equal 400, e.code
        assert_equal response_data, e.error_details

        assert_requested(req)
      end

      it "should URI escape the passed id" do
        req = WebMock.stub_request(:delete, "#{@base_api_url}/backends/foo+bar").
          to_return(:status => 404, :body => "Not found")

        # We expect a GdsApi::HTTPErrorResponse, but we want to ensure nothing else is raised
        begin
          @api.delete_backend("foo bar")
        rescue GdsApi::HTTPErrorResponse
        end

        assert_requested(req)
      end
    end
  end

  describe "managing routes" do
    before :each do
      @commit_req = WebMock.stub_request(:post, "#{@base_api_url}/routes/commit").
        to_return(:status => 200, :body => "Routers updated")
    end

    describe "fetching a route" do
      it "should return the route details" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "backend", "backend_id" => "foo"}
        req = WebMock.stub_request(:get, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo", "route_type" => "exact"}).
          to_return(:status => 200, :body => route_data.to_json, :headers => {"Content-type" => "application/json"})

        response = @api.get_route("/foo", "exact")
        assert_equal 200, response.code
        assert_equal "foo", response.backend_id

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should return nil if nothing found" do
        req = WebMock.stub_request(:get, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo", "route_type" => "exact"}).
          to_return(:status => 404)

        response = @api.get_route("/foo", "exact")
        assert_nil response

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should escape the params" do
        # The WebMock query matcher matches unescaped params.  The call blows up if they're not escaped

        req = WebMock.stub_request(:get, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo bar", "route_type" => "exa ct"}).
          to_return(:status => 404)

        response = @api.get_route("/foo bar", "exa ct")
        assert_nil response

        assert_requested(req)
        assert_not_requested(@commit_req)
      end
    end

    describe "creating/updating a route" do
      it "should allow creating/updating a route" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "backend", "backend_id" => "foo"}
        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          with(:body => {"route" => route_data}.to_json).
          to_return(:status => 201, :body => route_data.to_json, :headers => {"Content-type" => "application/json"})

        response = @api.add_route("/foo", "exact", "foo")
        assert_equal 201, response.code
        assert_equal "foo", response.backend_id

        assert_requested(req)
        assert_requested(@commit_req)
      end

      it "should not commit the routes when asked not to" do
        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          to_return(:status => 201, :body => {}.to_json, :headers => {"Content-type" => "application/json"})

        @api.add_route("/foo", "exact", "foo", :skip_commit => true)

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should raise an error if creating/updating the route fails" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "backend", "backend_id" => "foo"}
        response_data = route_data.merge("errors" => {"backend_id" => "does not exist"})

        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          with(:body => {"route" => route_data}.to_json).
          to_return(:status => 400, :body => response_data.to_json, :headers => {"Content-type" => "application/json"})

        e = nil
        begin
          @api.add_route("/foo", "exact", "foo")
        rescue GdsApi::HTTPErrorResponse => ex
          e = ex
        end

        refute_nil e
        assert_equal 400, e.code
        assert_equal response_data, e.error_details

        assert_requested(req)
        assert_not_requested(@commit_req)
      end
    end

    describe "creating/updating a redirect route" do
      it "should allow creating/updating a redirect route" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "redirect", "redirect_to" => "/bar", "redirect_type" => "permanent"}
        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          with(:body => {"route" => route_data}.to_json).
          to_return(:status => 201, :body => route_data.to_json, :headers => {"Content-type" => "application/json"})

        response = @api.add_redirect_route("/foo", "exact", "/bar")
        assert_equal 201, response.code
        assert_equal "/bar", response.redirect_to

        assert_requested(req)
        assert_requested(@commit_req)
      end

      it "should allow creating/updating a temporary redirect route" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "redirect", "redirect_to" => "/bar", "redirect_type" => "temporary"}
        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          with(:body => {"route" => route_data}.to_json).
          to_return(:status => 201, :body => route_data.to_json, :headers => {"Content-type" => "application/json"})

        response = @api.add_redirect_route("/foo", "exact", "/bar", "temporary")
        assert_equal 201, response.code
        assert_equal "/bar", response.redirect_to

        assert_requested(req)
        assert_requested(@commit_req)
      end

      it "should not commit the routes when asked not to" do
        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          to_return(:status => 201, :body =>{}.to_json, :headers => {"Content-type" => "application/json"})

        @api.add_redirect_route("/foo", "exact", "/bar", "temporary", :skip_commit => true)

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should raise an error if creating/updating the redirect route fails" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "redirect", "redirect_to" => "bar", "redirect_type" => "permanent"}
        response_data = route_data.merge("errors" => {"redirect_to" => "is not a valid URL path"})

        req = WebMock.stub_request(:put, "#{@base_api_url}/routes").
          with(:body => {"route" => route_data}.to_json).
          to_return(:status => 400, :body => response_data.to_json, :headers => {"Content-type" => "application/json"})

        e = nil
        begin
          @api.add_redirect_route("/foo", "exact", "bar")
        rescue GdsApi::HTTPErrorResponse => ex
          e = ex
        end

        refute_nil e
        assert_equal 400, e.code
        assert_equal response_data, e.error_details

        assert_requested(req)
        assert_not_requested(@commit_req)
      end
    end

    describe "deleting a route" do
      it "should allow deleting a route" do
        route_data = {"incoming_path" => "/foo", "route_type" => "exact", "handler" => "backend", "backend_id" => "foo"}
        req = WebMock.stub_request(:delete, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo", "route_type" => "exact"}).
          to_return(:status => 200, :body => route_data.to_json, :headers => {"Content-type" => "application/json"})

        response = @api.delete_route("/foo", "exact")
        assert_equal 200, response.code
        assert_equal "foo", response.backend_id

        assert_requested(req)
        assert_requested(@commit_req)
      end

      it "should not commit the routes when asked not to" do
        req = WebMock.stub_request(:delete, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo", "route_type" => "exact"}).
          to_return(:status => 200, :body => {}.to_json, :headers => {"Content-type" => "application/json"})

        @api.delete_route("/foo", "exact", :skip_commit => true)

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should raise HTTPNotFound if nothing found" do
        req = WebMock.stub_request(:delete, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo", "route_type" => "exact"}).
          to_return(:status => 404)

        e = nil
        begin
          @api.delete_route("/foo", "exact")
        rescue GdsApi::HTTPNotFound => ex
          e = ex
        end

        refute_nil e
        assert_equal 404, e.code

        assert_requested(req)
        assert_not_requested(@commit_req)
      end

      it "should escape the params" do
        # The WebMock query matcher matches unescaped params.  The call blows up if they're not escaped

        req = WebMock.stub_request(:delete, "#{@base_api_url}/routes").
          with(:query => {"incoming_path" => "/foo bar", "route_type" => "exa ct"}).
          to_return(:status => 404)

        begin
          @api.delete_route("/foo bar", "exa ct")
        rescue GdsApi::HTTPNotFound
        end

        assert_requested(req)
      end
    end

    describe "committing the routes" do
      it "should allow committing the routes" do
        @api.commit_routes

        assert_requested(@commit_req)
      end

      it "should raise an error if committing the routes fails" do
        req = WebMock.stub_request(:post, "#{@base_api_url}/routes/commit").
          to_return(:status => 500, :body => "Failed to update all routers")

        e = nil
        begin
          @api.commit_routes
        rescue GdsApi::HTTPErrorResponse => ex
          e = ex
        end

        refute_nil e
        assert_equal 500, e.code
        assert_equal "Failed to update all routers", e.message
      end
    end
  end
end


text:
Lorem ipsum dolor sit amet, consectetur adipisicing elit

Lorem ipsum dolor sit amet, consectetur adipisicing elit

Lorem ipsum dolor sit amet, consectetur adipisicing elit

Lorem ipsum dolor sit amet, consectetur adipisicing elit


text:
package io.fundrequest.platform.admin.messages.controller;

import io.fundrequest.common.infrastructure.mav.AbstractController;
import io.fundrequest.core.message.MessageService;
import io.fundrequest.core.message.domain.MessageType;
import io.fundrequest.core.message.dto.MessageDto;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Controller
public class MessagesController extends AbstractController {

    private MessageService messageService;

    public MessagesController(final MessageService messageService) {
        this.messageService = messageService;
    }

    @RequestMapping("/messages")
    public ModelAndView showAllMessagesPage(final Model model) {
        model.addAttribute("referralMessages", messageService.getMessagesByType(MessageType.REFERRAL_SHARE));
        return new ModelAndView("messages/index");
    }

    @RequestMapping("/messages/{type}")
    public ModelAndView showMessagesOfTypePage(final Model model, @PathVariable String type) {
        model.addAttribute("type", type.toUpperCase());
        model.addAttribute("messages", messageService.getMessagesByType(MessageType.valueOf(type.toUpperCase())));
        return new ModelAndView("messages/type");
    }

    @RequestMapping("/messages/{type}/add")
    public ModelAndView showAddMessageToTypePage(final Model model, @PathVariable String type) {
        model.addAttribute("message", MessageDto.builder().type(MessageType.valueOf(type)).build());
        return new ModelAndView("messages/add");
    }

    @RequestMapping("/messages/{type}/{name}/edit")
    public ModelAndView showEditPage(final Model model, @PathVariable String type, @PathVariable String name) {
        model.addAttribute("message", messageService.getMessageByTypeAndName(MessageType.valueOf(type.toUpperCase()), name));

        return new ModelAndView("messages/edit");
    }

    @PostMapping("/messages/{type}/add")
    public ModelAndView add(WebRequest request, @PathVariable String type, RedirectAttributes redirectAttributes) {
        MessageDto messageDto = MessageDto.builder()
                .name(request.getParameter("name"))
                .type(MessageType.valueOf(type.toUpperCase()))
                .title(request.getParameter("title"))
                .description(request.getParameter("description"))
                .link(request.getParameter("link"))
                .build();

        messageService.add(messageDto);

        return redirectView(redirectAttributes)
                .withSuccessMessage("Message added")
                .url("/messages/" + type)
                .build();
    }

    @PostMapping("/messages/{type}/{name}/edit")
    public ModelAndView update(WebRequest request, @PathVariable String type, @PathVariable String name, RedirectAttributes redirectAttributes) {
        MessageDto messageDto = MessageDto.builder()
                .name(name)
                .type(MessageType.valueOf(type.toUpperCase()))
                .title(request.getParameter("title"))
                .description(request.getParameter("description"))
                .link(request.getParameter("link"))
                .build();

        messageService.update(messageDto);

        return redirectView(redirectAttributes)
                .withSuccessMessage("Saved")
                .url("/messages/" + type)
                .build();
    }

    @PostMapping("/messages/{type}/{name}/delete")
    public ModelAndView delete(final Model model, @PathVariable String type, @PathVariable String name, RedirectAttributes redirectAttributes) {
        messageService.delete(MessageType.valueOf(type.toUpperCase()), name);

        return redirectView(redirectAttributes)
                .withSuccessMessage("Deleted")
                .url("/messages/" + type)
                .build();
    }

}


text:
#ifndef PHOENIX_PRIMITIVES_HPP
#define PHOENIX_PRIMITIVES_HPP

///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/phoenix/actor.hpp>

///////////////////////////////////////////////////////////////////////////////
namespace phoenix {

///////////////////////////////////////////////////////////////////////////////
//
//  argument class
//
//      Lazy arguments
//
//      An actor base class that extracts and returns the Nth argument
//      from the argument list passed in the 'args' tuple in the eval
//      member function (see actor.hpp). There are some predefined
//      argument constants that can be used as actors (arg1..argN).
//
//      The argument actor is a place-holder for the actual arguments
//      passed by the client. For example, wherever arg1 is seen placed
//      in a lazy function (see functions.hpp) or lazy operator (see
//      operators.hpp), this will be replaced by the actual first
//      argument in the actual function evaluation. Argument actors are
//      essentially lazy arguments. A lazy argument is a full actor in
//      its own right and can be evaluated through the actor's operator().
//
//      Example:
//
//          char        c = 'A';
//          int         i = 123;
//          const char* s = "Hello World";
//
//          cout << arg1(c) << ' ';
//          cout << arg1(i, s) << ' ';
//          cout << arg2(i, s) << ' ';
//
//       will print out "A 123 Hello World"
//
///////////////////////////////////////////////////////////////////////////////
template <int N>
struct argument {

    template <typename TupleT>
    struct result { typedef typename tuple_element<N, TupleT>::type type; };

    template <typename TupleT>
    typename tuple_element<N, TupleT>::type
    eval(TupleT const& args) const
    {
        return args[tuple_index<N>()];
    }
};

//////////////////////////////////
actor<argument<0> > const arg1 = argument<0>();
actor<argument<1> > const arg2 = argument<1>();
actor<argument<2> > const arg3 = argument<2>();

#if PHOENIX_LIMIT > 3
actor<argument<3> > const arg4 = argument<3>();
actor<argument<4> > const arg5 = argument<4>();
actor<argument<5> > const arg6 = argument<5>();

#if PHOENIX_LIMIT > 6
actor<argument<6> > const arg7 = argument<6>();
actor<argument<7> > const arg8 = argument<7>();
actor<argument<8> > const arg9 = argument<8>();

#if PHOENIX_LIMIT > 9
actor<argument<9> > const arg10 = argument<9>();
actor<argument<10> > const arg11 = argument<10>();
actor<argument<11> > const arg12 = argument<11>();

#if PHOENIX_LIMIT > 12
actor<argument<12> > const arg13 = argument<12>();
actor<argument<13> > const arg14 = argument<13>();
actor<argument<14> > const arg15 = argument<14>();

#endif
#endif
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
//
//  value class
//
//      Lazy values
//
//      A bound actual parameter is kept in a value class for deferred
//      access later when needed. A value object is immutable. Value
//      objects are typically created through the val(x) free function
//      which returns a value<T> with T deduced from the type of x. x is
//      held in the value<T> object by value.
//
//      Lazy values are actors. As such, lazy values can be evaluated
//      through the actor's operator(). Such invocation gives the value's
//      identity. Example:
//
//          cout << val(3)() << val("Hello World")();
//
//      prints out "3 Hello World"
//
///////////////////////////////////////////////////////////////////////////////
template <typename T>
struct value {

    typedef typename boost::remove_reference<T>::type plain_t;

    template <typename TupleT>
    struct result { typedef plain_t const type; };

    value(plain_t val_)
    :   val(val_) {}

    template <typename TupleT>
    plain_t const
    eval(TupleT const& /*args*/) const
    {
        return val;
    }

    plain_t val;
};

//////////////////////////////////
template <typename T>
inline actor<value<T> > const
val(T v)
{
    return value<T>(v);
}

//////////////////////////////////
template <typename BaseT>
void
val(actor<BaseT> const& v);     //  This is undefined and not allowed.

///////////////////////////////////////////////////////////////////////////
//
//  Arbitrary types T are typically converted to a actor<value<T> >
//  (see as_actor<T> in actor.hpp). A specialization is also provided
//  for arrays. T[N] arrays are converted to actor<value<T const*> >.
//
///////////////////////////////////////////////////////////////////////////
template <typename T>
struct as_actor {

    typedef actor<value<T> > type;
    static type convert(T const& x)
    { return value<T>(x); }
};

//////////////////////////////////
template <typename T, int N>
struct as_actor<T[N]> {

    typedef actor<value<T const*> > type;
    static type convert(T const x[N])
    { return value<T const*>(x); }
};

///////////////////////////////////////////////////////////////////////////////
//
//  variable class
//
//      Lazy variables
//
//      A bound actual parameter may also be held by non-const reference
//      in a variable class for deferred access later when needed. A
//      variable object is mutable, i.e. its referenced variable can be
//      modified. Variable objects are typically created through the
//      var(x) free function which returns a variable<T> with T deduced
//      from the type of x. x is held in the value<T> object by
//      reference.
//
//      Lazy variables are actors. As such, lazy variables can be
//      evaluated through the actor's operator(). Such invocation gives
//      the variables's identity. Example:
//
//          int i = 3;
//          char const* s = "Hello World";
//          cout << var(i)() << var(s)();
//
//      prints out "3 Hello World"
//
//      Another free function const_(x) may also be used. const_(x) creates
//      a variable<T const&> object using a constant reference.
//
///////////////////////////////////////////////////////////////////////////////
template <typename T>
struct variable {

    template <typename TupleT>
    struct result { typedef T& type; };

    variable(T& var_)
    :   var(var_) {}

    template <typename TupleT>
    T&
    eval(TupleT const& /*args*/) const
    {
        return var;
    }

    T& var;
};

//////////////////////////////////
template <typename T>
inline actor<variable<T> > const
var(T& v)
{
    return variable<T>(v);
}

//////////////////////////////////
template <typename T>
inline actor<variable<T const> > const
const_(T const& v)
{
    return variable<T const>(v);
}

//////////////////////////////////
template <typename BaseT>
void
var(actor<BaseT> const& v);     //  This is undefined and not allowed.

//////////////////////////////////
template <typename BaseT>
void
const_(actor<BaseT> const& v);  //  This is undefined and not allowed.

///////////////////////////////////////////////////////////////////////////////
}   //  namespace phoenix

#endif


text:
#include "java_lang_Math.h"
#include "jni.h"
#include "JNIHelp.h"
#include "JniConstants.h"

#include <math.h>

//static jdouble Math_sin(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_sin(JNIEnv*, jclass, jdouble a) {
    return sin(a);
}

//static jdouble Math_cos(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_cos(JNIEnv*, jclass, jdouble a) {
    return cos(a);
}

//static jdouble Math_tan(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_tan(JNIEnv*, jclass, jdouble a) {
    return tan(a);
}

//static jdouble Math_asin(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_asin(JNIEnv*, jclass, jdouble a) {
    return asin(a);
}

//static jdouble Math_acos(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_acos(JNIEnv*, jclass, jdouble a) {
    return acos(a);
}

//static jdouble Math_atan(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_atan(JNIEnv*, jclass, jdouble a) {
    return atan(a);
}

//static jdouble Math_exp(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_exp(JNIEnv*, jclass, jdouble a) {
    return exp(a);
}

//static jdouble Math_log(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_log(JNIEnv*, jclass, jdouble a) {
    return log(a);
}

//static jdouble Math_sqrt(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_sqrt(JNIEnv*, jclass, jdouble a) {
    return sqrt(a);
}

//static jdouble Math_IEEEremainder(JNIEnv*, jclass, jdouble a, jdouble b) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_IEEEremainder(JNIEnv*, jclass, jdouble a, jdouble b) {
    return remainder(a, b);
}

//static jdouble Math_floor(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_floor(JNIEnv*, jclass, jdouble a) {
    return floor(a);
}

//static jdouble Math_ceil(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_ceil(JNIEnv*, jclass, jdouble a) {
    return ceil(a);
}

//static jdouble Math_rint(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_rint(JNIEnv*, jclass, jdouble a) {
    return rint(a);
}

//static jdouble Math_atan2(JNIEnv*, jclass, jdouble a, jdouble b) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_atan2(JNIEnv*, jclass, jdouble a, jdouble b) {
    return atan2(a, b);
}

//static jdouble Math_pow(JNIEnv*, jclass, jdouble a, jdouble b) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_pow(JNIEnv*, jclass, jdouble a, jdouble b) {
    return pow(a, b);
}

//static jdouble Math_sinh(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_sinh(JNIEnv*, jclass, jdouble a) {
    return sinh(a);
}

//static jdouble Math_tanh(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_tanh(JNIEnv*, jclass, jdouble a) {
    return tanh(a);
}

//static jdouble Math_cosh(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_cosh(JNIEnv*, jclass, jdouble a) {
    return cosh(a);
}

//static jdouble Math_log10(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_log10(JNIEnv*, jclass, jdouble a) {
    return log10(a);
}

//static jdouble Math_cbrt(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_cbrt(JNIEnv*, jclass, jdouble a) {
    return cbrt(a);
}

//static jdouble Math_expm1(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_expm1(JNIEnv*, jclass, jdouble a) {
    return expm1(a);
}

//static jdouble Math_hypot(JNIEnv*, jclass, jdouble a, jdouble b) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_hypot(JNIEnv*, jclass, jdouble a, jdouble b) {
    return hypot(a, b);
}

//static jdouble Math_log1p(JNIEnv*, jclass, jdouble a) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_log1p(JNIEnv*, jclass, jdouble a) {
    return log1p(a);
}

//static jdouble Math_nextafter(JNIEnv*, jclass, jdouble a, jdouble b) {
JNIEXPORT jdouble JNICALL
Java_java_lang_Math_nextafter(JNIEnv*, jclass, jdouble a, jdouble b) {
    return nextafter(a, b);
}

//static jfloat Math_nextafterf(JNIEnv*, jclass, jfloat a, jfloat b) {
JNIEXPORT jfloat JNICALL
Java_java_lang_Math_nextafterf(JNIEnv*, jclass, jfloat a, jfloat b) {
    return nextafterf(a, b);
}

/* by jshwang
static JNINativeMethod gMethods[] = {
    NATIVE_METHOD(Math, IEEEremainder, "(DD)D"),
    NATIVE_METHOD(Math, acos, "(D)D"),
    NATIVE_METHOD(Math, asin, "(D)D"),
    NATIVE_METHOD(Math, atan, "(D)D"),
    NATIVE_METHOD(Math, atan2, "(DD)D"),
    NATIVE_METHOD(Math, cbrt, "(D)D"),
    NATIVE_METHOD(Math, ceil, "(D)D"),
    NATIVE_METHOD(Math, cos, "(D)D"),
    NATIVE_METHOD(Math, cosh, "(D)D"),
    NATIVE_METHOD(Math, exp, "(D)D"),
    NATIVE_METHOD(Math, expm1, "(D)D"),
    NATIVE_METHOD(Math, floor, "(D)D"),
    NATIVE_METHOD(Math, hypot, "(DD)D"),
    NATIVE_METHOD(Math, log, "(D)D"),
    NATIVE_METHOD(Math, log10, "(D)D"),
    NATIVE_METHOD(Math, log1p, "(D)D"),
    NATIVE_METHOD(Math, nextafter, "(DD)D"),
    NATIVE_METHOD(Math, nextafterf, "(FF)F"),
    NATIVE_METHOD(Math, pow, "(DD)D"),
    NATIVE_METHOD(Math, rint, "(D)D"),
    NATIVE_METHOD(Math, sin, "(D)D"),
    NATIVE_METHOD(Math, sinh, "(D)D"),
    NATIVE_METHOD(Math, sqrt, "(D)D"),
    NATIVE_METHOD(Math, tan, "(D)D"),
    NATIVE_METHOD(Math, tanh, "(D)D"),
};

int register_java_lang_Math(JNIEnv* env) {
    return jniRegisterNativeMethods(env, "java/lang/Math", gMethods, NELEM(gMethods));
}
*/
int register_java_lang_Math(JNIEnv*) {
    return JNI_OK;
}


text:
package tk.exgerm.visualiser.windows;

import java.awt.Container;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

import tk.exgerm.core.service.ICoreContext;

@SuppressWarnings("serial")
public class NewGraphWindow extends JDialog {

	protected boolean dialogResult = false;

	protected Container container = getContentPane();
	protected JButton btnOK = new JButton("OK");
	protected JButton btnCancel = new JButton("Cancel");
	protected Box okBox = Box.createHorizontalBox();
	protected JTextField tfName = new JTextField(20);

	protected ICoreContext context;

	public NewGraphWindow(ICoreContext _context) {
		this.context = _context;

		setModal(true);
		setTitle("New graph");
		setLayout(new GridBagLayout());
		setResizable(false);
		try {
			setIconImage(ImageIO.read(getClass().getResource("images/icon16.png")));
		} catch (IOException e1) {}

		Point center = GraphicsEnvironment.getLocalGraphicsEnvironment()
				.getCenterPoint();

		GridBagConstraints c = new GridBagConstraints();

		c.gridx = 0;
		c.gridy = 0;
		c.gridwidth = 1;
		c.weightx = 0;
		c.anchor = GridBagConstraints.WEST;
		c.insets = new Insets(10, 20, 0, 10);

		container.add(new JLabel("Graph name:"), c);

		c.gridx = 1;
		c.gridy = 0;
		c.gridwidth = 1;
		c.weightx = 0;
		c.anchor = GridBagConstraints.WEST;
		c.insets = new Insets(10, 20, 0, 10);

		container.add(tfName, c);

		c.gridx = 0;
		c.gridy = 1;
		c.gridwidth = 2;
		c.weightx = 0;
		c.anchor = GridBagConstraints.CENTER;
		c.insets = new Insets(15, 20, 20, 10);

		okBox.add(btnOK);
		okBox.add(Box.createHorizontalStrut(10));
		okBox.add(btnCancel);
		container.add(okBox,c);

		ActionListener ok = new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				enterPressed();
			}
		};

		ActionListener cancel = new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				escapePressed();
			}
		};

		btnOK.addActionListener(ok);

		btnCancel.addActionListener(cancel);

		btnOK.registerKeyboardAction(ok, "EnterKey",
				KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0 , false),
				JComponent.WHEN_IN_FOCUSED_WINDOW);

		btnCancel.registerKeyboardAction(cancel, "EscapeKey",
				KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0 , false),
				JComponent.WHEN_IN_FOCUSED_WINDOW);

		pack();
		setLocation(center.x - getSize().width / 2, center.y - getSize().height
				/ 2);
	}

	public String getTfName() {
		return tfName.getText();
	}

	public boolean isDialogResult() {
		return dialogResult;
	}

	public void setDialogResult(boolean dialogResult) {
		this.dialogResult = dialogResult;
	}

	public void enterPressed() {

		if(getTfName().length() == 0){
			JOptionPane.showMessageDialog(this,
					"You have not entered the name of the graph.\nThe graph must have a name.",
					"Name missing", JOptionPane.WARNING_MESSAGE);
			return;
		}

		if(context.getGraph(getTfName().toString()) != null){
			JOptionPane.showMessageDialog(this,
					"A graph with this name already exists.\nPlease choose another name.",
					"Name exists", JOptionPane.WARNING_MESSAGE);
			return;
		}

		setDialogResult(true);
		setVisible(false);
	}

	public void escapePressed() {
		setDialogResult(false);
		setVisible(false);
	}

}


text:
package org.zstack.compute.vm;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.cloudbus.CloudBusCallBack;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.core.errorcode.ErrorFacade;
import org.zstack.header.allocator.*;
import org.zstack.header.core.workflow.Flow;
import org.zstack.header.core.workflow.FlowRollback;
import org.zstack.header.core.workflow.FlowTrigger;
import org.zstack.header.host.HostInventory;
import org.zstack.header.message.MessageReply;
import org.zstack.header.network.l3.L3NetworkInventory;
import org.zstack.header.vm.VmInstanceConstant;
import org.zstack.header.vm.VmInstanceSpec;
import org.zstack.header.vm.VmNicHelper;
import org.zstack.header.vm.VmNicSpec;
import org.zstack.header.volume.VolumeInventory;
import org.zstack.utils.CollectionUtils;
import org.zstack.utils.function.Function;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class VmAllocateHostForAbnormallyStartedVmFlow implements Flow {
    @Autowired
    protected DatabaseFacade dbf;
    @Autowired
    protected CloudBus bus;
    @Autowired
    protected ErrorFacade errf;

    @Override
    public void run(final FlowTrigger chain, Map data) {
        final VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());

        DesignatedAllocateHostMsg msg = new DesignatedAllocateHostMsg();
        msg.setVmInstance(spec.getVmInventory());
        msg.setCpuCapacity(spec.getVmInventory().getCpuNum());
        msg.setMemoryCapacity(spec.getVmInventory().getMemorySize());
        msg.setHostUuid(spec.getDestHost().getUuid());
        if (spec.getImageSpec() != null) {
            msg.setImage(spec.getImageSpec().getInventory());
        }
        msg.setRequiredPrimaryStorageUuids(spec.getVmInventory().getAllVolumes().stream()
                .map(VolumeInventory::getPrimaryStorageUuid)
                .collect(Collectors.toSet()));
        msg.setVmOperation(spec.getCurrentVmOperation().toString());
        msg.setAllocatorStrategy(HostAllocatorConstant.DESIGNATED_HOST_ALLOCATOR_STRATEGY_TYPE);
        msg.setL3NetworkUuids(CollectionUtils.transformToList(VmNicSpec.getL3NetworkInventoryOfSpec(spec.getL3Networks()), new Function<String, L3NetworkInventory>() {
            @Override
            public String call(L3NetworkInventory arg) {
                return arg.getUuid();
            }
        }));
        msg.setServiceId(bus.makeLocalServiceId(HostAllocatorConstant.SERVICE_ID));
        bus.send(msg, new CloudBusCallBack(chain) {
            @Override
            public void run(MessageReply reply) {
                if (reply.isSuccess()) {
                    AllocateHostReply areply = (AllocateHostReply) reply;
                    spec.setDestHost(areply.getHost());
                    chain.next();
                } else {
                    chain.fail(reply.getError());
                }
            }
        });
    }

    @Override
    public void rollback(FlowRollback chain, Map data) {
        final VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
        HostInventory host = spec.getDestHost();
        if (host != null) {
            ReturnHostCapacityMsg msg = new ReturnHostCapacityMsg();
            msg.setCpuCapacity(spec.getVmInventory().getCpuNum());
            msg.setMemoryCapacity(spec.getVmInventory().getMemorySize());
            msg.setHostUuid(host.getUuid());
            msg.setServiceId(bus.makeLocalServiceId(HostAllocatorConstant.SERVICE_ID));
            bus.send(msg);
        }
        chain.rollback();
    }
}


text:
package com.sun.codemodel;

import java.lang.annotation.Annotation;

/**
 * Base interface for typed annotation writer.
 *
 *

 * Annotation compiler can generate a strongly typed annotation
 * writer to assist applications to write uses of annotations.
 * Such typed annotation writer interfaces all derive from
 * this common interface.
 *
 *

 * The type parameter 'A' represents the
 * @author Kohsuke Kawaguchi
 */
public interface JAnnotationWriter {
    /**
     * Gets the underlying annotation use object to which we are writing.
     */
    JAnnotationUse getAnnotationUse();

    /**
     * The type of the annotation that this writer is writing.
     */
    Class getAnnotationType();
}


text:
var log2 = require('log2');

module.exports = log2();


text:
<?php

namespace Alegra\Support;

class Currency extends \Illuminate\Api\Resource\Model
{
    protected static $visible = ['*'];

    protected $fillable = [
        'code'   => 'string',
        'symbol' => 'string'
    ];
}


text:
package org.apache.kylin.metadata.realization;

public enum RealizationStatusEnum {

    DISABLED, BUILDING, READY, DESCBROKEN

}


text:
package org.kantega.respiro.ui.registry;

import org.kantega.respiro.api.EndpointConfig;
import org.kantega.reststop.api.PluginExport;

/**
 *
 */
public class SoapEndpoint {
    private final String path;
    private final String serviceName;

    public SoapEndpoint(PluginExport<EndpointConfig> export) {
        this.path = export.getExport().getPath();
        this.serviceName= export.getExport().getWsdlService().getLocalPart();
    }

    public String getPath() {
        return path;
    }

    public String getServiceName() {
        return serviceName;
    }
}