code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 3 1.01M |
|---|---|---|---|---|---|
#require File.dirname(__FILE__) + '/formats/email'
module DataMapper
module Validate
##
#
# @author Guy van den Berg
# @since 0.9
class CustomValidator < GenericValidator
def initialize(field_name, options = {}, &b)
#super(field_name, options)
#@field_name, @options = field_name, options
#@options[:allow_nil] = false unless @options.has_key?(:allow_nil)
end
def call(target)
#field_value = target.instance_variable_get("@#{@field_name}")
#return true if @options[:allow_nil] && field_value.nil?
#validation = (@options[:as] || @options[:with])
#error_message = nil
# Figure out what to use as the actual validator.
# If a symbol is passed to :as, look up
# the canned validation in FORMATS.
#
#validator = if validation.is_a? Symbol
# if FORMATS[validation].is_a? Array
# error_message = FORMATS[validation][1]
# FORMATS[validation][0]
# else
# FORMATS[validation] || validation
# end
#else
# validation
#end
#valid = case validator
#when Proc then validator.call(field_value)
#when Regexp then validator =~ field_value
#else raise UnknownValidationFormat, "Can't determine how to validate #{target.class}##{@field_name} with #{validator.inspect}"
#end
#unless valid
# field = Inflector.humanize(@field_name)
# value = field_value
#
# error_message = @options[:message] || error_message || '%s is invalid'.t(field)
# error_message = error_message.call(field, value) if Proc === error_message
#
# add_error(target, error_message , @field_name)
#end
#return valid
end
#class UnknownValidationFormat < StandardError; end
end # class CustomValidator
module ValidatesFormatOf
#def validates_format_of(*fields)
#opts = opts_from_validator_args(fields)
#add_validator_to_context(opts, fields, DataMapper::Validate::FormatValidator)
#end
end # module ValidatesFormatOf
end # module Validate
end # module DataMapper
| kad3nce/collective | gems/gems/dm-validations-0.9.5/lib/dm-validations/custom_validator.rb | Ruby | mit | 2,225 |
lib: node_modules $(shell find src)
rm -rf lib
node_modules/.bin/coffee --output lib --compile src
test: node_modules
node_modules/.bin/mocha test/suite
coverage: node_modules
node_modules/.bin/mocha --require test/coverage test/suite
node_modules/.bin/istanbul report
lint: node_modules
node_modules/.bin/coffeelint --file coffeelint.json src
node_modules/.bin/coffeelint --file test/coffeelint.json test/suite
ci: coverage
.PHONY: test coverage lint ci
node_modules:
npm install
| eloquent/couchdb-builder | Makefile | Makefile | mit | 495 |
## Django 示例
| wwq0327/django-web-app-book | examples/README.md | Markdown | mit | 18 |
#!/usr/bin/ruby
require "fileutils"
require 'json'
require_relative "BibleReader.rb"
reader = BibleReader.new
translation_names = ['개역개정', '새번역', 'NIV']#BibleInfo.translation_name_to_code.keys
translation_names.each do |translation_name|
translation_code = BibleInfo.translation_name_to_code[translation_name]
BibleInfo.bible_name_to_chapter_len.each do |bible_name, chapter_len|
# puts "#{translation_name}, #{bible_name}, #{chapter_len}"
bible_shortname = BibleInfo.bible_name_to_shortname[bible_name]
db_name = "db/#{translation_name}/#{"%02d_" % BibleInfo.bible_name_to_code[bible_name]}#{bible_name}"
unless Dir.exist? db_name
FileUtils.mkdir_p(db_name)
end
(1..chapter_len).each do |chapter|
file = File.open "#{db_name}/#{chapter}", 'w'
chapter_content = reader.get_chapter_from_web(translation_name, bible_shortname, chapter)
file.write(chapter_content.to_json)
file.close()
end
end
end
| nofearbutlove/bible-clipper | BibleCroller.rb | Ruby | mit | 976 |
<?php
/**
* TOP API: taobao.hotel.order.face.deal request
*
* @author auto create
* @since 1.0, 2013-09-13 16:51:03
*/
class Taobao_Request_HotelOrderFaceDealRequest {
/**
* 酒店订单oid
**/
private $oid;
/**
* 操作类型,1:确认预订,2:取消订单
**/
private $operType;
/**
* 取消订单时的取消原因备注信息
**/
private $reasonText;
/**
* 取消订单时的取消原因,可选值:1,2,3,4;
* 1:无房,2:价格变动,3:买家原因,4:其它原因
**/
private $reasonType;
private $apiParas = array();
public function setOid($oid) {
$this->oid = $oid;
$this->apiParas["oid"] = $oid;
}
public function getOid() {
return $this->oid;
}
public function setOperType($operType) {
$this->operType = $operType;
$this->apiParas["oper_type"] = $operType;
}
public function getOperType() {
return $this->operType;
}
public function setReasonText($reasonText) {
$this->reasonText = $reasonText;
$this->apiParas["reason_text"] = $reasonText;
}
public function getReasonText() {
return $this->reasonText;
}
public function setReasonType($reasonType) {
$this->reasonType = $reasonType;
$this->apiParas["reason_type"] = $reasonType;
}
public function getReasonType() {
return $this->reasonType;
}
public function getApiMethodName() {
return "taobao.hotel.order.face.deal";
}
public function getApiParas() {
return $this->apiParas;
}
public function check() {
Taobao_RequestCheckUtil::checkNotNull($this->oid, "oid");
Taobao_RequestCheckUtil::checkNotNull($this->operType, "operType");
Taobao_RequestCheckUtil::checkMaxLength($this->operType, 1, "operType");
Taobao_RequestCheckUtil::checkMaxLength($this->reasonText, 500, "reasonText");
Taobao_RequestCheckUtil::checkMaxLength($this->reasonType, 1, "reasonType");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}
| musicsnap/LearnCode | php/code/yaf/application/library/Taobao/Request/HotelOrderFaceDealRequest.php | PHP | mit | 1,971 |
import { Observable } from './observable'
export default function drop(count, source) {
return Observable(add => {
let dropped = 0
return source.subscribe((val, name) => {
if (dropped++ >= count) add(val, name)
})
})
}
| AlexGalays/dompteuse | src/observable/drop.js | JavaScript | mit | 244 |
package schoolprojects;
import java.util.Random;
import java.util.Scanner;
/**
* Piedra, papel o tijera es un juego infantil.
* Un juego de manos en el cual existen tres elementos.
* La piedra que vence a la tijera rompiéndola; la tijera que vencen al papel cortándolo;
* y el papel que vence a la piedra envolviéndola. Esto representa un ciclo, el cual
* le da su esencia al juego. Este juego es muy utilizado para decidir quien de dos
* personas hará algo, tal y como a veces se hace usando una moneda, o para dirimir algún asunto.
*
* En esta version del juego habra un Jugador Humano y un jugador artificial ( es decir el ordenador )
*
* @author Velik Georgiev Chelebiev
* @version 0.0.1
*/
public class Juego {
/**
* @param args Argumentos de la linea de comandos
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Random rand = new Random();
/**
* Movimientos disponibles en forma de cadena.
*/
String[] movimientos = {"Piedra", "Papel", "Tijera"};
/**
* Moviemiento elegido por el usuario en forma de numero entero.
*/
int entradaUsuario = 0;
/**
* Un numero aleatorio que representara el movimiento del ordenador.
*/
int movimientoAleatorio = 0;
/**
* Los resultados posibles de la partida. 0 EMPATE 1 El jugador gana 2
* El jugador pierde
*/
String[] resultados = {"Empate", "Ganas", "Pierdes"};
/**
* El resultado de la partida respecto el jugador.
*/
int resultadoJugador = -1;
/**
* Aqui es donde epieza el juego.
*
* Pedimos al usuario que elija uno de los movimientos disponibles
* y generamos un movimiento aleatorio, que sera el movimiento del ordenador.
* Despues comptrobamos si el jugador gana al ordenador , si pierde o si hay un empate.
* Mostramos el resultado en la pantalla y el bucle se repite hasta que
* el jugador no introduce -1 como movimiento.
*/
do {
// Mostramos informacion sobre los movimientos validos y
// los numeros que le corresponden.
for (int i = 0; i < movimientos.length; i++) {
System.out.print("(" + (i + 1) + ") " + movimientos[i] + "\n");
}
// Valor predeterminado ( o entrada no valida, por si el usuario no introduce ningun valor )
entradaUsuario = 0;
// Leemos la entrada ( el moviemiento ) del usuario
try {
System.out.print("Movimiento: ");
entradaUsuario = Integer.parseInt(scan.nextLine());
} catch (NumberFormatException ex) {
// Si la entrada no tiene un formato valido, mostraremos un mensaje de error
// y le pediremos al usuario que introduzca un movimiento nuevamente.
entradaUsuario = 0;
}
// Si la opcion elegida por el usuario no es valida imprimimos un
// mensaje de error y le volvemos a pedir que introduzca una opcion
if (entradaUsuario < 1 || entradaUsuario > 3) {
System.out.println("\n*** El movimiento elegido no es valido. ***");
continue;
}
// Restamos 1 a la entrada del usuario.
// Esto lo hacemos para que sea un indice de vector valido.
entradaUsuario -= 1;
// Generamos un movimiento aleatorio
movimientoAleatorio = rand.nextInt(movimientos.length);
// Para separar el "menu" de moviemientos y la entrada del usuario
// con la salida/resultado de la partida marco
System.out.println("\n*******************************\n");
// Imprimimos las jugadas del jugador y del ordenador
System.out.println("Tu: (" + movimientos[entradaUsuario] + ") [VS] PC: (" + movimientos[movimientoAleatorio] + ")");
// Comprobamos si el jugador gana
if ((entradaUsuario == 0 && movimientoAleatorio == 2) ||
(entradaUsuario == 1 && movimientoAleatorio == 0) ||
(entradaUsuario == 2 && movimientoAleatorio == 1)) {
resultadoJugador = 1;
} else if(entradaUsuario == movimientoAleatorio) { // Comprobamos si es un empate
resultadoJugador = 0;
} else { // en el resto de los casos el jugador pierde
resultadoJugador = 2;
}
// Imprimimos el resultado de la partida
System.out.println("Resultado: " + resultados[resultadoJugador]);
// Para separar el "menu" de moviemientos y la entrada del usuario
// con la salida/resultado de la partida marco
System.out.println("\n*******************************\n");
} while (entradaUsuario != -1);
}
}
| velikGeorgiev/School | PRG/PiedraPapelTijera/Juego.java | Java | mit | 5,080 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (version 1.7.0_01) on Thu Mar 07 20:40:25 CET 2013 -->
<title>Uses of Class com.tyrlib2.graphics.renderables.BoundingBox</title>
<meta name="date" content="2013-03-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.tyrlib2.graphics.renderables.BoundingBox";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../com/tyrlib2/graphics/renderables/BoundingBox.html" title="class in com.tyrlib2.graphics.renderables">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/tyrlib2/graphics/renderables/\class-useBoundingBox.html" target="_top">Frames</a></li>
<li><a href="BoundingBox.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.tyrlib2.graphics.renderables.BoundingBox" class="title">Uses of Class<br>com.tyrlib2.graphics.renderables.BoundingBox</h2>
</div>
<div class="classUseContainer">No usage of com.tyrlib2.graphics.renderables.BoundingBox</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../com/tyrlib2/graphics/renderables/BoundingBox.html" title="class in com.tyrlib2.graphics.renderables">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/tyrlib2/graphics/renderables/\class-useBoundingBox.html" target="_top">Frames</a></li>
<li><a href="BoundingBox.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| TyrfingX/TyrLib | legacy/TyrLib2/doc/com/tyrlib2/graphics/renderables/class-use/BoundingBox.html | HTML | mit | 4,344 |
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindZLIB
# --------
#
# Find the native ZLIB includes and library.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
# ZLIB has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#
# ::
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
# ZLIB_VERSION_MAJOR - The major version of zlib
# ZLIB_VERSION_MINOR - The minor version of zlib
# ZLIB_VERSION_PATCH - The patch version of zlib
# ZLIB_VERSION_TWEAK - The tweak version of zlib
#
# Backward Compatibility
# ^^^^^^^^^^^^^^^^^^^^^^
#
# The following variable are provided for backward compatibility
#
# ::
#
# ZLIB_MAJOR_VERSION - The major version of zlib
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
#
# Hints
# ^^^^^
#
# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
# module where to look.
set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set.
if(ZLIB_ROOT)
set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
endif()
# Normal search.
set(_ZLIB_SEARCH_NORMAL
PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
"$ENV{PROGRAMFILES}/zlib"
)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
set(ZLIB_NAMES z zlib zdll zlib1)
set(ZLIB_NAMES_DEBUG zlibd zlibd1)
# Try each search configuration.
foreach(search ${_ZLIB_SEARCHES})
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
endforeach()
# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
if(NOT ZLIB_LIBRARY)
foreach(search ${_ZLIB_SEARCHES})
find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib)
endforeach()
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(ZLIB)
endif()
unset(ZLIB_NAMES)
unset(ZLIB_NAMES_DEBUG)
mark_as_advanced(ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}")
# only append a TWEAK version if it exists:
set(ZLIB_VERSION_TWEAK "")
if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)")
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
string(APPEND ZLIB_VERSION_STRING ".${ZLIB_VERSION_TWEAK}")
endif()
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
VERSION_VAR ZLIB_VERSION_STRING)
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
if(NOT ZLIB_LIBRARIES)
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
endif()
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
if(ZLIB_LIBRARY_RELEASE)
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ZLIB::ZLIB PROPERTIES
IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}")
endif()
if(ZLIB_LIBRARY_DEBUG)
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(ZLIB::ZLIB PROPERTIES
IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}")
endif()
if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
IMPORTED_LOCATION "${ZLIB_LIBRARY}")
endif()
endif()
endif()
| pipou/rae | builder/cmake/windows/share/cmake-3.8/Modules/FindZLIB.cmake | CMake | mit | 4,880 |
"""Support for monitoring emoncms feeds."""
from __future__ import annotations
from datetime import timedelta
from http import HTTPStatus
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.const import (
CONF_API_KEY,
CONF_ID,
CONF_SCAN_INTERVAL,
CONF_UNIT_OF_MEASUREMENT,
CONF_URL,
CONF_VALUE_TEMPLATE,
POWER_WATT,
STATE_UNKNOWN,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import template
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
ATTR_FEEDID = "FeedId"
ATTR_FEEDNAME = "FeedName"
ATTR_LASTUPDATETIME = "LastUpdated"
ATTR_LASTUPDATETIMESTR = "LastUpdatedStr"
ATTR_SIZE = "Size"
ATTR_TAG = "Tag"
ATTR_USERID = "UserId"
CONF_EXCLUDE_FEEDID = "exclude_feed_id"
CONF_ONLY_INCLUDE_FEEDID = "include_only_feed_id"
CONF_SENSOR_NAMES = "sensor_names"
DECIMALS = 2
DEFAULT_UNIT = POWER_WATT
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
ONLY_INCL_EXCL_NONE = "only_include_exclude_or_none"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_API_KEY): cv.string,
vol.Required(CONF_URL): cv.string,
vol.Required(CONF_ID): cv.positive_int,
vol.Exclusive(CONF_ONLY_INCLUDE_FEEDID, ONLY_INCL_EXCL_NONE): vol.All(
cv.ensure_list, [cv.positive_int]
),
vol.Exclusive(CONF_EXCLUDE_FEEDID, ONLY_INCL_EXCL_NONE): vol.All(
cv.ensure_list, [cv.positive_int]
),
vol.Optional(CONF_SENSOR_NAMES): vol.All(
{cv.positive_int: vol.All(cv.string, vol.Length(min=1))}
),
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
vol.Optional(CONF_UNIT_OF_MEASUREMENT, default=DEFAULT_UNIT): cv.string,
}
)
def get_id(sensorid, feedtag, feedname, feedid, feeduserid):
"""Return unique identifier for feed / sensor."""
return f"emoncms{sensorid}_{feedtag}_{feedname}_{feedid}_{feeduserid}"
def setup_platform(
hass: HomeAssistant,
config: ConfigType,
add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Emoncms sensor."""
apikey = config.get(CONF_API_KEY)
url = config.get(CONF_URL)
sensorid = config.get(CONF_ID)
value_template = config.get(CONF_VALUE_TEMPLATE)
config_unit = config.get(CONF_UNIT_OF_MEASUREMENT)
exclude_feeds = config.get(CONF_EXCLUDE_FEEDID)
include_only_feeds = config.get(CONF_ONLY_INCLUDE_FEEDID)
sensor_names = config.get(CONF_SENSOR_NAMES)
interval = config.get(CONF_SCAN_INTERVAL)
if value_template is not None:
value_template.hass = hass
data = EmonCmsData(hass, url, apikey, interval)
data.update()
if data.data is None:
return
sensors = []
for elem in data.data:
if exclude_feeds is not None and int(elem["id"]) in exclude_feeds:
continue
if include_only_feeds is not None and int(elem["id"]) not in include_only_feeds:
continue
name = None
if sensor_names is not None:
name = sensor_names.get(int(elem["id"]), None)
if unit := elem.get("unit"):
unit_of_measurement = unit
else:
unit_of_measurement = config_unit
sensors.append(
EmonCmsSensor(
hass,
data,
name,
value_template,
unit_of_measurement,
str(sensorid),
elem,
)
)
add_entities(sensors)
class EmonCmsSensor(SensorEntity):
"""Implementation of an Emoncms sensor."""
def __init__(
self, hass, data, name, value_template, unit_of_measurement, sensorid, elem
):
"""Initialize the sensor."""
if name is None:
# Suppress ID in sensor name if it's 1, since most people won't
# have more than one EmonCMS source and it's redundant to show the
# ID if there's only one.
id_for_name = "" if str(sensorid) == "1" else sensorid
# Use the feed name assigned in EmonCMS or fall back to the feed ID
feed_name = elem.get("name") or f"Feed {elem['id']}"
self._name = f"EmonCMS{id_for_name} {feed_name}"
else:
self._name = name
self._identifier = get_id(
sensorid, elem["tag"], elem["name"], elem["id"], elem["userid"]
)
self._hass = hass
self._data = data
self._value_template = value_template
self._unit_of_measurement = unit_of_measurement
self._sensorid = sensorid
self._elem = elem
if unit_of_measurement == "kWh":
self._attr_device_class = SensorDeviceClass.ENERGY
self._attr_state_class = SensorStateClass.TOTAL_INCREASING
elif unit_of_measurement == "W":
self._attr_device_class = SensorDeviceClass.POWER
self._attr_state_class = SensorStateClass.MEASUREMENT
if self._value_template is not None:
self._state = self._value_template.render_with_possible_json_value(
elem["value"], STATE_UNKNOWN
)
else:
self._state = round(float(elem["value"]), DECIMALS)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement
@property
def native_value(self):
"""Return the state of the device."""
return self._state
@property
def extra_state_attributes(self):
"""Return the attributes of the sensor."""
return {
ATTR_FEEDID: self._elem["id"],
ATTR_TAG: self._elem["tag"],
ATTR_FEEDNAME: self._elem["name"],
ATTR_SIZE: self._elem["size"],
ATTR_USERID: self._elem["userid"],
ATTR_LASTUPDATETIME: self._elem["time"],
ATTR_LASTUPDATETIMESTR: template.timestamp_local(float(self._elem["time"])),
}
def update(self):
"""Get the latest data and updates the state."""
self._data.update()
if self._data.data is None:
return
elem = next(
(
elem
for elem in self._data.data
if get_id(
self._sensorid,
elem["tag"],
elem["name"],
elem["id"],
elem["userid"],
)
== self._identifier
),
None,
)
if elem is None:
return
self._elem = elem
if self._value_template is not None:
self._state = self._value_template.render_with_possible_json_value(
elem["value"], STATE_UNKNOWN
)
else:
self._state = round(float(elem["value"]), DECIMALS)
class EmonCmsData:
"""The class for handling the data retrieval."""
def __init__(self, hass, url, apikey, interval):
"""Initialize the data object."""
self._apikey = apikey
self._url = f"{url}/feed/list.json"
self._interval = interval
self._hass = hass
self.data = None
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest data from Emoncms."""
try:
parameters = {"apikey": self._apikey}
req = requests.get(
self._url, params=parameters, allow_redirects=True, timeout=5
)
except requests.exceptions.RequestException as exception:
_LOGGER.error(exception)
return
else:
if req.status_code == HTTPStatus.OK:
self.data = req.json()
else:
_LOGGER.error(
"Please verify if the specified configuration value "
"'%s' is correct! (HTTP Status_code = %d)",
CONF_URL,
req.status_code,
)
| rohitranjan1991/home-assistant | homeassistant/components/emoncms/sensor.py | Python | mit | 8,487 |
#include "MotionStreakTest.h"
#include "../testResource.h"
enum {
kTagLabel = 1,
kTagSprite1 = 2,
kTagSprite2 = 3,
};
Layer* nextMotionAction();
Layer* backMotionAction();
Layer* restartMotionAction();
static int sceneIdx = -1;
static std::function<Layer*()> createFunctions[] =
{
CL(MotionStreakTest1),
CL(MotionStreakTest2),
CL(Issue1358),
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
Layer* nextMotionAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
auto layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
Layer* backMotionAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
auto layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
Layer* restartMotionAction()
{
auto layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
//------------------------------------------------------------------
//
// MotionStreakTest1
//
//------------------------------------------------------------------
void MotionStreakTest1::onEnter()
{
MotionStreakTest::onEnter();
auto s = Director::getInstance()->getWinSize();
// the root object just rotates around
_root = Sprite::create(s_pathR1);
addChild(_root, 1);
_root->setPosition(Point(s.width/2, s.height/2));
// the target object is offset from root, and the streak is moved to follow it
_target = Sprite::create(s_pathR1);
_root->addChild(_target);
_target->setPosition(Point(s.width/4, 0));
// create the streak object and add it to the scene
streak = MotionStreak::create(2, 3, 32, Color3B::GREEN, s_streak);
addChild(streak);
// schedule an update on each frame so we can syncronize the streak with the target
schedule(schedule_selector(MotionStreakTest1::onUpdate));
auto a1 = RotateBy::create(2, 360);
auto action1 = RepeatForever::create(a1);
auto motion = MoveBy::create(2, Point(100,0) );
_root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), NULL) ) );
_root->runAction( action1 );
auto colorAction = RepeatForever::create(Sequence::create(
TintTo::create(0.2f, 255, 0, 0),
TintTo::create(0.2f, 0, 255, 0),
TintTo::create(0.2f, 0, 0, 255),
TintTo::create(0.2f, 0, 255, 255),
TintTo::create(0.2f, 255, 255, 0),
TintTo::create(0.2f, 255, 0, 255),
TintTo::create(0.2f, 255, 255, 255),
NULL));
streak->runAction(colorAction);
}
void MotionStreakTest1::onUpdate(float delta)
{
streak->setPosition( _target->convertToWorldSpace(Point::ZERO) );
}
std::string MotionStreakTest1::title()
{
return "MotionStreak test 1";
}
//------------------------------------------------------------------
//
// MotionStreakTest2
//
//------------------------------------------------------------------
void MotionStreakTest2::onEnter()
{
MotionStreakTest::onEnter();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesMoved = CC_CALLBACK_2(MotionStreakTest2::onTouchesMoved, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
auto s = Director::getInstance()->getWinSize();
// create the streak object and add it to the scene
streak = MotionStreak::create(3, 3, 64, Color3B::WHITE, s_streak );
addChild(streak);
streak->setPosition( Point(s.width/2, s.height/2) );
}
void MotionStreakTest2::onTouchesMoved(const std::vector<Touch*>& touches, Event* event)
{
auto touchLocation = touches[0]->getLocation();
streak->setPosition( touchLocation );
}
std::string MotionStreakTest2::title()
{
return "MotionStreak test";
}
//------------------------------------------------------------------
//
// Issue1358
//
//------------------------------------------------------------------
void Issue1358::onEnter()
{
MotionStreakTest::onEnter();
// ask director the the window size
auto size = Director::getInstance()->getWinSize();
streak = MotionStreak::create(2.0f, 1.0f, 50.0f, Color3B(255, 255, 0), "Images/Icon.png");
addChild(streak);
_center = Point(size.width/2, size.height/2);
_radius = size.width/3;
_angle = 0.0f;
schedule(schedule_selector(Issue1358::update), 0);
}
void Issue1358::update(float dt)
{
_angle += 1.0f;
streak->setPosition(Point(_center.x + cosf(_angle/180 * M_PI)*_radius,
_center.y + sinf(_angle/ 180 * M_PI)*_radius));
}
std::string Issue1358::title()
{
return "Issue 1358";
}
std::string Issue1358::subtitle()
{
return "The tail should use the texture";
}
//------------------------------------------------------------------
//
// MotionStreakTest
//
//------------------------------------------------------------------
MotionStreakTest::MotionStreakTest(void)
{
}
MotionStreakTest::~MotionStreakTest(void)
{
}
std::string MotionStreakTest::title()
{
return "No title";
}
std::string MotionStreakTest::subtitle()
{
return "";
}
void MotionStreakTest::onEnter()
{
BaseTest::onEnter();
auto s = Director::getInstance()->getWinSize();
auto itemMode = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MotionStreakTest::modeCallback, this),
MenuItemFont::create("Use High Quality Mode"),
MenuItemFont::create("Use Fast Mode"),
NULL);
auto menuMode = Menu::create(itemMode, NULL);
addChild(menuMode);
menuMode->setPosition(Point(s.width/2, s.height/4));
}
void MotionStreakTest::modeCallback(Object *pSender)
{
bool fastMode = streak->isFastMode();
streak->setFastMode(! fastMode);
}
void MotionStreakTest::restartCallback(Object* sender)
{
auto s = new MotionStreakTestScene();//CCScene::create();
s->addChild(restartMotionAction());
Director::getInstance()->replaceScene(s);
s->release();
}
void MotionStreakTest::nextCallback(Object* sender)
{
auto s = new MotionStreakTestScene();//CCScene::create();
s->addChild( nextMotionAction() );
Director::getInstance()->replaceScene(s);
s->release();
}
void MotionStreakTest::backCallback(Object* sender)
{
auto s = new MotionStreakTestScene;//CCScene::create();
s->addChild( backMotionAction() );
Director::getInstance()->replaceScene(s);
s->release();
}
void MotionStreakTestScene::runThisTest()
{
auto layer = nextMotionAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}
| arca1n/cocos2d-x_nextpeer_integration | samples/Cpp/TestCpp/Classes/MotionStreakTest/MotionStreakTest.cpp | C++ | mit | 6,605 |
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineMongoODMModuleTest\Service;
use DoctrineMongoODMModule\Service\ConfigurationFactory;
use DoctrineMongoODMModuleTest\AbstractTest;
class ConfigurationFactoryTest extends AbstractTest
{
public function testRetryConnectValueIsSetFromConfigurationOptions()
{
$config = $this->getDocumentManager()->getConfiguration();
$this->assertSame(123, $config->getRetryConnect());
}
public function testRetryQueryValueIsSetFromConfigurationOptions()
{
$config = $this->getDocumentManager()->getConfiguration();
$this->assertSame(456, $config->getRetryQuery());
}
public function testCreation()
{
$logger = $this->getMockForAbstractClass('DoctrineMongoODMModule\Logging\Logger');
$metadataCache = $this->getMockForAbstractClass('Doctrine\Common\Cache\Cache');
$mappingDriver = $this->getMockForAbstractClass('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver');
$serviceLocator = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface');
$serviceLocator->expects($this->exactly(4))->method('get')->withConsecutive(
array('Configuration'),
array('stubbed_logger'),
array('doctrine.cache.stubbed_metadatacache'),
array('doctrine.driver.stubbed_driver')
)->willReturnOnConsecutiveCalls(
array(
'doctrine' => array(
'configuration' => array(
'odm_test' => array(
'logger' => 'stubbed_logger',
'metadata_cache' => 'stubbed_metadatacache',
'driver' => 'stubbed_driver',
'generate_proxies' => true,
'proxy_dir' => 'data/DoctrineMongoODMModule/Proxy',
'proxy_namespace' => 'DoctrineMongoODMModule\Proxy',
'generate_hydrators' => true,
'hydrator_dir' => 'data/DoctrineMongoODMModule/Hydrator',
'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator',
'default_db' => 'default_db',
'filters' => array(), // array('filterName' => 'BSON\Filter\Class')
// custom types
'types' => array(
'CustomType' => 'DoctrineMongoODMModuleTest\Assets\CustomType'
),
'classMetadataFactoryName' => 'stdClass'
)
)
)
),
$logger,
$metadataCache,
$mappingDriver
);
$factory = new ConfigurationFactory('odm_test');
$config = $factory->createService($serviceLocator);
$this->assertInstanceOf('Doctrine\ODM\MongoDB\Configuration', $config);
$this->assertNotNull($config->getLoggerCallable());
$this->assertSame($metadataCache, $config->getMetadataCacheImpl());
$this->assertSame($mappingDriver, $config->getMetadataDriverImpl());
$this->assertInstanceOf(
'DoctrineMongoODMModuleTest\Assets\CustomType',
\Doctrine\ODM\MongoDB\Types\Type::getType('CustomType')
);
}
}
| prolic/DoctrineMongoODMModule | tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php | PHP | mit | 4,440 |
.date-menu {
background-color: #fcfcfc;
height: 59px;
border-bottom: 1px solid #eee;
}
.date-menu-contents {
@mixin content-padding;
display: flex;
justify-content: space-between;
align-items: center;
height: 59px;
}
.date-menu-current-date {
height: 20px;
line-height: 20px;
}
.date-menu-next,
.date-menu-prev {
color: #8f8f8f;
text-decoration: none;
}
.date-menu-icon-calendar {
margin-right: 5px;
display: inline-block;
}
.date-menu-next-disabled {
pointer-events: none;
color: #ccc;
}
| jmeas/finance-app | client/transactions/components/date-menu.css | CSS | mit | 526 |
import React, { Component } from 'react'
import {
FlexGrid, Content, Container,
AdminItemsViewTable,
Table, Button
} from 'components'
import {
AddItemAboutContainer,
AddItemPhotoContainer,
SpecialSetupContainer
} from 'containers'
import { adminLink } from 'config'
import s from './AdminItemsView.sass'
class ToggleButton extends Component {
state = {value: this.props.value};
componentWillMount() {
this.setState({value: this.props.value})
}
componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({value: nextProps.value});
}
}
onClick = () => {
if (!this.props.onChange)
return;
const { field, id, value } = this.props;
const newValue = !value;
this.props.onChange({
[field]: newValue,
id
});
this.setState({value: newValue})
};
render() {
const { children } = this.props;
const { onClick } = this;
const { value } = this.state;
return (
<FlexGrid className={s.toggle} direction="column"
justify="center" align="center">
<Content size="5" center gray>{children}</Content>
<Table.RowItem className={s.toggle__icon} tag="span"
onClick={onClick}
circle circleActive={value}/>
</FlexGrid>
)
}
}
export default class AdminItemsView extends Component {
render() {
const {
data, parent_id, brands, categories,
onChange, onDelete, onAboutChange,
aboutData, onSave, onColorChange, onSpecialChange
} = this.props;
if (!data || data.id == null)
return null;
const { id } = data;
return (
<div className={s.wrapper}>
<AdminItemsViewTable data={data} brands={brands}
onChange={onChange}
categories={categories} />
<div className={s.line} />
<Container className={s.content}>
<FlexGrid justify="start" align="start">
<div className={s.grid}>
<FlexGrid className={s.toggle__wrapper}
justify="start" align="start">
<ToggleButton id={id} onChange={onChange} field="is_top"
value={data.is_top}>Топ</ToggleButton>
<ToggleButton id={id} onChange={onChange} field="is_new"
value={data.is_new}>Новинка</ToggleButton>
<ToggleButton id={id} onChange={onChange} field="is_special_active"
value={data.is_special_active}>Акция</ToggleButton>
<ToggleButton id={id} onChange={onChange} field="warranty"
value={data.warranty}>Гарантия</ToggleButton>
</FlexGrid>
<Content className={s.title} regular size="5">
Изображения
</Content>
<AddItemPhotoContainer __onChange={onColorChange} color={data.color} custom/>
<SpecialSetupContainer onChange={onSpecialChange} />
</div>
<div className={s.grid}>
<AddItemAboutContainer data={aboutData} custom
onSave={onSave}
__onChange={onAboutChange}/>
</div>
</FlexGrid>
<div className={s.actions}>
<Button type="blue" to={`${adminLink.path}/items/${parent_id}`}>
Отредактировать модель
</Button>
<Button className={s.btn} type="pink"
onClick={onDelete}>
Удалить
</Button>
</div>
</Container>
</div>
)
}
}
| expdevelop/ultrastore | src/components/AdminItemsView/AdminItemsView.js | JavaScript | mit | 3,762 |
version https://git-lfs.github.com/spec/v1
oid sha256:19eb3ffef04271f29432990f05ab086d7741a17b915b1703347b21f79b44cef2
size 2655
| yogeshsaroya/new-cdnjs | ajax/libs/yui/3.15.0/calendarnavigator/assets/skins/night/calendarnavigator.css | CSS | mit | 129 |
package main
import (
"reflect"
"strconv"
"unsafe"
"github.com/STNS/STNS/stns"
"github.com/STNS/libnss_stns/libstns"
)
/*
#include <grp.h>
#include <sys/types.h>
*/
import "C"
type Group struct {
grp *C.struct_group
result **C.struct_group
}
func (s Group) Set(groups stns.Attributes) int {
for n, g := range groups {
if g.ID != 0 {
s.grp.gr_gid = C.__gid_t(g.ID)
s.grp.gr_name = C.CString(n)
s.grp.gr_passwd = C.CString("x")
if g.Group != nil && !reflect.ValueOf(g.Group).IsNil() {
work := make([]*C.char, len(g.Users)+1)
if len(g.Users) > 0 {
for i, u := range g.Users {
work[i] = C.CString(u)
}
}
s.grp.gr_mem = (**C.char)(unsafe.Pointer(&work[0]))
} else {
work := make([]*C.char, 1)
s.grp.gr_mem = (**C.char)(unsafe.Pointer(&work[0]))
}
s.result = &s.grp
return libstns.NSS_STATUS_SUCCESS
}
}
return libstns.NSS_STATUS_NOTFOUND
}
//export _nss_stns_getgrnam_r
func _nss_stns_getgrnam_r(name *C.char, grp *C.struct_group, buffer *C.char, bufsize C.size_t, result **C.struct_group) C.int {
g := Group{grp, result}
return set(grpNss, g, "name", C.GoString(name))
}
//export _nss_stns_getgrgid_r
func _nss_stns_getgrgid_r(gid C.__gid_t, grp *C.struct_group, buffer *C.char, bufsize C.size_t, result **C.struct_group) C.int {
g := Group{grp, result}
return set(grpNss, g, "id", strconv.Itoa(int(gid)))
}
//export _nss_stns_setgrent
func _nss_stns_setgrent() C.int {
return initList(grpNss, libstns.NSS_LIST_PRESET)
}
//export _nss_stns_endgrent
func _nss_stns_endgrent() {
initList(grpNss, libstns.NSS_LIST_PURGE)
}
//export _nss_stns_getgrent_r
func _nss_stns_getgrent_r(grp *C.struct_group, buffer *C.char, bufsize C.size_t, result **C.struct_group) C.int {
g := Group{grp, result}
return setByList(grpNss, g)
}
| STNS/libnss_stns | nss/group.go | GO | mit | 1,815 |
const LogTestPlugin = require("../../helpers/LogTestPlugin");
/** @type {import("../../../").Configuration} */
module.exports = {
mode: "production",
entry: "./index",
stats: "normal",
plugins: [new LogTestPlugin()]
};
| webpack/webpack | test/statsCases/preset-normal/webpack.config.js | JavaScript | mit | 224 |
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace NetOffice.DeveloperToolbox.Utils.Registry
{
public class UtilsRegistryEntry
{
#region Fields
private UtilsRegistryKey _parent;
private string _valueName;
private UtilsRegistryEntryType _type;
#endregion
#region Construction
internal UtilsRegistryEntry(UtilsRegistryKey parent, string valueName)
{
_parent = parent;
_valueName = valueName;
_type = UtilsRegistryEntryType.Normal;
}
internal UtilsRegistryEntry(UtilsRegistryKey parent, string valueName, UtilsRegistryEntryType type)
{
_parent = parent;
_valueName = valueName;
_type = type;
}
#endregion
#region Properties
public UtilsRegistryEntryType Type
{
get
{
return _type;
}
}
public string Name
{
get
{
if(string.IsNullOrEmpty(_valueName))
return "(Standard)";
else
return _valueName;
}
set
{
RegistryKey key = _parent.Open(true);
RegistryValueKind regKind = key.GetValueKind(_valueName);
object regValue = key.GetValue(_valueName);
key.DeleteValue(_valueName);
key.SetValue(value, regValue, regKind);
key.Close();
_valueName = value;
}
}
public object Value
{
get
{
if (_type == UtilsRegistryEntryType.Faked)
return null;
RegistryKey key = _parent.Open();
object regValue = key.GetValue(_valueName);
key.Close();
return regValue;
}
set
{
if (_type == UtilsRegistryEntryType.Faked)
{
RegistryKey key = _parent.Open(true);
key.SetValue(_valueName, value, ValueKind);
key.Close();
_type = UtilsRegistryEntryType.Default;
}
else
{
RegistryKey key = _parent.Open(true);
key.SetValue(_valueName, value, ValueKind);
key.Close();
}
}
}
public RegistryValueKind ValueKind
{
get
{
if (_type == UtilsRegistryEntryType.Faked)
return RegistryValueKind.String;
RegistryKey key = _parent.Open();
RegistryValueKind kind = key.GetValueKind(_valueName);
key.Close();
return kind;
}
}
#endregion
#region Methods
public static string ByteArrayToBinaryString(byte[] byteArray)
{
StringBuilder builder = new StringBuilder(byteArray.Length * 2);
foreach (byte value in byteArray)
{
builder.AppendFormat("{0:X2}", value);
builder.Append(" ");
}
return builder.ToString();
}
public static string ShiftHexValue(string value)
{
int lenght = value.Length;
if ((10 - lenght) >= 2)
value = "0x" + value;
lenght = value.Length;
if ((10 - lenght) > 0)
{
for (int i = 0; i < (10 - lenght); i++)
{
string first = value.Substring(0, 2);
string last = value.Substring(2);
value = first + "0" + last;
}
}
return value;
}
public string GetValue(int lcid = 1033)
{
RegistryValueKind kind = ValueKind;
switch (kind)
{
case RegistryValueKind.DWord:
case RegistryValueKind.QWord:
return ShiftHexValue(String.Format("{0:x4}", Value)) + " (" + Convert.ToString(Value) + ")";
case RegistryValueKind.Binary:
return ByteArrayToBinaryString((Value as byte[])).ToLower();
case RegistryValueKind.ExpandString:
case RegistryValueKind.MultiString:
case RegistryValueKind.String:
case RegistryValueKind.Unknown:
if (_type == UtilsRegistryEntryType.Faked)
return lcid == 1033 ? "(Value not set)" : "(Wert nicht gesetzt)";
else if ((_type == UtilsRegistryEntryType.Default) && (null == Value))
return lcid == 1033 ? "(Value not set)" : "(Wert nicht gesetzt)";
return Value as string;
default:
throw new ArgumentException(kind.ToString() + " is out of range");
}
}
public void Delete()
{
RegistryKey key = _parent.Open(true);
key.DeleteValue(_valueName);
key.Close();
}
#endregion
#region Static Methods
private static byte[] StringToByteArray(string str)
{
if (null == str)
return null;
System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
return enc.GetBytes(str);
}
private static string ByteArrayToString(byte[] arr)
{
if (null == arr)
return null;
System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
return enc.GetString(arr);
}
#endregion
#region Overrides
public override string ToString()
{
return String.Format("UtilsRegistryEntry {0}", Name);
}
#endregion
}
}
| NetOfficeFw/NetOffice | Toolbox/Toolbox/Utils/Registry/UtilsRegistryEntry.cs | C# | mit | 6,140 |
import { expect } from 'chai'
import browser from '../../src/util/browser'
describe('util (node)', () => {
describe('browser', () => {
it('is false', () => {
expect(browser).to.be.false
})
})
})
| reactjs/react-a11y | test/node/util.js | JavaScript | mit | 214 |
// Seriously awesome GLSL noise functions. (C) Credits and kudos go to
// Copyright (C) Stefan Gustavson, Ian McEwan Ashima Arts
// MIT License.
define(function(require, exports){
exports.permute1 = function(x){
return mod((34.0 * x + 1.0) * x, 289.0)
}
exports.permute3 = function(x){
return mod((34.0 * x + 1.0) * x, 289.0)
}
exports.permute4 = function(x){
return mod((34.0 * x + 1.0) * x, 289.0)
}
exports.isqrtT1 = function(r){
return 1.79284291400159 - 0.85373472095314 * r
}
exports.isqrtT4 = function(r){
return vec4(1.79284291400159 - 0.85373472095314 * r)
}
exports.snoise2 = function(x, y){
return snoise2v(vec2(x,y,z))
}
exports.noise2d =
exports.s2d =
exports.snoise2v = function(v){
var C = vec4(0.211324865405187,0.366025403784439,-0.577350269189626,0.024390243902439)
var i = floor(v + dot(v, C.yy) )
var x0 = v - i + dot(i, C.xx)
var i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0)
var x12 = x0.xyxy + C.xxzz
x12.xy -= i1
i = mod(i, 289.0) // Avoid truncation effects in permutation
var p = permute3(permute3(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0 ))
var m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0)
m = m*m
m = m*m
var x = 2.0 * fract(p * C.www) - 1.0
var h = abs(x) - 0.5
var ox = floor(x + 0.5)
var a0 = x - ox
m *= (1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h ))
var g = vec3()
g.x = a0.x * x0.x + h.x * x0.y
g.yz = a0.yz * x12.xz + h.yz * x12.yw
return 130.0 * dot(m, g)
}
exports.snoise3 = function(x, y, z){
return snoise3v(vec3(x,y,z))
}
exports.noise3d =
exports.snoise3v = function(v){
var C = vec2(1.0/6.0, 1.0/3.0)
var D = vec4(0.0, 0.5, 1.0, 2.0)
// First corner
var i = floor(v + dot(v, C.yyy))
var x0 = v - i + dot(i, C.xxx)
var g = step(x0.yzx, x0.xyz)
var l = 1.0 - g
var i1 = min(g.xyz, l.zxy)
var i2 = max(g.xyz, l.zxy)
var x1 = x0 - i1 + 1.0 * C.xxx
var x2 = x0 - i2 + 2.0 * C.xxx
var x3 = x0 - 1. + 3.0 * C.xxx
// Permutations
i = mod(i, 289.0)
var p = permute4(permute4(permute4(
i.z + vec4(0.0, i1.z, i2.z, 1.0))
+ i.y + vec4(0.0, i1.y, i2.y, 1.0))
+ i.x + vec4(0.0, i1.x, i2.x, 1.0))
// ( N*N points uniformly over a square, mapped onto an octahedron.)
var n_ = 1.0/7.0
var ns = n_ * D.wyz - D.xzx
var j = p - 49.0 * floor(p * ns.z *ns.z)
var x_ = floor(j * ns.z)
var y_ = floor(j - 7.0 * x_)
var x = x_ * ns.x + ns.yyyy
var y = y_ * ns.x + ns.yyyy
var h = 1.0 - abs(x) - abs(y)
var b0 = vec4( x.xy, y.xy )
var b1 = vec4( x.zw, y.zw )
var s0 = floor(b0)*2.0 + 1.0
var s1 = floor(b1)*2.0 + 1.0
var sh = -step(h, vec4(0.0))
var a0 = b0.xzyw + s0.xzyw*sh.xxyy
var a1 = b1.xzyw + s1.xzyw*sh.zzww
var p0 = vec3(a0.xy, h.x)
var p1 = vec3(a0.zw, h.y)
var p2 = vec3(a1.xy, h.z)
var p3 = vec3(a1.zw, h.w)
//Normalise gradients
var norm = isqrtT4(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)))
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
var m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0)
m = m * m
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
dot(p2,x2), dot(p3,x3) ) )
}
exports.snoise4_g = function(j, ip){
var p = vec4()
p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0
p.w = 1.5 - dot(abs(p.xyz), vec3(1.0,1.0,1.0))
var s = vec4(lessThan(p, vec4(0.0)))
p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www
return p
}
exports.snoise4 = function(x, y, z, w){
return snoise4v(vec4(x,y,z,w))
}
exports.snoise4v = function(v){
var C = vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958)
// First corner
var i = floor(v + dot(v, vec4(0.309016994374947451)) )
var x0 = v - i + dot(i, C.xxxx)
var i0 = vec4()
var isX = step( x0.yzw, x0.xxx )
var isYZ = step( x0.zww, x0.yyz )
i0.x = isX.x + isX.y + isX.z
i0.yzw = 1.0 - isX
i0.y += isYZ.x + isYZ.y
i0.zw += 1.0 - isYZ.xy
i0.z += isYZ.z
i0.w += 1.0 - isYZ.z
var i3 = clamp( i0, 0.0, 1.0 )
var i2 = clamp( i0-1.0, 0.0, 1.0 )
var i1 = clamp( i0-2.0, 0.0, 1.0 )
var x1 = x0 - i1 + C.xxxx
var x2 = x0 - i2 + C.yyyy
var x3 = x0 - i3 + C.zzzz
var x4 = x0 + C.wwww
// Permutations
i = mod(i, 289.0 )
var j0 = permute1( permute1( permute1( permute1(i.w) + i.z) + i.y) + i.x)
var j1 = permute4( permute4( permute4( permute4(
i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))
+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))
+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))
+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ))
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
var ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0)
var p0 = snoise4_g(j0, ip)
var p1 = snoise4_g(j1.x, ip)
var p2 = snoise4_g(j1.y, ip)
var p3 = snoise4_g(j1.z, ip)
var p4 = snoise4_g(j1.w, ip)
// Normalise gradients
var nr = isqrtT4(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)))
p0 *= nr.x
p1 *= nr.y
p2 *= nr.z
p3 *= nr.w
p4 *= isqrtT1(dot(p4,p4))
// Mix contributions from the five corners
var m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0)
var m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0)
m0 = m0 * m0
m1 = m1 * m1
return 49.0 * (dot(m0*m0, vec3(dot( p0, x0 ), dot(p1, x1), dot(p2, x2)))
+ dot(m1*m1, vec2( dot(p3, x3), dot(p4, x4))))
}
exports.cell2v = function(v){
return cell3v(vec3(v.x, v.y,0))
}
exports.cell3v = function(P){
var K = 0.142857142857 // 1/7
var Ko = 0.428571428571 // 1/2-K/2
var K2 = 0.020408163265306 // 1/(7*7)
var Kz = 0.166666666667 // 1/6
var Kzo = 0.416666666667 // 1/2-1/6*2
var ji = 0.8 // smaller jitter gives less errors in F2
var Pi = mod(floor(P), 289.0)
var Pf = fract(P)
var Pfx = Pf.x + vec4(0.0, -1.0, 0.0, -1.0)
var Pfy = Pf.y + vec4(0.0, 0.0, -1.0, -1.0)
var p = permute4(Pi.x + vec4(0.0, 1.0, 0.0, 1.0))
p = permute4(p + Pi.y + vec4(0.0, 0.0, 1.0, 1.0))
var p1 = permute4(p + Pi.z) // z+0
var p2 = permute4(p + Pi.z + vec4(1.0)) // z+1
var ox1 = fract(p1*K) - Ko
var oy1 = mod(floor(p1*K), 7.0)*K - Ko
var oz1 = floor(p1*K2)*Kz - Kzo // p1 < 289 guaranteed
var ox2 = fract(p2*K) - Ko
var oy2 = mod(floor(p2*K), 7.0)*K - Ko
var oz2 = floor(p2*K2)*Kz - Kzo
var dx1 = Pfx + ji*ox1
var dy1 = Pfy + ji*oy1
var dz1 = Pf.z + ji*oz1
var dx2 = Pfx + ji*ox2
var dy2 = Pfy + ji*oy2
var dz2 = Pf.z - 1.0 + ji*oz2
var d1 = dx1 * dx1 + dy1 * dy1 + dz1 * dz1 // z+0
var d2 = dx2 * dx2 + dy2 * dy2 + dz2 * dz2 // z+1
var d = min(d1,d2) // F1 is now in d
d2 = max(d1,d2) // Make sure we keep all candidates for F2
d.xy = (d.x < d.y) ? d.xy : d.yx // Swap smallest to d.x
d.xz = (d.x < d.z) ? d.xz : d.zx
d.xw = (d.x < d.w) ? d.xw : d.wx // F1 is now in d.x
d.yzw = min(d.yzw, d2.yzw) // F2 now not in d2.yzw
d.y = min(d.y, d.z) // nor in d.z
d.y = min(d.y, d.w) // nor in d.w
d.y = min(d.y, d2.x) // F2 is now in d.y
return sqrt(d.xy) // F1 and F2
},
exports.cell3w = function(P){
var K = 0.142857142857
var Ko = 0.428571428571 // 1/2-K/2
var K2 = 0.020408163265306// 1/(7*7)
var Kz = 0.166666666667// 1/6
var Kzo = 0.416666666667// 1/2-1/6*2
var ji = 1.0// smaller jitter gives more regular pattern
var Pi = mod(floor(P), 289.0)
var Pf = fract(P) - 0.5
var Pfx = Pf.x + vec3(1.0, 0.0, -1.0)
var Pfy = Pf.y + vec3(1.0, 0.0, -1.0)
var Pfz = Pf.z + vec3(1.0, 0.0, -1.0)
var p = permute3(Pi.x + vec3(-1.0, 0.0, 1.0))
var p1 = permute3(p + Pi.y - 1.0)
var p2 = permute3(p + Pi.y)
var p3 = permute3(p + Pi.y + 1.0)
var p11 = permute3(p1 + Pi.z - 1.0)
var p12 = permute3(p1 + Pi.z)
var p13 = permute3(p1 + Pi.z + 1.0)
var p21 = permute3(p2 + Pi.z - 1.0)
var p22 = permute3(p2 + Pi.z)
var p23 = permute3(p2 + Pi.z + 1.0)
var p31 = permute3(p3 + Pi.z - 1.0)
var p32 = permute3(p3 + Pi.z)
var p33 = permute3(p3 + Pi.z + 1.0)
var ox11 = fract(p11*K) - Ko
var oy11 = mod(floor(p11*K), 7.0)*K - Ko
var oz11 = floor(p11*K2)*Kz - Kzo // p11 < 289 guaranteed
var ox12 = fract(p12*K) - Ko
var oy12 = mod(floor(p12*K), 7.0)*K - Ko
var oz12 = floor(p12*K2)*Kz - Kzo
var ox13 = fract(p13*K) - Ko
var oy13 = mod(floor(p13*K), 7.0)*K - Ko
var oz13 = floor(p13*K2)*Kz - Kzo
var ox21 = fract(p21*K) - Ko
var oy21 = mod(floor(p21*K), 7.0)*K - Ko
var oz21 = floor(p21*K2)*Kz - Kzo
var ox22 = fract(p22*K) - Ko
var oy22 = mod(floor(p22*K), 7.0)*K - Ko
var oz22 = floor(p22*K2)*Kz - Kzo
var ox23 = fract(p23*K) - Ko
var oy23 = mod(floor(p23*K), 7.0)*K - Ko
var oz23 = floor(p23*K2)*Kz - Kzo
var ox31 = fract(p31*K) - Ko
var oy31 = mod(floor(p31*K), 7.0)*K - Ko
var oz31 = floor(p31*K2)*Kz - Kzo
var ox32 = fract(p32*K) - Ko
var oy32 = mod(floor(p32*K), 7.0)*K - Ko
var oz32 = floor(p32*K2)*Kz - Kzo
var ox33 = fract(p33*K) - Ko
var oy33 = mod(floor(p33*K), 7.0)*K - Ko
var oz33 = floor(p33*K2)*Kz - Kzo
var dx11 = Pfx + ji*ox11
var dy11 = Pfy.x + ji*oy11
var dz11 = Pfz.x + ji*oz11
var dx12 = Pfx + ji*ox12
var dy12 = Pfy.x + ji*oy12
var dz12 = Pfz.y + ji*oz12
var dx13 = Pfx + ji*ox13
var dy13 = Pfy.x + ji*oy13
var dz13 = Pfz.z + ji*oz13
var dx21 = Pfx + ji*ox21
var dy21 = Pfy.y + ji*oy21
var dz21 = Pfz.x + ji*oz21
var dx22 = Pfx + ji*ox22
var dy22 = Pfy.y + ji*oy22
var dz22 = Pfz.y + ji*oz22
var dx23 = Pfx + ji*ox23
var dy23 = Pfy.y + ji*oy23
var dz23 = Pfz.z + ji*oz23
var dx31 = Pfx + ji*ox31
var dy31 = Pfy.z + ji*oy31
var dz31 = Pfz.x + ji*oz31
var dx32 = Pfx + ji*ox32
var dy32 = Pfy.z + ji*oy32
var dz32 = Pfz.y + ji*oz32
var dx33 = Pfx + ji*ox33
var dy33 = Pfy.z + ji*oy33
var dz33 = Pfz.z + ji*oz33
var d11 = dx11 * dx11 + dy11 * dy11 + dz11 * dz11
var d12 = dx12 * dx12 + dy12 * dy12 + dz12 * dz12
var d13 = dx13 * dx13 + dy13 * dy13 + dz13 * dz13
var d21 = dx21 * dx21 + dy21 * dy21 + dz21 * dz21
var d22 = dx22 * dx22 + dy22 * dy22 + dz22 * dz22
var d23 = dx23 * dx23 + dy23 * dy23 + dz23 * dz23
var d31 = dx31 * dx31 + dy31 * dy31 + dz31 * dz31
var d32 = dx32 * dx32 + dy32 * dy32 + dz32 * dz32
var d33 = dx33 * dx33 + dy33 * dy33 + dz33 * dz33
var d1a = min(d11, d12)
d12 = max(d11, d12)
d11 = min(d1a, d13) // Smallest now not in d12 or d13
d13 = max(d1a, d13)
d12 = min(d12, d13) // 2nd smallest now not in d13
var d2a = min(d21, d22)
d22 = max(d21, d22)
d21 = min(d2a, d23) // Smallest now not in d22 or d23
d23 = max(d2a, d23)
d22 = min(d22, d23) // 2nd smallest now not in d23
var d3a = min(d31, d32)
d32 = max(d31, d32)
d31 = min(d3a, d33) // Smallest now not in d32 or d33
d33 = max(d3a, d33)
d32 = min(d32, d33) // 2nd smallest now not in d33
var da = min(d11, d21)
d21 = max(d11, d21)
d11 = min(da, d31) // Smallest now in d11
d31 = max(da, d31) // 2nd smallest now not in d31
d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx
d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx // d11.x now smallest
d12 = min(d12, d21) // 2nd smallest now not in d21
d12 = min(d12, d22) // nor in d22
d12 = min(d12, d31) // nor in d31
d12 = min(d12, d32) // nor in d32
d11.yz = min(d11.yz, d12.xy) // nor in d12.yz
d11.y = min(d11.y, d12.z) // Only two more to go
d11.y = min(d11.y, d11.z) // Done! (Phew!)
return sqrt(d11.xy) // F1, F2
}
}) | teem2/dreem2.1 | core/gl/glnoise.js | JavaScript | mit | 11,369 |
#pragma once
namespace Game
{
namespace Light
{
constexpr unsigned int MAX_POINT_LIGHT_NUM = 384U;
constexpr unsigned int MAX_LINE_LIGHT_NUM = 64U;
constexpr unsigned int MAX_SPOT_LIGHT_NUM = 16U;
}
}
| desspert/mogupro | mogupro/game/include/Game/Light/LightDefine.h | C | mit | 201 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Version;
class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
* @group legacy
*/
public function testItOnlyWorksWithQueryBuilderOrClosure()
{
new ORMQueryBuilderLoader(new \stdClass());
}
/**
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
* @group legacy
*/
public function testClosureRequiresTheEntityManager()
{
$closure = function () {};
new ORMQueryBuilderLoader($closure);
}
public function testIdentifierTypeIsStringArray()
{
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity', Connection::PARAM_STR_ARRAY);
}
public function testIdentifierTypeIsIntegerArray()
{
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', Connection::PARAM_INT_ARRAY);
}
protected function checkIdentifierType($classname, $expectedType)
{
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))
->getMock();
$query->expects($this->once())
->method('setParameter')
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2), $expectedType)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
->setConstructorArgs(array($em))
->setMethods(array('getQuery'))
->getMock();
$qb->expects($this->once())
->method('getQuery')
->willReturn($query);
$qb->select('e')
->from($classname, 'e');
$loader = new ORMQueryBuilderLoader($qb);
$loader->getEntitiesByIds('id', array(1, 2));
}
public function testFilterNonIntegerValues()
{
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))
->getMock();
$query->expects($this->once())
->method('setParameter')
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
->setConstructorArgs(array($em))
->setMethods(array('getQuery'))
->getMock();
$qb->expects($this->once())
->method('getQuery')
->willReturn($query);
$qb->select('e')
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', 'e');
$loader = new ORMQueryBuilderLoader($qb);
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
}
public function testEmbeddedIdentifierName()
{
if (Version::compare('2.5.0') > 0) {
$this->markTestSkipped('Applicable only for Doctrine >= 2.5.0');
return;
}
$em = DoctrineTestHelper::createTestEntityManager();
$query = $this->getMockBuilder('QueryMock')
->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))
->getMock();
$query->expects($this->once())
->method('setParameter')
->with('ORMQueryBuilderLoader_getEntitiesByIds_id_value', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
->setConstructorArgs(array($em))
->setMethods(array('getQuery'))
->getMock();
$qb->expects($this->once())
->method('getQuery')
->willReturn($query);
$qb->select('e')
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\EmbeddedIdentifierEntity', 'e');
$loader = new ORMQueryBuilderLoader($qb);
$loader->getEntitiesByIds('id.value', array(1, '', 2, 3, 'foo'));
}
}
| Condors/TunisiaMall | vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php | PHP | mit | 4,770 |
var $ = require('jquery');
var keymaster = require('keymaster');
var ChartEditor = require('./component-chart-editor.js');
var DbInfo = require('./component-db-info.js');
var AceSqlEditor = require('./component-ace-sql-editor.js');
var DataGrid = require('./component-data-grid.js');
var QueryEditor = function () {
var chartEditor = new ChartEditor();
var dbInfo = new DbInfo();
var aceSqlEditor = new AceSqlEditor("ace-editor");
var dataGrid = new DataGrid();
function runQuery () {
$('#server-run-time').html('');
$('#rowcount').html('');
dataGrid.emptyDataGrid();
var data = {
queryText: aceSqlEditor.getSelectedOrAllText(),
connectionId: $('#connection').val(),
cacheKey: $('#cache-key').val(),
queryName: getQueryName()
};
dataGrid.startRunningTimer();
$.ajax({
type: "POST",
url: "/run-query",
data: data
}).done(function (data) {
chartEditor.setData(data);
// TODO - if vis tab is active, render chart
dataGrid.stopRunningTimer();
$('#server-run-time').html(data.serverMs/1000 + " sec.");
if (data.success) {
$('.hide-while-running').show();
if (data.incomplete) {
$('.incomplete-notification').removeClass("hidden");
} else {
$('.incomplete-notification').addClass("hidden");
}
dataGrid.renderGridData(data);
} else {
dataGrid.renderError(data.error);
}
}).fail(function () {
dataGrid.stopRunningTimer();
dataGrid.renderError("Something is broken :(");
});
}
function getQueryName () {
return $('#header-query-name').val();
}
function getQueryTags () {
return $.map($('#tags').val().split(','), $.trim);
}
function saveQuery () {
var $queryId = $('#query-id');
var query = {
name: getQueryName(),
queryText: aceSqlEditor.getEditorText(),
tags: getQueryTags(),
connectionId: dbInfo.getConnectionId(),
chartConfiguration: chartEditor.getChartConfiguration()
};
$('#btn-save-result').text('saving...').show();
$.ajax({
type: "POST",
url: "/queries/" + $queryId.val(),
data: query
}).done(function (data) {
if (data.success) {
window.history.replaceState({}, "query " + data.query._id, "/queries/" + data.query._id);
$queryId.val(data.query._id);
$('#btn-save-result').removeClass('label-info').addClass('label-success').text('Success');
setTimeout(function () {
$('#btn-save-result').fadeOut(400, function () {
$('#btn-save-result').removeClass('label-success').addClass('label-info').text('');
});
}, 1000);
} else {
$('#btn-save-result').removeClass('label-info').addClass('label-danger').text('Failed');
}
}).fail(function () {
alert('ajax fail');
});
}
$('#btn-save').click(function (event) {
event.preventDefault();
event.stopPropagation();
saveQuery();
});
$('#btn-run-query').click(function (event) {
event.preventDefault();
event.stopPropagation();
runQuery();
});
/* (re-)render the chart when the viz tab is pressed,
TODO: only do this if necessary
==============================================================================*/
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// if shown tab was the chart tab, rerender the chart
// e.target is the activated tab
if (e.target.getAttribute("href") == "#tab-content-visualize") {
chartEditor.rerenderChart();
} else if (e.target.getAttribute("href") == "#tab-content-sql") {
dataGrid.resize();
}
});
/* get query again, because not all the data is in the HTML
TODO: do most the workflow this way?
==============================================================================*/
var $queryId = $('#query-id');
$.ajax({
type: "GET",
url: "/queries/" + $queryId.val() + "?format=json"
}).done(function (data) {
console.log(data);
chartEditor.loadChartConfiguration(data.chartConfiguration);
}).fail(function () {
alert('Failed to get additional Query info');
});
/* Tags Typeahead
==============================================================================*/
var Bloodhound = require('Bloodhound');
var bloodhoundTags = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: '/tags', // array of tagnames
ttl: 0,
filter: function(list) {
return $.map(list, function(tag) {
return { name: tag }; });
}
}
});
bloodhoundTags.initialize();
$('#tags').tagsinput({
typeaheadjs: {
//name: 'tags',
displayKey: 'name',
valueKey: 'name',
source: bloodhoundTags.ttAdapter()
}
});
/* Shortcuts
==============================================================================*/
// keymaster doesn't fire on input/textarea events by default
// since we are only using command/ctrl shortcuts,
// we want the event to fire all the time for any element
keymaster.filter = function (event) {
return true;
};
keymaster('ctrl+s, command+s', function() {
saveQuery();
return false;
});
keymaster('ctrl+r, command+r, ctrl+e, command+e', function() {
runQuery();
return false;
});
};
module.exports = function () {
if ($('#ace-editor').length) {
new QueryEditor();
}
}; | l371559739/sqlpad | client-js/query-editor.js | JavaScript | mit | 6,203 |
package PracticeLeetCode;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
public class _127WordLadder {
psvm
}
| darshanhs90/Java-InterviewPrep | src/PracticeLeetCode/_127WordLadder.java | Java | mit | 169 |
<?php
namespace Illuminate\Tests\Integration\Database\EloquentModelLoadMissingTest;
use DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Tests\Integration\Database\DatabaseTestCase;
/**
* @group integration
*/
class EloquentModelLoadMissingTest extends DatabaseTestCase
{
protected function setUp(): void
{
parent::setUp();
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
});
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('parent_id')->nullable();
$table->unsignedInteger('post_id');
});
Post::create();
Comment::create(['parent_id' => null, 'post_id' => 1]);
Comment::create(['parent_id' => 1, 'post_id' => 1]);
}
public function testLoadMissing()
{
$post = Post::with('comments')->first();
DB::enableQueryLog();
$post->loadMissing('comments.parent');
$this->assertCount(1, DB::getQueryLog());
$this->assertTrue($post->comments[0]->relationLoaded('parent'));
}
}
class Comment extends Model
{
public $timestamps = false;
protected $guarded = ['id'];
public function parent()
{
return $this->belongsTo(Comment::class);
}
}
class Post extends Model
{
public $timestamps = false;
public function comments()
{
return $this->hasMany(Comment::class);
}
}
| cviebrock/framework | tests/Integration/Database/EloquentModelLoadMissingTest.php | PHP | mit | 1,580 |
import glob
import logging
import os
import subprocess
from plugins import BaseAligner
from yapsy.IPlugin import IPlugin
from assembly import get_qual_encoding
class Bowtie2Aligner(BaseAligner, IPlugin):
def run(self):
"""
Map READS to CONTIGS and return alignment.
Set MERGED_PAIR to True if reads[1] is a merged
paired end file
"""
contig_file = self.data.contigfiles[0]
reads = self.data.readfiles
## Index contigs
prefix = os.path.join(self.outpath, 'bt2')
cmd_args = [self.build_bin, '-f', contig_file, prefix]
self.arast_popen(cmd_args, overrides=False)
### Align reads
bamfiles = []
for i, readset in enumerate(self.data.readsets):
samfile = os.path.join(self.outpath, 'align.sam')
reads = readset.files
cmd_args = [self.executable, '-x', prefix, '-S', samfile,
'-p', self.process_threads_allowed]
if len(reads) == 2:
cmd_args += ['-1', reads[0], '-2', reads[1]]
elif len(reads) == 1:
cmd_args += ['-U', reads[0]]
else:
raise Exception('Bowtie plugin error')
self.arast_popen(cmd_args, overrides=False)
if not os.path.exists(samfile):
raise Exception('Unable to complete alignment')
## Convert to BAM
bamfile = samfile.replace('.sam', '.bam')
cmd_args = ['samtools', 'view',
'-bSho', bamfile, samfile]
self.arast_popen(cmd_args)
bamfiles.append(bamfile)
### Merge samfiles if multiple
if len(bamfiles) > 1:
bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i))
self.arast_popen(['samtools', 'merge', bamfile] + bamfiles)
if not os.path.exists(bamfile):
raise Exception('Unable to complete alignment')
else:
bamfile = bamfiles[0]
if not os.path.exists(bamfile):
raise Exception('Unable to complete alignment')
## Convert back to sam
samfile = bamfile.replace('.bam', '.sam')
self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile])
return {'alignment': samfile,
'alignment_bam': bamfile}
| levinas/assembly | lib/assembly/plugins/bowtie2.py | Python | mit | 2,404 |
namespace EventCloud.Events.Dtos
{
public class GetEventListInput
{
public bool IncludeCanceledEvents { get; set; }
}
} | aspnetboilerplate/sample-eventcloud | mvc-angularjs/src/EventCloud.Application/Events/Dtos/GetEventListInput.cs | C# | mit | 142 |
// # Frontend Route tests
// As it stands, these tests depend on the database, and as such are integration tests.
// Mocking out the models to not touch the DB would turn these into unit tests, and should probably be done in future,
// But then again testing real code, rather than mock code, might be more useful...
const should = require('should');
const sinon = require('sinon');
const supertest = require('supertest');
const moment = require('moment');
const cheerio = require('cheerio');
const _ = require('lodash');
const testUtils = require('../../utils');
const configUtils = require('../../utils/configUtils');
const urlUtils = require('../../utils/urlUtils');
const config = require('../../../core/shared/config');
const settingsCache = require('../../../core/server/services/settings/cache');
const origCache = _.cloneDeep(settingsCache);
const ghost = testUtils.startGhost;
let request;
describe('Frontend Routing', function () {
function doEnd(done) {
return function (err, res) {
if (err) {
return done(err);
}
should.not.exist(res.headers['x-cache-invalidate']);
should.not.exist(res.headers['X-CSRF-Token']);
should.not.exist(res.headers['set-cookie']);
should.exist(res.headers.date);
done();
};
}
function addPosts(done) {
testUtils.clearData().then(function () {
return testUtils.initData();
}).then(function () {
return testUtils.fixtures.insertPostsAndTags();
}).then(function () {
done();
});
}
afterEach(function () {
sinon.restore();
});
before(function () {
return ghost()
.then(function () {
request = supertest.agent(config.get('url'));
});
});
describe('Test with Initial Fixtures', function () {
describe('Error', function () {
it('should 404 for unknown post with invalid characters', function (done) {
request.get('/$pec+acular~/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
it('should 404 for unknown frontend route', function (done) {
request.get('/spectacular/marvellous/')
.set('Accept', 'application/json')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
it('should 404 for encoded char not 301 from uncapitalise', function (done) {
request.get('/|/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
});
describe('Default Redirects (clean URLS)', function () {
it('Single post should redirect without slash', function (done) {
request.get('/welcome')
.expect('Location', '/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('Single post should redirect uppercase', function (done) {
request.get('/Welcome/')
.expect('Location', '/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('Single post should sanitize double slashes when redirecting uppercase', function (done) {
request.get('///Google.com/')
.expect('Location', '/google.com/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('AMP post should redirect without slash', function (done) {
request.get('/welcome/amp')
.expect('Location', '/welcome/amp/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('AMP post should redirect uppercase', function (done) {
request.get('/Welcome/AMP/')
.expect('Location', '/welcome/amp/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
});
});
describe('Test with added posts', function () {
before(addPosts);
describe('Static page', function () {
it('should respond with html', function (done) {
request.get('/static-page-test/')
.expect('Content-Type', /html/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(200)
.end(function (err, res) {
const $ = cheerio.load(res.text);
should.not.exist(res.headers['x-cache-invalidate']);
should.not.exist(res.headers['X-CSRF-Token']);
should.not.exist(res.headers['set-cookie']);
should.exist(res.headers.date);
$('title').text().should.equal('This is a static page');
$('body.page-template').length.should.equal(1);
$('article.post').length.should.equal(1);
doEnd(done)(err, res);
});
});
it('should redirect without slash', function (done) {
request.get('/static-page-test')
.expect('Location', '/static-page-test/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
describe('edit', function () {
it('should redirect without slash', function (done) {
request.get('/static-page-test/edit')
.expect('Location', '/static-page-test/edit/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect to editor', function (done) {
request.get('/static-page-test/edit/')
.expect('Location', /ghost\/#\/editor\/\w+/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(302)
.end(doEnd(done));
});
it('should 404 for non-edit parameter', function (done) {
request.get('/static-page-test/notedit/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
});
describe('edit with admin redirects disabled', function () {
before(function (done) {
configUtils.set('admin:redirects', false);
ghost({forceStart: true})
.then(function () {
request = supertest.agent(config.get('url'));
addPosts(done);
});
});
after(function (done) {
configUtils.restore();
ghost({forceStart: true})
.then(function () {
request = supertest.agent(config.get('url'));
addPosts(done);
});
});
it('should redirect without slash', function (done) {
request.get('/static-page-test/edit')
.expect('Location', '/static-page-test/edit/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should not redirect to editor', function (done) {
request.get('/static-page-test/edit/')
.expect(404)
.expect('Cache-Control', testUtils.cacheRules.private)
.end(doEnd(done));
});
});
describe('amp', function () {
it('should 404 for amp parameter', function (done) {
// NOTE: only post pages are supported so the router doesn't have a way to distinguish if
// the request was done after AMP 'Page' or 'Post'
request.get('/static-page-test/amp/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Post not found/)
.end(doEnd(done));
});
});
});
describe('Post preview', function () {
it('should display draft posts accessed via uuid', function (done) {
request.get('/p/d52c42ae-2755-455c-80ec-70b2ec55c903/')
.expect('Content-Type', /html/)
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
const $ = cheerio.load(res.text);
should.not.exist(res.headers['x-cache-invalidate']);
should.not.exist(res.headers['X-CSRF-Token']);
should.not.exist(res.headers['set-cookie']);
should.exist(res.headers.date);
$('title').text().should.equal('Not finished yet');
// @TODO: use theme from fixtures and don't rely on content/themes/casper
// $('.content .post').length.should.equal(1);
// $('.poweredby').text().should.equal('Proudly published with Ghost');
// $('body.post-template').length.should.equal(1);
// $('article.post').length.should.equal(1);
done();
});
});
it('should redirect published posts to their live url', function (done) {
request.get('/p/2ac6b4f6-e1f3-406c-9247-c94a0496d39d/')
.expect(301)
.expect('Location', '/short-and-sweet/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('404s unknown uuids', function (done) {
request.get('/p/aac6b4f6-e1f3-406c-9247-c94a0496d39f/')
.expect(404)
.end(doEnd(done));
});
});
describe('Post with Ghost in the url', function () {
// All of Ghost's admin depends on the /ghost/ in the url to work properly
// Badly formed regexs can cause breakage if a post slug starts with the 5 letters ghost
it('should retrieve a blog post with ghost at the start of the url', function (done) {
request.get('/ghostly-kitchen-sink/')
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(200)
.end(doEnd(done));
});
});
});
describe('Subdirectory (no slash)', function () {
let ghostServer;
before(function () {
configUtils.set('url', 'http://localhost/blog');
urlUtils.stubUrlUtilsFromConfig();
return ghost({forceStart: true, subdir: true})
.then(function (_ghostServer) {
ghostServer = _ghostServer;
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
});
});
after(function () {
configUtils.restore();
urlUtils.restore();
});
it('http://localhost should 404', function (done) {
request.get('/')
.expect(404)
.end(doEnd(done));
});
it('http://localhost/ should 404', function (done) {
request.get('/')
.expect(404)
.end(doEnd(done));
});
it('http://localhost/blog should 301 to http://localhost/blog/', function (done) {
request.get('/blog')
.expect(301)
.expect('Location', '/blog/')
.end(doEnd(done));
});
it('http://localhost/blog/ should 200', function (done) {
request.get('/blog/')
.expect(200)
.end(doEnd(done));
});
it('http://localhost/blog/welcome should 301 to http://localhost/blog/welcome/', function (done) {
request.get('/blog/welcome')
.expect(301)
.expect('Location', '/blog/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('http://localhost/blog/welcome/ should 200', function (done) {
request.get('/blog/welcome/')
.expect(200)
.end(doEnd(done));
});
it('/blog/tag/getting-started should 301 to /blog/tag/getting-started/', function (done) {
request.get('/blog/tag/getting-started')
.expect(301)
.expect('Location', '/blog/tag/getting-started/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('/blog/tag/getting-started/ should 200', function (done) {
request.get('/blog/tag/getting-started/')
.expect(200)
.end(doEnd(done));
});
it('/blog/welcome/amp/ should 200', function (done) {
request.get('/blog/welcome/amp/')
.expect(200)
.end(doEnd(done));
});
});
describe('Subdirectory (with slash)', function () {
let ghostServer;
before(function () {
configUtils.set('url', 'http://localhost/blog/');
urlUtils.stubUrlUtilsFromConfig();
return ghost({forceStart: true, subdir: true})
.then(function (_ghostServer) {
ghostServer = _ghostServer;
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
});
});
after(function () {
configUtils.restore();
urlUtils.restore();
});
it('http://localhost should 404', function (done) {
request.get('/')
.expect(404)
.end(doEnd(done));
});
it('http://localhost/ should 404', function (done) {
request.get('/')
.expect(404)
.end(doEnd(done));
});
it('/blog should 301 to /blog/', function (done) {
request.get('/blog')
.expect(301)
.expect('Location', '/blog/')
.end(doEnd(done));
});
it('/blog/ should 200', function (done) {
request.get('/blog/')
.expect(200)
.end(doEnd(done));
});
it('/blog/welcome should 301 to /blog/welcome/', function (done) {
request.get('/blog/welcome')
.expect(301)
.expect('Location', '/blog/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('/blog/welcome/ should 200', function (done) {
request.get('/blog/welcome/')
.expect(200)
.end(doEnd(done));
});
it('/blog/tag/getting-started should 301 to /blog/tag/getting-started/', function (done) {
request.get('/blog/tag/getting-started')
.expect(301)
.expect('Location', '/blog/tag/getting-started/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('/blog/tag/getting-started/ should 200', function (done) {
request.get('/blog/tag/getting-started/')
.expect(200)
.end(doEnd(done));
});
it('/blog/welcome/amp/ should 200', function (done) {
request.get('/blog/welcome/amp/')
.expect(200)
.end(doEnd(done));
});
it('should uncapitalise correctly with 301 to subdir', function (done) {
request.get('/blog/AAA/')
.expect('Location', '/blog/aaa/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
});
// we'll use X-Forwarded-Proto: https to simulate an 'https://' request behind a proxy
describe('HTTPS', function () {
let ghostServer;
before(function () {
configUtils.set('url', 'http://localhost:2370/');
urlUtils.stubUrlUtilsFromConfig();
return ghost({forceStart: true})
.then(function (_ghostServer) {
ghostServer = _ghostServer;
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
});
});
after(function () {
configUtils.restore();
urlUtils.restore();
});
it('should set links to url over non-HTTPS', function (done) {
request.get('/')
.expect(200)
.expect(/<link rel="canonical" href="http:\/\/localhost:2370\/" \/\>/)
.expect(/<a href="http:\/\/localhost:2370">Ghost<\/a\>/)
.end(doEnd(done));
});
it('should set links over HTTPS besides canonical', function (done) {
request.get('/')
.set('X-Forwarded-Proto', 'https')
.expect(200)
.expect(/<link rel="canonical" href="http:\/\/localhost:2370\/" \/\>/)
.expect(/<a href="https:\/\/localhost:2370">Ghost<\/a\>/)
.end(doEnd(done));
});
});
// TODO: convert to unit tests
describe('Redirects (use redirects.json from test/utils/fixtures/data)', function () {
let ghostServer;
before(function () {
configUtils.set('url', 'http://localhost:2370/');
urlUtils.stubUrlUtilsFromConfig();
return ghost({forceStart: true})
.then(function (_ghostServer) {
ghostServer = _ghostServer;
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
});
});
after(function () {
configUtils.restore();
urlUtils.restore();
});
describe('1 case', function () {
it('with trailing slash', function (done) {
request.get('/post/10/a-nice-blog-post')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/a-nice-blog-post');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/post/10/a-nice-blog-post/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/a-nice-blog-post');
doEnd(done)(err, res);
});
});
it('with query params', function (done) {
request.get('/topic?something=good')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/?something=good');
doEnd(done)(err, res);
});
});
it('with query params', function (done) {
request.get('/post/10/a-nice-blog-post?a=b')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/a-nice-blog-post?a=b');
doEnd(done)(err, res);
});
});
it('with case insensitive', function (done) {
request.get('/CaSe-InSeNsItIvE')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/redirected-insensitive');
doEnd(done)(err, res);
});
});
it('with case sensitive', function (done) {
request.get('/Case-Sensitive')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/redirected-sensitive');
doEnd(done)(err, res);
});
});
it('defaults to case sensitive', function (done) {
request.get('/Default-Sensitive')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/redirected-default');
doEnd(done)(err, res);
});
});
it('should not redirect with case sensitive', function (done) {
request.get('/casE-sensitivE')
.end(function (err, res) {
res.headers.location.should.not.eql('/redirected-sensitive');
res.statusCode.should.not.eql(302);
doEnd(done)(err, res);
});
});
it('should not redirect with default case sensitive', function (done) {
request.get('/defaulT-sensitivE')
.end(function (err, res) {
res.headers.location.should.not.eql('/redirected-default');
res.statusCode.should.not.eql(302);
doEnd(done)(err, res);
});
});
});
describe('2 case', function () {
it('with trailing slash', function (done) {
request.get('/my-old-blog-post/')
.expect(301)
.expect('Cache-Control', testUtils.cacheRules.year)
.end(function (err, res) {
res.headers.location.should.eql('/revamped-url/');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/my-old-blog-post')
.expect(301)
.expect('Cache-Control', testUtils.cacheRules.year)
.end(function (err, res) {
res.headers.location.should.eql('/revamped-url/');
doEnd(done)(err, res);
});
});
});
describe('3 case', function () {
it('with trailing slash', function (done) {
request.get('/what/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/what-does-god-say');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/what')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/what-does-god-say');
doEnd(done)(err, res);
});
});
});
describe('4 case', function () {
it('with trailing slash', function (done) {
request.get('/search/label/&&&/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/tag/&&&/');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/search/label/&&&/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/tag/&&&/');
doEnd(done)(err, res);
});
});
});
describe('5 case', function () {
it('with trailing slash', function (done) {
request.get('/topic/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/topic')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/');
doEnd(done)(err, res);
});
});
});
describe('6 case', function () {
it('with trailing slash', function (done) {
request.get('/resources/download/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/shubal-stearns');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/resources/download')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/shubal-stearns');
doEnd(done)(err, res);
});
});
});
describe('7 case', function () {
it('with trailing slash', function (done) {
request.get('/2016/11/welcome.html')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/welcome');
doEnd(done)(err, res);
});
});
});
describe('last case', function () {
it('default', function (done) {
request.get('/prefix/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/blog/');
doEnd(done)(err, res);
});
});
it('with a custom path', function (done) {
request.get('/prefix/expect-redirect')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/blog/expect-redirect');
doEnd(done)(err, res);
});
});
});
describe('external url redirect', function () {
it('with trailing slash', function (done) {
request.get('/external-url/')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('https://ghost.org/');
doEnd(done)(err, res);
});
});
it('without trailing slash', function (done) {
request.get('/external-url')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('https://ghost.org/');
doEnd(done)(err, res);
});
});
it('with capturing group', function (done) {
request.get('/external-url/docs')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('https://ghost.org/docs');
doEnd(done)(err, res);
});
});
});
});
describe('Subdirectory redirects (use redirects.json from test/utils/fixtures/data)', function () {
var ghostServer;
before(function () {
configUtils.set('url', 'http://localhost:2370/blog/');
urlUtils.stubUrlUtilsFromConfig();
return ghost({forceStart: true, subdir: true})
.then(function (_ghostServer) {
ghostServer = _ghostServer;
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
});
});
after(function () {
configUtils.restore();
urlUtils.restore();
});
describe('internal url redirect', function () {
it('should include the subdirectory', function (done) {
request.get('/blog/my-old-blog-post/')
.expect(301)
.expect('Cache-Control', testUtils.cacheRules.year)
.end(function (err, res) {
res.headers.location.should.eql('/blog/revamped-url/');
doEnd(done)(err, res);
});
});
it('should work with regex "from" redirects', function (done) {
request.get('/blog/capture1/whatever')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('/blog/whatever');
doEnd(done)(err, res);
});
});
});
describe('external url redirect', function () {
it('should not include the subdirectory', function (done) {
request.get('/blog/external-url/docs')
.expect(302)
.expect('Cache-Control', testUtils.cacheRules.public)
.end(function (err, res) {
res.headers.location.should.eql('https://ghost.org/docs');
doEnd(done)(err, res);
});
});
});
});
});
| JohnONolan/Ghost | test/regression/site/frontend_spec.js | JavaScript | mit | 32,924 |
# wealth-view
Single page application for viewing your financial portfolio
| LeKeve/wealth-view | README.md | Markdown | mit | 75 |
require 'mkmf'
extension_name = 'fortitude_native_ext'
dir_config(extension_name)
create_makefile(extension_name)
| leafo/fortitude | ext/fortitude_native_ext/extconf.rb | Ruby | mit | 114 |
import { browser, by, element } from 'protractor';
describe('App', () => {
beforeEach(() => {
// change hash depending on router LocationStrategy
browser.get('/#/home');
});
it('should have a title', () => {
let subject = browser.getTitle();
let result = 'Chroma An Interactive Palette tool';
expect(subject).toEqual(result);
});
it('should have `your content here` x-large', () => {
let subject = element(by.css('[x-large]')).getText();
let result = 'Your Content Here';
expect(subject).toEqual(result);
});
});
| andalex/Chroma | src/app/sidepanel/side-panel.e2e.ts | TypeScript | mit | 564 |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M21 5H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-2 12H5V7h14v10zm-9-1h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2s1.2.54 1.2 1.2v1h-2.4v-1z"
}), 'ScreenLockLandscapeOutlined');
exports.default = _default; | oliviertassinari/material-ui | packages/mui-icons-material/lib/ScreenLockLandscapeOutlined.js | JavaScript | mit | 742 |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using umbraco;
using umbraco.BusinessLogic.Actions;
using System.Globalization;
namespace Umbraco.Web.Trees
{
public abstract class ContentTreeControllerBase : TreeController
{
#region Actions
/// <summary>
/// Gets an individual tree node
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
[HttpQueryStringFilter("queryStrings")]
public TreeNode GetTreeNode(string id, FormDataCollection queryStrings)
{
int asInt;
Guid asGuid = Guid.Empty;
if (int.TryParse(id, out asInt) == false)
{
if (Guid.TryParse(id, out asGuid) == false)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
}
var entity = asGuid == Guid.Empty
? Services.EntityService.Get(asInt, UmbracoObjectType)
: Services.EntityService.GetByKey(asGuid, UmbracoObjectType);
if (entity == null)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
var node = GetSingleTreeNode(entity, entity.ParentId.ToInvariantString(), queryStrings);
//add the tree alias to the node since it is standalone (has no root for which this normally belongs)
node.AdditionalData["treeAlias"] = TreeAlias;
return node;
}
#endregion
/// <summary>
/// Ensure the noAccess metadata is applied for the root node if in dialog mode and the user doesn't have path access to it
/// </summary>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var node = base.CreateRootNode(queryStrings);
if (IsDialog(queryStrings) && UserStartNodes.Contains(Constants.System.Root) == false)
{
node.AdditionalData["noAccess"] = true;
}
return node;
}
protected abstract TreeNode GetSingleTreeNode(IUmbracoEntity e, string parentId, FormDataCollection queryStrings);
/// <summary>
/// Returns a <see cref="TreeNode"/> for the <see cref="IUmbracoEntity"/> and
/// attaches some meta data to the node if the user doesn't have start node access to it when in dialog mode
/// </summary>
/// <param name="e"></param>
/// <param name="parentId"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
internal TreeNode GetSingleTreeNodeWithAccessCheck(IUmbracoEntity e, string parentId, FormDataCollection queryStrings)
{
bool hasPathAccess;
var entityIsAncestorOfStartNodes = Security.CurrentUser.IsInBranchOfStartNode(e, Services.EntityService, RecycleBinId, out hasPathAccess);
if (entityIsAncestorOfStartNodes == false)
return null;
var treeNode = GetSingleTreeNode(e, parentId, queryStrings);
if (treeNode == null)
{
//this means that the user has NO access to this node via permissions! They at least need to have browse permissions to see
//the node so we need to return null;
return null;
}
if (hasPathAccess == false)
{
treeNode.AdditionalData["noAccess"] = true;
}
return treeNode;
}
/// <summary>
/// Returns the
/// </summary>
protected abstract int RecycleBinId { get; }
/// <summary>
/// Returns true if the recycle bin has items in it
/// </summary>
protected abstract bool RecycleBinSmells { get; }
/// <summary>
/// Returns the user's start node for this tree
/// </summary>
protected abstract int[] UserStartNodes { get; }
protected virtual TreeNodeCollection PerformGetTreeNodes(string id, FormDataCollection queryStrings)
{
var nodes = new TreeNodeCollection();
var rootIdString = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
var hasAccessToRoot = UserStartNodes.Contains(Constants.System.Root);
var startNodeId = queryStrings.HasKey(TreeQueryStringParameters.StartNodeId)
? queryStrings.GetValue<string>(TreeQueryStringParameters.StartNodeId)
: string.Empty;
if (string.IsNullOrEmpty(startNodeId) == false && startNodeId != "undefined" && startNodeId != rootIdString)
{
// request has been made to render from a specific, non-root, start node
id = startNodeId;
// ensure that the user has access to that node, otherwise return the empty tree nodes collection
// TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access
if (HasPathAccess(id, queryStrings) == false)
{
LogHelper.Warn<ContentTreeControllerBase>("User " + Security.CurrentUser.Username + " does not have access to node with id " + id);
return nodes;
}
// if the tree is rendered...
// - in a dialog: render only the children of the specific start node, nothing to do
// - in a section: if the current user's start nodes do not contain the root node, we need
// to include these start nodes in the tree too, to provide some context - i.e. change
// start node back to root node, and then GetChildEntities method will take care of the rest.
if (IsDialog(queryStrings) == false && hasAccessToRoot == false)
id = rootIdString;
}
// get child entities - if id is root, but user's start nodes do not contain the
// root node, this returns the start nodes instead of root's children
var entities = GetChildEntities(id).ToList();
nodes.AddRange(entities.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings)).Where(x => x != null));
// if the user does not have access to the root node, what we have is the start nodes,
// but to provide some context we also need to add their topmost nodes when they are not
// topmost nodes themselves (level > 1).
if (id == rootIdString && hasAccessToRoot == false)
{
var topNodeIds = entities.Where(x => x.Level > 1).Select(GetTopNodeId).Where(x => x != 0).Distinct().ToArray();
if (topNodeIds.Length > 0)
{
var topNodes = Services.EntityService.GetAll(UmbracoObjectType, topNodeIds.ToArray());
nodes.AddRange(topNodes.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings)).Where(x => x != null));
}
}
return nodes;
}
private static readonly char[] Comma = { ',' };
private int GetTopNodeId(IUmbracoEntity entity)
{
int id;
var parts = entity.Path.Split(Comma, StringSplitOptions.RemoveEmptyEntries);
return parts.Length >= 2 && int.TryParse(parts[1], out id) ? id : 0;
}
protected abstract MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings);
protected abstract UmbracoObjectTypes UmbracoObjectType { get; }
protected IEnumerable<IUmbracoEntity> GetChildEntities(string id)
{
// try to parse id as an integer else use GetEntityFromId
// which will grok Guids, Udis, etc and let use obtain the id
if (int.TryParse(id, out var entityId) == false)
{
var entity = GetEntityFromId(id);
if (entity == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
entityId = entity.Id;
}
return Services.EntityService.GetChildren(entityId, UmbracoObjectType).ToArray();
}
/// <summary>
/// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
//we should remove this in v8, it's now here for backwards compat only
protected abstract bool HasPathAccess(string id, FormDataCollection queryStrings);
/// <summary>
/// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
/// </summary>
/// <param name="entity"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected bool HasPathAccess(IUmbracoEntity entity, FormDataCollection queryStrings)
{
if (entity == null) return false;
return Security.CurrentUser.HasPathAccess(entity, Services.EntityService, RecycleBinId);
}
/// <summary>
/// Ensures the recycle bin is appended when required (i.e. user has access to the root and it's not in dialog mode)
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
/// <remarks>
/// This method is overwritten strictly to render the recycle bin, it should serve no other purpose
/// </remarks>
protected sealed override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
//check if we're rendering the root
if (id == Constants.System.Root.ToInvariantString() && UserStartNodes.Contains(Constants.System.Root))
{
var altStartId = string.Empty;
if (queryStrings.HasKey(TreeQueryStringParameters.StartNodeId))
altStartId = queryStrings.GetValue<string>(TreeQueryStringParameters.StartNodeId);
//check if a request has been made to render from a specific start node
if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.System.Root.ToString(CultureInfo.InvariantCulture))
{
id = altStartId;
}
var nodes = GetTreeNodesInternal(id, queryStrings);
//only render the recycle bin if we are not in dialog and the start id id still the root
if (IsDialog(queryStrings) == false && id == Constants.System.Root.ToInvariantString())
{
nodes.Add(CreateTreeNode(
RecycleBinId.ToInvariantString(),
id,
queryStrings,
ui.GetText("general", "recycleBin"),
"icon-trash",
RecycleBinSmells,
queryStrings.GetValue<string>("application") + TreeAlias.EnsureStartsWith('/') + "/recyclebin"));
}
return nodes;
}
return GetTreeNodesInternal(id, queryStrings);
}
/// <summary>
/// Before we make a call to get the tree nodes we have to check if they can actually be rendered
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
/// <remarks>
/// Currently this just checks if it is a container type, if it is we cannot render children. In the future this might check for other things.
/// </remarks>
private TreeNodeCollection GetTreeNodesInternal(string id, FormDataCollection queryStrings)
{
var current = GetEntityFromId(id);
//before we get the children we need to see if this is a container node
//test if the parent is a listview / container
if (current != null && current.IsContainer())
{
//no children!
return new TreeNodeCollection();
}
return PerformGetTreeNodes(id, queryStrings);
}
/// <summary>
/// Checks if the menu requested is for the recycle bin and renders that, otherwise renders the result of PerformGetMenuForNode
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected sealed override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
if (RecycleBinId.ToInvariantString() == id)
{
var menu = new MenuItemCollection();
menu.Items.Add<ActionEmptyTranscan>(ui.Text("actions", "emptyTrashcan"));
menu.Items.Add<ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
return menu;
}
return PerformGetMenuForNode(id, queryStrings);
}
/// <summary>
/// Based on the allowed actions, this will filter the ones that the current user is allowed
/// </summary>
/// <param name="menuWithAllItems"></param>
/// <param name="userAllowedMenuItems"></param>
/// <returns></returns>
protected void FilterUserAllowedMenuItems(MenuItemCollection menuWithAllItems, IEnumerable<MenuItem> userAllowedMenuItems)
{
var userAllowedActions = userAllowedMenuItems.Where(x => x.Action != null).Select(x => x.Action).ToArray();
var notAllowed = menuWithAllItems.Items.Where(
a => (a.Action != null
&& a.Action.CanBePermissionAssigned
&& (a.Action.CanBePermissionAssigned == false || userAllowedActions.Contains(a.Action) == false)))
.ToArray();
//remove the ones that aren't allowed.
foreach (var m in notAllowed)
{
menuWithAllItems.Items.Remove(m);
}
}
internal IEnumerable<MenuItem> GetAllowedUserMenuItemsForNode(IUmbracoEntity dd)
{
var actions = ActionsResolver.Current.FromActionSymbols(Security.CurrentUser.GetPermissions(dd.Path, Services.UserService))
.ToList();
// A user is allowed to delete their own stuff
if (dd.CreatorId == Security.GetUserId() && actions.Contains(ActionDelete.Instance) == false)
actions.Add(ActionDelete.Instance);
return actions.Select(x => new MenuItem(x));
}
/// <summary>
/// Determins if the user has access to view the node/document
/// </summary>
/// <param name="doc">The Document to check permissions against</param>
/// <param name="allowedUserOptions">A list of MenuItems that the user has permissions to execute on the current document</param>
/// <remarks>By default the user must have Browse permissions to see the node in the Content tree</remarks>
/// <returns></returns>
internal bool CanUserAccessNode(IUmbracoEntity doc, IEnumerable<MenuItem> allowedUserOptions)
{
return allowedUserOptions.Select(x => x.Action).OfType<ActionBrowse>().Any();
}
/// <summary>
/// this will parse the string into either a GUID or INT
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
internal Tuple<Guid?, int?> GetIdentifierFromString(string id)
{
Guid idGuid;
int idInt;
Udi idUdi;
if (Guid.TryParse(id, out idGuid))
{
return new Tuple<Guid?, int?>(idGuid, null);
}
if (int.TryParse(id, out idInt))
{
return new Tuple<Guid?, int?>(null, idInt);
}
if (Udi.TryParse(id, out idUdi))
{
var guidUdi = idUdi as GuidUdi;
if (guidUdi != null)
return new Tuple<Guid?, int?>(guidUdi.Guid, null);
}
return null;
}
/// <summary>
/// Get an entity via an id that can be either an integer, Guid or UDI
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <remarks>
/// This object has it's own contextual cache for these lookups
/// </remarks>
internal IUmbracoEntity GetEntityFromId(string id)
{
return _entityCache.GetOrAdd(id, s =>
{
IUmbracoEntity entity;
Guid idGuid;
int idInt;
Udi idUdi;
if (Guid.TryParse(s, out idGuid))
{
entity = Services.EntityService.GetByKey(idGuid, UmbracoObjectType);
}
else if (int.TryParse(s, out idInt))
{
entity = Services.EntityService.Get(idInt, UmbracoObjectType);
}
else if (Udi.TryParse(s, out idUdi))
{
var guidUdi = idUdi as GuidUdi;
entity = guidUdi != null ? Services.EntityService.GetByKey(guidUdi.Guid, UmbracoObjectType) : null;
}
else
{
return null;
}
return entity;
});
}
private readonly ConcurrentDictionary<string, IUmbracoEntity> _entityCache = new ConcurrentDictionary<string, IUmbracoEntity>();
}
}
| base33/Umbraco-CMS | src/Umbraco.Web/Trees/ContentTreeControllerBase.cs | C# | mit | 18,998 |
#### Scripts
##### SalesforceAskUser
- Updated the Docker image to: *demisto/python:2.7.18.24398*. | demisto/content | Packs/Salesforce/ReleaseNotes/1_1_7.md | Markdown | mit | 99 |
const BaseStep = require('../step');
const EntryProxy = require('../../entry-proxy');
const analyze = require('../../helpers/analytics/analytics')('gst');
// TODO pull below out to (variation) helper
function convertVariationalPath(variations, from, toVariationId) {
const toDir = variations.find(variation => variation.id === toVariationId).dir;
const pattern = new RegExp(`(${variations.map(variation => variation.dir).join('|')})`);
return from.replace(pattern, toDir);
}
function isNodeModule(id) {
return id.indexOf('node_modules') >= 0;
}
class GraphSourceTransform extends BaseStep {
/**
* @param {MendelRegistry} tool.registry
* @param {DepsManager} tool.depsResolver
*/
constructor({registry, cache}, options) {
super();
this._cache = cache;
this._registry = registry;
this._baseVariationId = options.baseConfig.id;
this._variations = options.variationConfig.variations;
this._gsts = [];
this._transforms = options.transforms;
options.types.forEach(type => {
const gsts = type.transforms.filter((transformId) => {
const transform = this._transforms.find(({id}) => id === transformId);
return transform && transform.mode === 'gst';
});
this._gsts = this._gsts.concat(gsts);
});
this._curGstIndex = 0;
this._processed = new Set();
this._virtual = new Set();
this.clear();
this._cache.on('entryRemoved', () => this.clear());
}
clear() {
this._curGstIndex = 0;
this._processed.clear();
this._virtual.forEach(entryId => this._registry.removeEntry(entryId));
this._virtual.clear();
this._canceled = true;
}
addTransform({id, source='', map='', deps={}}) {
// This will add source to the "rawSource" so it does not have to
// go through fs-reader (which should fail as it can be a virtual entry)
this._registry.addTransformedSource({id, source, deps, map});
}
getContext() {
return {
addVirtualEntry: ({source, id, map}) => {
this._virtual.add(id);
// TODO make sure virtual entries can be cleaned up with changes in source entry
this.addTransform({id, source, map});
},
removeEntry: (entry) => {
this._registry.removeEntry(entry.id);
},
};
}
gstDone(entry) {
this._processed.add(entry.id);
if (this._processed.size >= this._cache.size()) {
this._processed.clear();
if (++this._curGstIndex >= this._gsts.length) {
this._cache.entries().forEach(({id}) => {
this.emit('done', {entryId: id});
});
} else {
this._cache.entries().forEach(entry => this.performHelper(entry));
}
}
}
// this is conforming to the steps API
perform(entry) {
this._canceled = false;
if (this._gsts.length <= this._curGstIndex || isNodeModule(entry.id))
return this.gstDone(entry);
this.performHelper(entry);
}
explorePermutation(graph, onPermutation) {
const configVariations = new Set();
this._variations.forEach(variation => configVariations.add(variation.id));
// graph has array of arrays. First, make a pass and gather all variation info
const variations = new Set();
graph.forEach(nodes => {
nodes.forEach(node => {
variations.add(node.variation);
});
});
Array.from(variations.keys())
// Filter out undeclared (in config) variations
.filter(varKey => configVariations.has(varKey))
// We do not yet support multi-variation.
.forEach(variation => {
const chain = graph.map((nodes) => {
return nodes.find(node => node.variation === variation) ||
nodes.find(node => {
return node.variation === this._baseVariationId ||
node.variation === false;
});
});
// In case a new entry is introduced in variations without one
// in the base folder, the main file won't exist.
// In that case, we should not explore the permutation.
if (!chain[0]) return;
onPermutation(chain, variation);
});
}
performHelper(entry) {
const proxy = EntryProxy.getFromEntry(entry);
const currentGstConfig = this._transforms.find(({id}) => id === this._gsts[this._curGstIndex]);
const currentGst = require(currentGstConfig.plugin);
// If no GST is planned for this type, abort.
// If plugin doesn't want to deal with it, abort.
if (this._processed.has(entry.id) || this._virtual.has(entry.id) || !currentGst.predicate(proxy)) {
return this.gstDone(entry);
}
const graph = this._registry.getDependencyGraph(entry.normalizedId, (depEntry) => {
// In fs-change case, we can start over from the ist and
// "deps" can be wrong. We want the ist version in such case.
const dependecyMap = this._curGstIndex === 0 ?
depEntry.istDeps : depEntry.deps;
return Object.keys(dependecyMap).map(literal => {
// FIXME GST can be difference for main and browser.
// The difference can lead to different SHA if done poorly.
// Currently, we just apply main version but browser version
// may be needed. Address this.
return dependecyMap[literal].main;
});
});
this.explorePermutation(graph, (chain, variation) => {
const [main] = chain;
// We need to create proxy for limiting API surface for plugin writers.
const context = this.getContext();
const chainProxy = chain
.filter(Boolean)
.map(dep => EntryProxy.getFromEntry(dep));
const [proxiedMain] = chainProxy;
proxiedMain.filename = convertVariationalPath(
this._variations,
main.id,
variation
);
Promise.resolve()
.then(analyze.tic.bind(analyze, currentGstConfig.id))
.then(() => {
return currentGst.transform(
chainProxy,
currentGstConfig,
context
);
})
.then(analyze.toc.bind(analyze, currentGstConfig.id))
.then(result => {
if (this._canceled) return;
if (result && result.source) {
if (main.variation === variation) {
this.addTransform({
id: proxiedMain.filename,
source: result.source,
map: result.map,
deps: result.deps,
});
} else {
context.addVirtualEntry({
id: proxiedMain.filename,
originatingEntry: entry,
source: result.source,
deps: result.deps,
});
}
}
this.gstDone(main);
})
.catch(error => {
error.message = `Errored while transforming ${main.id}:\n` + error.message;
this.emit('error', {error, id: main.id});
});
});
}
}
module.exports = GraphSourceTransform;
| yahoo/mendel | packages/mendel-pipeline/src/step/gst/index.js | JavaScript | mit | 7,858 |
'use strict';
// MODULES //
var tape = require( 'tape' );
var pow = require( 'math-power' );
var MAX_INT16 = require( './../lib' );
// TESTS //
tape( 'the main export is a number', function test( t ) {
t.ok( true, __filename );
t.equal( typeof MAX_INT16, 'number', 'main export is a number' );
t.end();
});
tape( 'the value equals 2**15 - 1', function test( t ) {
t.equal( MAX_INT16, pow(2,15) - 1, 'equals 2**15 - 1' );
t.end();
});
| const-io/max-int16 | test/test.js | JavaScript | mit | 445 |
/*!
* iScroll v4.1.8 ~ Copyright (c) 2011 Matteo Spinelli, http://cubiq.org
* Released under MIT license, http://cubiq.org/license
*/
(function(){
var m = Math,
vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
(/firefox/i).test(navigator.userAgent) ? 'Moz' :
'opera' in window ? 'O' : '',
// Browser capabilities
has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(),
hasTouch = 'ontouchstart' in window,
hasTransform = vendor + 'Transform' in document.documentElement.style,
isAndroid = (/android/gi).test(navigator.appVersion),
isIDevice = (/iphone|ipad/gi).test(navigator.appVersion),
isPlaybook = (/playbook/gi).test(navigator.appVersion),
hasTransitionEnd = isIDevice || isPlaybook,
nextFrame = (function() {
return window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function(callback) { return setTimeout(callback, 1); }
})(),
cancelFrame = (function () {
return window.cancelRequestAnimationFrame
|| window.webkitCancelRequestAnimationFrame
|| window.mozCancelRequestAnimationFrame
|| window.oCancelRequestAnimationFrame
|| window.msCancelRequestAnimationFrame
|| clearTimeout
})(),
// Events
RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize',
START_EV = hasTouch ? 'touchstart' : 'mousedown',
MOVE_EV = hasTouch ? 'touchmove' : 'mousemove',
END_EV = hasTouch ? 'touchend' : 'mouseup',
CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup',
WHEEL_EV = vendor == 'Moz' ? 'DOMMouseScroll' : 'mousewheel',
// Helpers
trnOpen = 'translate' + (has3d ? '3d(' : '('),
trnClose = has3d ? ',0)' : ')',
// Constructor
iScroll = function (el, options) {
var that = this,
doc = document,
i;
that.wrapper = typeof el == 'object' ? el : doc.getElementById(el);
that.wrapper.style.overflow = 'hidden';
that.scroller = that.wrapper.children[0];
// Default options
that.options = {
hScroll: true,
vScroll: true,
bounce: true,
bounceLock: false,
momentum: true,
lockDirection: true,
useTransform: true,
useTransition: false,
topOffset: 0,
checkDOMChanges: false, // Experimental
// Scrollbar
hScrollbar: true,
vScrollbar: true,
fixedScrollbar: isAndroid,
hideScrollbar: isIDevice,
fadeScrollbar: isIDevice && has3d,
scrollbarClass: '',
// Zoom
zoom: false,
zoomMin: 1,
zoomMax: 4,
doubleTapZoom: 2,
wheelAction: 'scroll',
// Snap
snap: false,
snapThreshold: 1,
// Events
onRefresh: null,
onBeforeScrollStart: function (e) { e.preventDefault(); },
onScrollStart: null,
onBeforeScrollMove: null,
onScrollMove: null,
onBeforeScrollEnd: null,
onScrollEnd: null,
onTouchEnd: null,
onDestroy: null,
onZoomStart: null,
onZoom: null,
onZoomEnd: null,
// Added by Lissa
scrollOffsetLeft: 0,
scrollOffsetTop: 0
};
// User defined options
for (i in options) that.options[i] = options[i];
// Normalize options
that.options.useTransform = hasTransform ? that.options.useTransform : false;
that.options.hScrollbar = that.options.hScroll && that.options.hScrollbar;
that.options.vScrollbar = that.options.vScroll && that.options.vScrollbar;
that.options.zoom = that.options.useTransform && that.options.zoom;
that.options.useTransition = hasTransitionEnd && that.options.useTransition;
// Set some default styles
that.scroller.style[vendor + 'TransitionProperty'] = that.options.useTransform ? '-' + vendor.toLowerCase() + '-transform' : 'top left';
that.scroller.style[vendor + 'TransitionDuration'] = '0';
that.scroller.style[vendor + 'TransformOrigin'] = '0 0';
if (that.options.useTransition) that.scroller.style[vendor + 'TransitionTimingFunction'] = 'cubic-bezier(0.33,0.66,0.66,1)';
if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + '0,0' + trnClose;
else that.scroller.style.cssText += ';position:absolute;top:0;left:0';
if (that.options.useTransition) that.options.fixedScrollbar = true;
that.refresh();
that._bind(RESIZE_EV, window);
that._bind(START_EV);
if (!hasTouch) {
that._bind('mouseout', that.wrapper);
that._bind(WHEEL_EV);
}
if (that.options.checkDOMChanges) that.checkDOMTime = setInterval(function () {
that._checkDOMChanges();
}, 500);
};
// Prototype
iScroll.prototype = {
enabled: true,
x: 0,
y: 0,
steps: [],
scale: 1,
currPageX: 0, currPageY: 0,
pagesX: [], pagesY: [],
aniTime: null,
wheelZoomCount: 0,
handleEvent: function (e) {
var that = this;
switch(e.type) {
case START_EV:
if (!hasTouch && e.button !== 0) return;
that._start(e);
break;
case MOVE_EV: that._move(e); break;
case END_EV:
case CANCEL_EV: that._end(e); break;
case RESIZE_EV: that._resize(); break;
case WHEEL_EV: that._wheel(e); break;
case 'mouseout': that._mouseout(e); break;
case 'webkitTransitionEnd': that._transitionEnd(e); break;
}
},
_checkDOMChanges: function () {
if (this.moved || this.zoomed || this.animating ||
(this.scrollerW == this.scroller.offsetWidth * this.scale && this.scrollerH == this.scroller.offsetHeight * this.scale)) return;
this.refresh();
},
_scrollbar: function (dir) {
var that = this,
doc = document,
bar;
if (!that[dir + 'Scrollbar']) {
if (that[dir + 'ScrollbarWrapper']) {
if (hasTransform) that[dir + 'ScrollbarIndicator'].style[vendor + 'Transform'] = '';
that[dir + 'ScrollbarWrapper'].parentNode.removeChild(that[dir + 'ScrollbarWrapper']);
that[dir + 'ScrollbarWrapper'] = null;
that[dir + 'ScrollbarIndicator'] = null;
}
return;
}
if (!that[dir + 'ScrollbarWrapper']) {
// Create the scrollbar wrapper
bar = doc.createElement('div');
if (that.options.scrollbarClass) bar.className = that.options.scrollbarClass + dir.toUpperCase();
else bar.style.cssText = 'position:absolute;z-index:100;' + (dir == 'h' ? 'height:7px;bottom:1px;left:2px;right:' + (that.vScrollbar ? '7' : '2') + 'px' : 'width:7px;bottom:' + (that.hScrollbar ? '7' : '2') + 'px;top:2px;right:1px');
bar.style.cssText += ';pointer-events:none;-' + vendor + '-transition-property:opacity;-' + vendor + '-transition-duration:' + (that.options.fadeScrollbar ? '350ms' : '0') + ';overflow:hidden;opacity:' + (that.options.hideScrollbar ? '0' : '1');
that.wrapper.appendChild(bar);
that[dir + 'ScrollbarWrapper'] = bar;
// Create the scrollbar indicator
bar = doc.createElement('div');
if (!that.options.scrollbarClass) {
bar.style.cssText = 'position:absolute;z-index:100;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);-' + vendor + '-background-clip:padding-box;-' + vendor + '-box-sizing:border-box;' + (dir == 'h' ? 'height:100%' : 'width:100%') + ';-' + vendor + '-border-radius:3px;border-radius:3px';
}
bar.style.cssText += ';pointer-events:none;-' + vendor + '-transition-property:-' + vendor + '-transform;-' + vendor + '-transition-timing-function:cubic-bezier(0.33,0.66,0.66,1);-' + vendor + '-transition-duration:0;-' + vendor + '-transform:' + trnOpen + '0,0' + trnClose;
if (that.options.useTransition) bar.style.cssText += ';-' + vendor + '-transition-timing-function:cubic-bezier(0.33,0.66,0.66,1)';
that[dir + 'ScrollbarWrapper'].appendChild(bar);
that[dir + 'ScrollbarIndicator'] = bar;
}
if (dir == 'h') {
that.hScrollbarSize = that.hScrollbarWrapper.clientWidth;
that.hScrollbarIndicatorSize = m.max(m.round(that.hScrollbarSize * that.hScrollbarSize / that.scrollerW), 8);
that.hScrollbarIndicator.style.width = that.hScrollbarIndicatorSize + 'px';
that.hScrollbarMaxScroll = that.hScrollbarSize - that.hScrollbarIndicatorSize;
that.hScrollbarProp = that.hScrollbarMaxScroll / that.maxScrollX;
} else {
that.vScrollbarSize = that.vScrollbarWrapper.clientHeight;
that.vScrollbarIndicatorSize = m.max(m.round(that.vScrollbarSize * that.vScrollbarSize / that.scrollerH), 8);
that.vScrollbarIndicator.style.height = that.vScrollbarIndicatorSize + 'px';
that.vScrollbarMaxScroll = that.vScrollbarSize - that.vScrollbarIndicatorSize;
that.vScrollbarProp = that.vScrollbarMaxScroll / that.maxScrollY;
}
// Reset position
that._scrollbarPos(dir, true);
},
_resize: function () {
var that = this;
setTimeout(function () { that.refresh(); }, isAndroid ? 200 : 0);
},
_pos: function (x, y) {
x = this.hScroll ? x : 0;
y = this.vScroll ? y : 0;
if (this.options.useTransform) {
this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
} else {
x = m.round(x);
y = m.round(y);
this.scroller.style.left = x + 'px';
this.scroller.style.top = y + 'px';
}
this.x = x;
this.y = y;
this._scrollbarPos('h');
this._scrollbarPos('v');
},
_scrollbarPos: function (dir, hidden) {
var that = this,
pos = dir == 'h' ? that.x : that.y,
size;
if (!that[dir + 'Scrollbar']) return;
pos = that[dir + 'ScrollbarProp'] * pos;
if (pos < 0) {
if (!that.options.fixedScrollbar) {
size = that[dir + 'ScrollbarIndicatorSize'] + m.round(pos * 3);
if (size < 8) size = 8;
that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
}
pos = 0;
} else if (pos > that[dir + 'ScrollbarMaxScroll']) {
if (!that.options.fixedScrollbar) {
size = that[dir + 'ScrollbarIndicatorSize'] - m.round((pos - that[dir + 'ScrollbarMaxScroll']) * 3);
if (size < 8) size = 8;
that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
pos = that[dir + 'ScrollbarMaxScroll'] + (that[dir + 'ScrollbarIndicatorSize'] - size);
} else {
pos = that[dir + 'ScrollbarMaxScroll'];
}
}
that[dir + 'ScrollbarWrapper'].style[vendor + 'TransitionDelay'] = '0';
that[dir + 'ScrollbarWrapper'].style.opacity = hidden && that.options.hideScrollbar ? '0' : '1';
that[dir + 'ScrollbarIndicator'].style[vendor + 'Transform'] = trnOpen + (dir == 'h' ? pos + 'px,0' : '0,' + pos + 'px') + trnClose;
},
_start: function (e) {
var that = this,
point = hasTouch ? e.touches[0] : e,
matrix, x, y,
c1, c2;
if (!that.enabled) return;
if (that.options.onBeforeScrollStart) that.options.onBeforeScrollStart.call(that, e);
if (that.options.useTransition || that.options.zoom) that._transitionTime(0);
that.moved = false;
that.animating = false;
that.zoomed = false;
that.distX = 0;
that.distY = 0;
that.absDistX = 0;
that.absDistY = 0;
that.dirX = 0;
that.dirY = 0;
// Gesture start
if (that.options.zoom && hasTouch && e.touches.length > 1) {
c1 = m.abs(e.touches[0].pageX-e.touches[1].pageX);
c2 = m.abs(e.touches[0].pageY-e.touches[1].pageY);
that.touchesDistStart = m.sqrt(c1 * c1 + c2 * c2);
that.originX = m.abs(e.touches[0].pageX + e.touches[1].pageX - that.wrapperOffsetLeft * 2) / 2 - that.x;
that.originY = m.abs(e.touches[0].pageY + e.touches[1].pageY - that.wrapperOffsetTop * 2) / 2 - that.y;
if (that.options.onZoomStart) that.options.onZoomStart.call(that, e);
}
if (that.options.momentum) {
if (that.options.useTransform) {
// Very lame general purpose alternative to CSSMatrix
matrix = getComputedStyle(that.scroller, null)[vendor + 'Transform'].replace(/[^0-9-.,]/g, '').split(',');
x = matrix[4] * 1;
y = matrix[5] * 1;
} else {
x = getComputedStyle(that.scroller, null).left.replace(/[^0-9-]/g, '') * 1;
y = getComputedStyle(that.scroller, null).top.replace(/[^0-9-]/g, '') * 1;
}
if (x != that.x || y != that.y) {
if (that.options.useTransition) that._unbind('webkitTransitionEnd');
else cancelFrame(that.aniTime);
that.steps = [];
that._pos(x, y);
}
}
that.absStartX = that.x; // Needed by snap threshold
that.absStartY = that.y;
that.startX = that.x;
that.startY = that.y;
that.pointX = point.pageX;
that.pointY = point.pageY;
that.startTime = e.timeStamp || (new Date()).getTime();
if (that.options.onScrollStart) that.options.onScrollStart.call(that, e);
that._bind(MOVE_EV);
that._bind(END_EV);
that._bind(CANCEL_EV);
},
_move: function (e) {
var that = this,
point = hasTouch ? e.touches[0] : e,
deltaX = point.pageX - that.pointX,
deltaY = point.pageY - that.pointY,
newX = that.x + deltaX,
newY = that.y + deltaY,
c1, c2, scale,
timestamp = e.timeStamp || (new Date()).getTime();
if (that.options.onBeforeScrollMove) that.options.onBeforeScrollMove.call(that, e);
// Zoom
if (that.options.zoom && hasTouch && e.touches.length > 1) {
c1 = m.abs(e.touches[0].pageX - e.touches[1].pageX);
c2 = m.abs(e.touches[0].pageY - e.touches[1].pageY);
that.touchesDist = m.sqrt(c1*c1+c2*c2);
that.zoomed = true;
scale = 1 / that.touchesDistStart * that.touchesDist * this.scale;
if (scale < that.options.zoomMin) scale = 0.5 * that.options.zoomMin * Math.pow(2.0, scale / that.options.zoomMin);
else if (scale > that.options.zoomMax) scale = 2.0 * that.options.zoomMax * Math.pow(0.5, that.options.zoomMax / scale);
that.lastScale = scale / this.scale;
newX = this.originX - this.originX * that.lastScale + this.x,
newY = this.originY - this.originY * that.lastScale + this.y;
this.scroller.style[vendor + 'Transform'] = trnOpen + newX + 'px,' + newY + 'px' + trnClose + ' scale(' + scale + ')';
if (that.options.onZoom) that.options.onZoom.call(that, e);
return;
}
that.pointX = point.pageX;
that.pointY = point.pageY;
// Slow down if outside of the boundaries
if (newX > 0 || newX < that.maxScrollX) {
newX = that.options.bounce ? that.x + (deltaX / 2) : newX >= 0 || that.maxScrollX >= 0 ? 0 : that.maxScrollX;
}
if (newY > that.minScrollY || newY < that.maxScrollY) {
newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= that.minScrollY || that.maxScrollY >= 0 ? that.minScrollY : that.maxScrollY;
}
if (that.absDistX < 6 && that.absDistY < 6) {
that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);
return;
}
// Lock direction
if (that.options.lockDirection) {
if (that.absDistX > that.absDistY + 5) {
newY = that.y;
deltaY = 0;
} else if (that.absDistY > that.absDistX + 5) {
newX = that.x;
deltaX = 0;
}
}
that.moved = true;
that._pos(newX, newY);
that.dirX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
that.dirY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
if (timestamp - that.startTime > 300) {
that.startTime = timestamp;
that.startX = that.x;
that.startY = that.y;
}
if (that.options.onScrollMove) that.options.onScrollMove.call(that, e);
},
_end: function (e) {
if (hasTouch && e.touches.length != 0) return;
var that = this,
point = hasTouch ? e.changedTouches[0] : e,
target, ev,
momentumX = { dist:0, time:0 },
momentumY = { dist:0, time:0 },
duration = (e.timeStamp || (new Date()).getTime()) - that.startTime,
newPosX = that.x,
newPosY = that.y,
distX, distY,
newDuration,
snap,
scale;
that._unbind(MOVE_EV);
that._unbind(END_EV);
that._unbind(CANCEL_EV);
if (that.options.onBeforeScrollEnd) that.options.onBeforeScrollEnd.call(that, e);
if (that.zoomed) {
scale = that.scale * that.lastScale;
scale = Math.max(that.options.zoomMin, scale);
scale = Math.min(that.options.zoomMax, scale);
that.lastScale = scale / that.scale;
that.scale = scale;
that.x = that.originX - that.originX * that.lastScale + that.x;
that.y = that.originY - that.originY * that.lastScale + that.y;
that.scroller.style[vendor + 'TransitionDuration'] = '200ms';
that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose + ' scale(' + that.scale + ')';
that.zoomed = false;
that.refresh();
if (that.options.onZoomEnd) that.options.onZoomEnd.call(that, e);
return;
}
if (!that.moved) {
if (hasTouch) {
if (that.doubleTapTimer && that.options.zoom) {
// Double tapped
clearTimeout(that.doubleTapTimer);
that.doubleTapTimer = null;
if (that.options.onZoomStart) that.options.onZoomStart.call(that, e);
that.zoom(that.pointX, that.pointY, that.scale == 1 ? that.options.doubleTapZoom : 1);
if (that.options.onZoomEnd) {
setTimeout(function() {
that.options.onZoomEnd.call(that, e);
}, 200); // 200 is default zoom duration
}
} else {
that.doubleTapTimer = setTimeout(function () {
that.doubleTapTimer = null;
// Find the last touched element
target = point.target;
while (target.nodeType != 1) target = target.parentNode;
if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
ev = document.createEvent('MouseEvents');
ev.initMouseEvent('click', true, true, e.view, 1,
point.screenX, point.screenY, point.clientX, point.clientY,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
0, null);
ev._fake = true;
target.dispatchEvent(ev);
}
}, that.options.zoom ? 250 : 0);
}
}
that._resetPos(200);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
}
if (duration < 300 && that.options.momentum) {
momentumX = newPosX ? that._momentum(newPosX - that.startX, duration, -that.x, that.scrollerW - that.wrapperW + that.x, that.options.bounce ? that.wrapperW : 0) : momentumX;
momentumY = newPosY ? that._momentum(newPosY - that.startY, duration, -that.y, (that.maxScrollY < 0 ? that.scrollerH - that.wrapperH + that.y - that.minScrollY : 0), that.options.bounce ? that.wrapperH : 0) : momentumY;
newPosX = that.x + momentumX.dist;
newPosY = that.y + momentumY.dist;
if ((that.x > 0 && newPosX > 0) || (that.x < that.maxScrollX && newPosX < that.maxScrollX)) momentumX = { dist:0, time:0 };
if ((that.y > that.minScrollY && newPosY > that.minScrollY) || (that.y < that.maxScrollY && newPosY < that.maxScrollY)) momentumY = { dist:0, time:0 };
}
if (momentumX.dist || momentumY.dist) {
newDuration = m.max(m.max(momentumX.time, momentumY.time), 10);
// Do we need to snap?
if (that.options.snap) {
distX = newPosX - that.absStartX;
distY = newPosY - that.absStartY;
if (m.abs(distX) < that.options.snapThreshold && m.abs(distY) < that.options.snapThreshold) { that.scrollTo(that.absStartX, that.absStartY, 200); }
else {
snap = that._snap(newPosX, newPosY);
newPosX = snap.x;
newPosY = snap.y;
newDuration = m.max(snap.time, newDuration);
}
}
that.scrollTo(newPosX, newPosY, newDuration);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
}
// Do we need to snap?
if (that.options.snap) {
distX = newPosX - that.absStartX;
distY = newPosY - that.absStartY;
if (m.abs(distX) < that.options.snapThreshold && m.abs(distY) < that.options.snapThreshold) that.scrollTo(that.absStartX, that.absStartY, 200);
else {
snap = that._snap(that.x, that.y);
if (snap.x != that.x || snap.y != that.y) that.scrollTo(snap.x, snap.y, snap.time);
}
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
}
that._resetPos(200);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
},
_resetPos: function (time) {
var that = this,
resetX = that.x >= 0 ? 0 : that.x < that.maxScrollX ? that.maxScrollX : that.x,
resetY = that.y >= that.minScrollY || that.maxScrollY > 0 ? that.minScrollY : that.y < that.maxScrollY ? that.maxScrollY : that.y;
if (resetX == that.x && resetY == that.y) {
if (that.moved) {
that.moved = false;
if (that.options.onScrollEnd) that.options.onScrollEnd.call(that); // Execute custom code on scroll end
}
/*
if (that.hScrollbar && that.options.hideScrollbar) {
if (vendor == 'webkit') that.hScrollbarWrapper.style[vendor + 'TransitionDelay'] = '300ms';
that.hScrollbarWrapper.style.opacity = '0';
}
if (that.vScrollbar && that.options.hideScrollbar) {
if (vendor == 'webkit') that.vScrollbarWrapper.style[vendor + 'TransitionDelay'] = '300ms';
that.vScrollbarWrapper.style.opacity = '0';
}
*/
return;
}
that.scrollTo(resetX, resetY, time || 0);
},
_wheel: function (e) {
var that = this,
wheelDeltaX, wheelDeltaY,
deltaX, deltaY,
deltaScale;
if ('wheelDeltaX' in e) {
wheelDeltaX = e.wheelDeltaX / 12;
wheelDeltaY = e.wheelDeltaY / 12;
} else if ('detail' in e) {
wheelDeltaX = wheelDeltaY = -e.detail * 3;
} else {
wheelDeltaX = wheelDeltaY = -e.wheelDelta;
}
if (that.options.wheelAction == 'zoom') {
deltaScale = that.scale * Math.pow(2, 1/3 * (wheelDeltaY ? wheelDeltaY / Math.abs(wheelDeltaY) : 0));
if (deltaScale < that.options.zoomMin) deltaScale = that.options.zoomMin;
if (deltaScale > that.options.zoomMax) deltaScale = that.options.zoomMax;
if (deltaScale != that.scale) {
if (!that.wheelZoomCount && that.options.onZoomStart) that.options.onZoomStart.call(that, e);
that.wheelZoomCount++;
that.zoom(e.pageX, e.pageY, deltaScale, 400);
setTimeout(function() {
that.wheelZoomCount--;
if (!that.wheelZoomCount && that.options.onZoomEnd) that.options.onZoomEnd.call(that, e);
}, 400);
}
return;
}
deltaX = that.x + wheelDeltaX;
deltaY = that.y + wheelDeltaY;
if (deltaX > 0) deltaX = 0;
else if (deltaX < that.maxScrollX) deltaX = that.maxScrollX;
if (deltaY > that.minScrollY) deltaY = that.minScrollY;
else if (deltaY < that.maxScrollY) deltaY = that.maxScrollY;
that.scrollTo(deltaX, deltaY, 0);
},
_mouseout: function (e) {
var t = e.relatedTarget;
if (!t) {
this._end(e);
return;
}
while (t = t.parentNode) if (t == this.wrapper) return;
this._end(e);
},
_transitionEnd: function (e) {
var that = this;
if (e.target != that.scroller) return;
that._unbind('webkitTransitionEnd');
that._startAni();
},
/**
*
* Utilities
*
*/
_startAni: function () {
var that = this,
startX = that.x, startY = that.y,
startTime = (new Date).getTime(),
step, easeOut;
if (that.animating) return;
if (!that.steps.length) {
that._resetPos(400);
return;
}
step = that.steps.shift();
if (step.x == startX && step.y == startY) step.time = 0;
that.animating = true;
that.moved = true;
if (that.options.useTransition) {
that._transitionTime(step.time);
that._pos(step.x, step.y);
that.animating = false;
if (step.time) that._bind('webkitTransitionEnd');
else that._resetPos(0);
return;
}
(function animate () {
var now = (new Date).getTime(),
newX, newY;
if (now >= startTime + step.time) {
that._pos(step.x, step.y);
that.animating = false;
if (that.options.onAnimationEnd) that.options.onAnimationEnd.call(that); // Execute custom code on animation end
that._startAni();
return;
}
now = (now - startTime) / step.time - 1;
easeOut = m.sqrt(1 - now * now);
newX = (step.x - startX) * easeOut + startX;
newY = (step.y - startY) * easeOut + startY;
that._pos(newX, newY);
if (that.animating) that.aniTime = nextFrame(animate);
})();
},
_transitionTime: function (time) {
time += 'ms';
this.scroller.style[vendor + 'TransitionDuration'] = time;
if (this.hScrollbar) this.hScrollbarIndicator.style[vendor + 'TransitionDuration'] = time;
if (this.vScrollbar) this.vScrollbarIndicator.style[vendor + 'TransitionDuration'] = time;
},
_momentum: function (dist, time, maxDistUpper, maxDistLower, size) {
var deceleration = 0.0006,
speed = m.abs(dist) / time,
newDist = (speed * speed) / (2 * deceleration),
newTime = 0, outsideDist = 0;
// Proportinally reduce speed if we are outside of the boundaries
if (dist > 0 && newDist > maxDistUpper) {
outsideDist = size / (6 / (newDist / speed * deceleration));
maxDistUpper = maxDistUpper + outsideDist;
speed = speed * maxDistUpper / newDist;
newDist = maxDistUpper;
} else if (dist < 0 && newDist > maxDistLower) {
outsideDist = size / (6 / (newDist / speed * deceleration));
maxDistLower = maxDistLower + outsideDist;
speed = speed * maxDistLower / newDist;
newDist = maxDistLower;
}
newDist = newDist * (dist < 0 ? -1 : 1);
newTime = speed / deceleration;
return { dist: newDist, time: m.round(newTime) };
},
_offset: function (el) {
var left = -el.offsetLeft,
top = -el.offsetTop;
while (el = el.offsetParent) {
left -= el.offsetLeft;
top -= el.offsetTop;
}
if (el != this.wrapper) {
left *= this.scale;
top *= this.scale;
}
return { left: left, top: top };
},
_snap: function (x, y) {
var that = this,
i, l,
page, time,
sizeX, sizeY;
// Check page X
page = that.pagesX.length - 1;
for (i=0, l=that.pagesX.length; i<l; i++) {
if (x >= that.pagesX[i]) {
page = i;
break;
}
}
if (page == that.currPageX && page > 0 && that.dirX < 0) page--;
x = that.pagesX[page];
sizeX = m.abs(x - that.pagesX[that.currPageX]);
sizeX = sizeX ? m.abs(that.x - x) / sizeX * 500 : 0;
that.currPageX = page;
// Check page Y
page = that.pagesY.length-1;
for (i=0; i<page; i++) {
if (y >= that.pagesY[i]) {
page = i;
break;
}
}
if (page == that.currPageY && page > 0 && that.dirY < 0) page--;
y = that.pagesY[page];
sizeY = m.abs(y - that.pagesY[that.currPageY]);
sizeY = sizeY ? m.abs(that.y - y) / sizeY * 500 : 0;
that.currPageY = page;
// Snap with constant speed (proportional duration)
time = m.round(m.max(sizeX, sizeY)) || 200;
return { x: x, y: y, time: time };
},
_bind: function (type, el, bubble) {
(el || this.scroller).addEventListener(type, this, !!bubble);
},
_unbind: function (type, el, bubble) {
(el || this.scroller).removeEventListener(type, this, !!bubble);
},
/**
*
* Public methods
*
*/
destroy: function () {
var that = this;
that.scroller.style[vendor + 'Transform'] = '';
// Remove the scrollbars
that.hScrollbar = false;
that.vScrollbar = false;
that._scrollbar('h');
that._scrollbar('v');
// Remove the event listeners
that._unbind(RESIZE_EV, window);
that._unbind(START_EV);
that._unbind(MOVE_EV);
that._unbind(END_EV);
that._unbind(CANCEL_EV);
if (that.options.hasTouch) {
that._unbind('mouseout', that.wrapper);
that._unbind(WHEEL_EV);
}
if (that.options.useTransition) that._unbind('webkitTransitionEnd');
if (that.options.checkDOMChanges) clearInterval(that.checkDOMTime);
if (that.options.onDestroy) that.options.onDestroy.call(that);
},
refresh: function () {
var that = this,
offset,
i, l,
els,
pos = 0,
page = 0;
if (that.scale < that.options.zoomMin) that.scale = that.options.zoomMin;
that.wrapperW = that.wrapper.clientWidth || 1;
that.wrapperH = that.wrapper.clientHeight || 1;
that.minScrollY = -that.options.topOffset || 0;
that.scrollerW = m.round(that.scroller.offsetWidth * that.scale);
that.scrollerH = m.round((that.scroller.offsetHeight + that.minScrollY) * that.scale);
that.maxScrollX = that.wrapperW - that.scrollerW;
that.maxScrollY = that.wrapperH - that.scrollerH + that.minScrollY;
that.dirX = 0;
that.dirY = 0;
if (that.options.onRefresh) that.options.onRefresh.call(that);
that.hScroll = that.options.hScroll && that.maxScrollX < 0;
that.vScroll = that.options.vScroll && (!that.options.bounceLock && !that.hScroll || that.scrollerH > that.wrapperH);
that.hScrollbar = that.hScroll && that.options.hScrollbar;
that.vScrollbar = that.vScroll && that.options.vScrollbar && that.scrollerH > that.wrapperH;
offset = that._offset(that.wrapper);
that.wrapperOffsetLeft = -offset.left;
that.wrapperOffsetTop = -offset.top;
// Prepare snap
if (typeof that.options.snap == 'string') {
that.pagesX = [];
that.pagesY = [];
els = that.scroller.querySelectorAll(that.options.snap);
for (i=0, l=els.length; i<l; i++) {
pos = that._offset(els[i]);
pos.left += that.wrapperOffsetLeft;
pos.top += that.wrapperOffsetTop;
that.pagesX[i] = pos.left < that.maxScrollX ? that.maxScrollX : pos.left * that.scale;
that.pagesY[i] = pos.top < that.maxScrollY ? that.maxScrollY : pos.top * that.scale;
}
} else if (that.options.snap) {
that.pagesX = [];
while (pos >= that.maxScrollX) {
that.pagesX[page] = pos;
pos = pos - that.wrapperW;
page++;
}
if (that.maxScrollX%that.wrapperW) that.pagesX[that.pagesX.length] = that.maxScrollX - that.pagesX[that.pagesX.length-1] + that.pagesX[that.pagesX.length-1];
pos = 0;
page = 0;
that.pagesY = [];
while (pos >= that.maxScrollY) {
that.pagesY[page] = pos;
pos = pos - that.wrapperH;
page++;
}
if (that.maxScrollY%that.wrapperH) that.pagesY[that.pagesY.length] = that.maxScrollY - that.pagesY[that.pagesY.length-1] + that.pagesY[that.pagesY.length-1];
}
// Prepare the scrollbars
that._scrollbar('h');
that._scrollbar('v');
if (!that.zoomed) {
that.scroller.style[vendor + 'TransitionDuration'] = '0';
that._resetPos(200);
}
},
scrollTo: function (x, y, time, relative) {
var that = this,
step = x,
i, l;
that.stop();
if (!step.length) step = [{ x: x, y: y, time: time, relative: relative }];
for (i=0, l=step.length; i<l; i++) {
if (step[i].relative) { step[i].x = that.x - step[i].x; step[i].y = that.y - step[i].y; }
that.steps.push({ x: step[i].x, y: step[i].y, time: step[i].time || 0 });
}
that._startAni();
},
scrollToElement: function (el, time) {
var that = this, pos;
el = el.nodeType ? el : that.scroller.querySelector(el);
if (!el) return;
pos = that._offset(el);
pos.left += that.wrapperOffsetLeft;
pos.top += that.wrapperOffsetTop;
pos.left = pos.left > 0 ? 0 : pos.left < that.maxScrollX ? that.maxScrollX : pos.left;
pos.top = pos.top > that.minScrollY ? that.minScrollY : pos.top < that.maxScrollY ? that.maxScrollY : pos.top;
time = time === undefined ? m.max(m.abs(pos.left)*2, m.abs(pos.top)*2) : time;
// Added for scroll offset by Lissa
pos.left -= that.options.scrollOffsetLeft;
pos.top -= that.options.scrollOffsetTop;
that.scrollTo(pos.left, pos.top, time);
},
scrollToPage: function (pageX, pageY, time) {
var that = this, x, y;
if (that.options.snap) {
pageX = pageX == 'next' ? that.currPageX+1 : pageX == 'prev' ? that.currPageX-1 : pageX;
pageY = pageY == 'next' ? that.currPageY+1 : pageY == 'prev' ? that.currPageY-1 : pageY;
pageX = pageX < 0 ? 0 : pageX > that.pagesX.length-1 ? that.pagesX.length-1 : pageX;
pageY = pageY < 0 ? 0 : pageY > that.pagesY.length-1 ? that.pagesY.length-1 : pageY;
that.currPageX = pageX;
that.currPageY = pageY;
x = that.pagesX[pageX];
y = that.pagesY[pageY];
} else {
x = -that.wrapperW * pageX;
y = -that.wrapperH * pageY;
if (x < that.maxScrollX) x = that.maxScrollX;
if (y < that.maxScrollY) y = that.maxScrollY;
}
that.scrollTo(x, y, time || 400);
},
disable: function () {
this.stop();
this._resetPos(0);
this.enabled = false;
// If disabled after touchstart we make sure that there are no left over events
this._unbind(MOVE_EV);
this._unbind(END_EV);
this._unbind(CANCEL_EV);
},
enable: function () {
this.enabled = true;
},
stop: function () {
if (this.options.useTransition) this._unbind('webkitTransitionEnd');
else cancelFrame(this.aniTime);
this.steps = [];
this.moved = false;
this.animating = false;
},
zoom: function (x, y, scale, time) {
var that = this,
relScale = scale / that.scale;
if (!that.options.useTransform) return;
that.zoomed = true;
time = time === undefined ? 200 : time;
x = x - that.wrapperOffsetLeft - that.x;
y = y - that.wrapperOffsetTop - that.y;
that.x = x - x * relScale + that.x;
that.y = y - y * relScale + that.y;
that.scale = scale;
that.refresh();
that.x = that.x > 0 ? 0 : that.x < that.maxScrollX ? that.maxScrollX : that.x;
that.y = that.y > that.minScrollY ? that.minScrollY : that.y < that.maxScrollY ? that.maxScrollY : that.y;
that.scroller.style[vendor + 'TransitionDuration'] = time + 'ms';
that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose + ' scale(' + scale + ')';
that.zoomed = false;
},
isReady: function () {
return !this.moved && !this.zoomed && !this.animating;
}
};
if (typeof exports !== 'undefined') exports.iScroll = iScroll;
else window.iScroll = iScroll;
})();
| brunokoga/pathfinder-markdown | prd_original/include/iscroll.js | JavaScript | mit | 32,876 |
<div class="header">
<i class="fa fa-angle-left" ng-click="previous()"></i>
<span>{{month.format("MMMM, YYYY")}}</span>
<i class="fa fa-angle-right" ng-click="next()"></i>
</div>
<div class="week">
<span class="day">Sun</span>
<span class="day">Mon</span>
<span class="day">Tue</span>
<span class="day">Wed</span>
<span class="day">Thu</span>
<span class="day">Fri</span>
<span class="day">Sat</span>
</div>
<div class="week" ng-repeat="week in weeks">
<span class="day" ng-class="{ today: day.isToday, 'different-month': !day.isCurrentMonth, selected: day.date.isSame(selected) }" ng-click="select(day)" ng-repeat="day in week.days">{{day.number}}</span>
</div> | chrisharrington/traque | public/directives/calendar.html | HTML | mit | 706 |
<?php
/**
* Part of the Fuel framework.
*
* @package Fuel
* @version 1.6
* @author Fuel Development Team
* @license MIT License
* @copyright 2010 - 2013 Fuel Development Team
* @link http://fuelphp.com
*/
namespace Fuel\Core;
/**
* The Arr class provides a few nice functions for making
* dealing with arrays easier
*
* @package Fuel
* @subpackage Core
*/
class Arr
{
/**
* Gets a dot-notated key from an array, with a default value if it does
* not exist.
*
* @param array $array The search array
* @param mixed $key The dot-notated key or array of keys
* @param string $default The default value
* @return mixed
*/
public static function get($array, $key, $default = null)
{
if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
{
throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
if (is_null($key))
{
return $array;
}
if (is_array($key))
{
$return = array();
foreach ($key as $k)
{
$return[$k] = static::get($array, $k, $default);
}
return $return;
}
foreach (explode('.', $key) as $key_part)
{
if (($array instanceof \ArrayAccess and isset($array[$key_part])) === false)
{
if ( ! is_array($array) or ! array_key_exists($key_part, $array))
{
return \Fuel::value($default);
}
}
$array = $array[$key_part];
}
return $array;
}
/**
* Set an array item (dot-notated) to the value.
*
* @param array $array The array to insert it into
* @param mixed $key The dot-notated key to set or array of keys
* @param mixed $value The value
* @return void
*/
public static function set(&$array, $key, $value = null)
{
if (is_null($key))
{
$array = $value;
return;
}
if (is_array($key))
{
foreach ($key as $k => $v)
{
static::set($array, $k, $v);
}
}
else
{
$keys = explode('.', $key);
while (count($keys) > 1)
{
$key = array_shift($keys);
if ( ! isset($array[$key]) or ! is_array($array[$key]))
{
$array[$key] = array();
}
$array =& $array[$key];
}
$array[array_shift($keys)] = $value;
}
}
/**
* Pluck an array of values from an array.
*
* @param array $array collection of arrays to pluck from
* @param string $key key of the value to pluck
* @param string $index optional return array index key, true for original index
* @return array array of plucked values
*/
public static function pluck($array, $key, $index = null)
{
$return = array();
$get_deep = strpos($key, '.') !== false;
if ( ! $index)
{
foreach ($array as $i => $a)
{
$return[] = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$key} :
($get_deep ? static::get($a, $key) : $a[$key]);
}
}
else
{
foreach ($array as $i => $a)
{
$index !== true and $i = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$index} : $a[$index];
$return[$i] = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$key} :
($get_deep ? static::get($a, $key) : $a[$key]);
}
}
return $return;
}
/**
* Array_key_exists with a dot-notated key from an array.
*
* @param array $array The search array
* @param mixed $key The dot-notated key or array of keys
* @return mixed
*/
public static function key_exists($array, $key)
{
foreach (explode('.', $key) as $key_part)
{
if ( ! is_array($array) or ! array_key_exists($key_part, $array))
{
return false;
}
$array = $array[$key_part];
}
return true;
}
/**
* Unsets dot-notated key from an array
*
* @param array $array The search array
* @param mixed $key The dot-notated key or array of keys
* @return mixed
*/
public static function delete(&$array, $key)
{
if (is_null($key))
{
return false;
}
if (is_array($key))
{
$return = array();
foreach ($key as $k)
{
$return[$k] = static::delete($array, $k);
}
return $return;
}
$key_parts = explode('.', $key);
if ( ! is_array($array) or ! array_key_exists($key_parts[0], $array))
{
return false;
}
$this_key = array_shift($key_parts);
if ( ! empty($key_parts))
{
$key = implode('.', $key_parts);
return static::delete($array[$this_key], $key);
}
else
{
unset($array[$this_key]);
}
return true;
}
/**
* Converts a multi-dimensional associative array into an array of key => values with the provided field names
*
* @param array $assoc the array to convert
* @param string $key_field the field name of the key field
* @param string $val_field the field name of the value field
* @return array
* @throws \InvalidArgumentException
*/
public static function assoc_to_keyval($assoc, $key_field, $val_field)
{
if ( ! is_array($assoc) and ! $assoc instanceof \Iterator)
{
throw new \InvalidArgumentException('The first parameter must be an array.');
}
$output = array();
foreach ($assoc as $row)
{
if (isset($row[$key_field]) and isset($row[$val_field]))
{
$output[$row[$key_field]] = $row[$val_field];
}
}
return $output;
}
/**
* Converts the given 1 dimensional non-associative array to an associative
* array.
*
* The array given must have an even number of elements or null will be returned.
*
* Arr::to_assoc(array('foo','bar'));
*
* @param string $arr the array to change
* @return array|null the new array or null
* @throws \BadMethodCallException
*/
public static function to_assoc($arr)
{
if (($count = count($arr)) % 2 > 0)
{
throw new \BadMethodCallException('Number of values in to_assoc must be even.');
}
$keys = $vals = array();
for ($i = 0; $i < $count - 1; $i += 2)
{
$keys[] = array_shift($arr);
$vals[] = array_shift($arr);
}
return array_combine($keys, $vals);
}
/**
* Checks if the given array is an assoc array.
*
* @param array $arr the array to check
* @return bool true if its an assoc array, false if not
*/
public static function is_assoc($arr)
{
if ( ! is_array($arr))
{
throw new \InvalidArgumentException('The parameter must be an array.');
}
$counter = 0;
foreach ($arr as $key => $unused)
{
if ( ! is_int($key) or $key !== $counter++)
{
return true;
}
}
return false;
}
/**
* Flattens a multi-dimensional associative array down into a 1 dimensional
* associative array.
*
* @param array the array to flatten
* @param string what to glue the keys together with
* @param bool whether to reset and start over on a new array
* @param bool whether to flatten only associative array's, or also indexed ones
* @return array
*/
public static function flatten($array, $glue = ':', $reset = true, $indexed = true)
{
static $return = array();
static $curr_key = array();
if ($reset)
{
$return = array();
$curr_key = array();
}
foreach ($array as $key => $val)
{
$curr_key[] = $key;
if (is_array($val) and ($indexed or array_values($val) !== $val))
{
static::flatten_assoc($val, $glue, false);
}
else
{
$return[implode($glue, $curr_key)] = $val;
}
array_pop($curr_key);
}
return $return;
}
/**
* Flattens a multi-dimensional associative array down into a 1 dimensional
* associative array.
*
* @param array the array to flatten
* @param string what to glue the keys together with
* @param bool whether to reset and start over on a new array
* @return array
*/
public static function flatten_assoc($array, $glue = ':', $reset = true)
{
return static::flatten($array, $glue, $reset, false);
}
/**
* Reverse a flattened array in its original form.
*
* @param array $array flattened array
* @param string $glue glue used in flattening
* @return array the unflattened array
*/
public static function reverse_flatten($array, $glue = ':')
{
$return = array();
foreach ($array as $key => $value)
{
if (stripos($key, $glue) !== false)
{
$keys = explode($glue, $key);
$temp =& $return;
while (count($keys) > 1)
{
$key = array_shift($keys);
$key = is_numeric($key) ? (int) $key : $key;
if ( ! isset($temp[$key]) or ! is_array($temp[$key]))
{
$temp[$key] = array();
}
$temp =& $temp[$key];
}
$key = array_shift($keys);
$key = is_numeric($key) ? (int) $key : $key;
$temp[$key] = $value;
}
else
{
$key = is_numeric($key) ? (int) $key : $key;
$return[$key] = $value;
}
}
return $return;
}
/**
* Filters an array on prefixed associative keys.
*
* @param array the array to filter.
* @param string prefix to filter on.
* @param bool whether to remove the prefix.
* @return array
*/
public static function filter_prefixed($array, $prefix, $remove_prefix = true)
{
$return = array();
foreach ($array as $key => $val)
{
if (preg_match('/^'.$prefix.'/', $key))
{
if ($remove_prefix === true)
{
$key = preg_replace('/^'.$prefix.'/','',$key);
}
$return[$key] = $val;
}
}
return $return;
}
/**
* Recursive version of PHP's array_filter()
*
* @param array the array to filter.
* @param callback the callback that determines whether or not a value is filtered
* @return array
*/
public static function filter_recursive($array, $callback = null)
{
foreach ($array as &$value)
{
if (is_array($value))
{
$value = $callback === null ? static::filter_recursive($value) : static::filter_recursive($value, $callback);
}
}
return $callback === null ? array_filter($array) : array_filter($array, $callback);
}
/**
* Removes items from an array that match a key prefix.
*
* @param array the array to remove from
* @param string prefix to filter on
* @return array
*/
public static function remove_prefixed($array, $prefix)
{
foreach ($array as $key => $val)
{
if (preg_match('/^'.$prefix.'/', $key))
{
unset($array[$key]);
}
}
return $array;
}
/**
* Filters an array on suffixed associative keys.
*
* @param array the array to filter.
* @param string suffix to filter on.
* @param bool whether to remove the suffix.
* @return array
*/
public static function filter_suffixed($array, $suffix, $remove_suffix = true)
{
$return = array();
foreach ($array as $key => $val)
{
if (preg_match('/'.$suffix.'$/', $key))
{
if ($remove_suffix === true)
{
$key = preg_replace('/'.$suffix.'$/','',$key);
}
$return[$key] = $val;
}
}
return $return;
}
/**
* Removes items from an array that match a key suffix.
*
* @param array the array to remove from
* @param string suffix to filter on
* @return array
*/
public static function remove_suffixed($array, $suffix)
{
foreach ($array as $key => $val)
{
if (preg_match('/'.$suffix.'$/', $key))
{
unset($array[$key]);
}
}
return $array;
}
/**
* Filters an array by an array of keys
*
* @param array the array to filter.
* @param array the keys to filter
* @param bool if true, removes the matched elements.
* @return array
*/
public static function filter_keys($array, $keys, $remove = false)
{
$return = array();
foreach ($keys as $key)
{
if (array_key_exists($key, $array))
{
$remove or $return[$key] = $array[$key];
if($remove)
{
unset($array[$key]);
}
}
}
return $remove ? $array : $return;
}
/**
* Insert value(s) into an array, mostly an array_splice alias
* WARNING: original array is edited by reference, only boolean success is returned
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param int the numeric position at which to insert, negative to count from the end backwards
* @return bool false when array shorter then $pos, otherwise true
*/
public static function insert(array &$original, $value, $pos)
{
if (count($original) < abs($pos))
{
\Error::notice('Position larger than number of elements in array in which to insert.');
return false;
}
array_splice($original, $pos, 0, $value);
return true;
}
/**
* Insert value(s) into an array, mostly an array_splice alias
* WARNING: original array is edited by reference, only boolean success is returned
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param int the numeric position at which to insert, negative to count from the end backwards
* @return bool false when array shorter then $pos, otherwise true
*/
public static function insert_assoc(array &$original, array $values, $pos)
{
if (count($original) < abs($pos))
{
return false;
}
$original = array_slice($original, 0, $pos, true) + $values + array_slice($original, $pos, null, true);
return true;
}
/**
* Insert value(s) into an array before a specific key
* WARNING: original array is edited by reference, only boolean success is returned
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param string|int the key before which to insert
* @param bool wether the input is an associative array
* @return bool false when key isn't found in the array, otherwise true
*/
public static function insert_before_key(array &$original, $value, $key, $is_assoc = false)
{
$pos = array_search($key, array_keys($original));
if ($pos === false)
{
\Error::notice('Unknown key before which to insert the new value into the array.');
return false;
}
return $is_assoc ? static::insert_assoc($original, $value, $pos) : static::insert($original, $value, $pos);
}
/**
* Insert value(s) into an array after a specific key
* WARNING: original array is edited by reference, only boolean success is returned
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param string|int the key after which to insert
* @param bool wether the input is an associative array
* @return bool false when key isn't found in the array, otherwise true
*/
public static function insert_after_key(array &$original, $value, $key, $is_assoc = false)
{
$pos = array_search($key, array_keys($original));
if ($pos === false)
{
\Error::notice('Unknown key after which to insert the new value into the array.');
return false;
}
return $is_assoc ? static::insert_assoc($original, $value, $pos + 1) : static::insert($original, $value, $pos + 1);
}
/**
* Insert value(s) into an array after a specific value (first found in array)
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param string|int the value after which to insert
* @param bool wether the input is an associative array
* @return bool false when value isn't found in the array, otherwise true
*/
public static function insert_after_value(array &$original, $value, $search, $is_assoc = false)
{
$key = array_search($search, $original);
if ($key === false)
{
\Error::notice('Unknown value after which to insert the new value into the array.');
return false;
}
return static::insert_after_key($original, $value, $key, $is_assoc);
}
/**
* Insert value(s) into an array before a specific value (first found in array)
*
* @param array the original array (by reference)
* @param array|mixed the value(s) to insert, if you want to insert an array it needs to be in an array itself
* @param string|int the value after which to insert
* @param bool wether the input is an associative array
* @return bool false when value isn't found in the array, otherwise true
*/
public static function insert_before_value(array &$original, $value, $search, $is_assoc = false)
{
$key = array_search($search, $original);
if ($key === false)
{
\Error::notice('Unknown value before which to insert the new value into the array.');
return false;
}
return static::insert_before_key($original, $value, $key, $is_assoc);
}
/**
* Sorts a multi-dimensional array by it's values.
*
* @access public
* @param array The array to fetch from
* @param string The key to sort by
* @param string The order (asc or desc)
* @param int The php sort type flag
* @return array
*/
public static function sort($array, $key, $order = 'asc', $sort_flags = SORT_REGULAR)
{
if ( ! is_array($array))
{
throw new \InvalidArgumentException('Arr::sort() - $array must be an array.');
}
if (empty($array))
{
return $array;
}
foreach ($array as $k => $v)
{
$b[$k] = static::get($v, $key);
}
switch ($order)
{
case 'asc':
asort($b, $sort_flags);
break;
case 'desc':
arsort($b, $sort_flags);
break;
default:
throw new \InvalidArgumentException('Arr::sort() - $order must be asc or desc.');
break;
}
foreach ($b as $key => $val)
{
$c[] = $array[$key];
}
return $c;
}
/**
* Sorts an array on multitiple values, with deep sorting support.
*
* @param array $array collection of arrays/objects to sort
* @param array $conditions sorting conditions
* @param bool @ignore_case wether to sort case insensitive
*/
public static function multisort($array, $conditions, $ignore_case = false)
{
$temp = array();
$keys = array_keys($conditions);
foreach($keys as $key)
{
$temp[$key] = static::pluck($array, $key, true);
is_array($conditions[$key]) or $conditions[$key] = array($conditions[$key]);
}
$args = array();
foreach ($keys as $key)
{
$args[] = $ignore_case ? array_map('strtolower', $temp[$key]) : $temp[$key];
foreach($conditions[$key] as $flag)
{
$args[] = $flag;
}
}
$args[] = &$array;
call_user_func_array('array_multisort', $args);
return $array;
}
/**
* Find the average of an array
*
* @param array the array containing the values
* @return numeric the average value
*/
public static function average($array)
{
// No arguments passed, lets not divide by 0
if ( ! ($count = count($array)) > 0)
{
return 0;
}
return (array_sum($array) / $count);
}
/**
* Replaces key names in an array by names in $replace
*
* @param array the array containing the key/value combinations
* @param array|string key to replace or array containing the replacement keys
* @param string the replacement key
* @return array the array with the new keys
*/
public static function replace_key($source, $replace, $new_key = null)
{
if(is_string($replace))
{
$replace = array($replace => $new_key);
}
if ( ! is_array($source) or ! is_array($replace))
{
throw new \InvalidArgumentException('Arr::replace_key() - $source must an array. $replace must be an array or string.');
}
$result = array();
foreach ($source as $key => $value)
{
if (array_key_exists($key, $replace))
{
$result[$replace[$key]] = $value;
}
else
{
$result[$key] = $value;
}
}
return $result;
}
/**
* Merge 2 arrays recursively, differs in 2 important ways from array_merge_recursive()
* - When there's 2 different values and not both arrays, the latter value overwrites the earlier
* instead of merging both into an array
* - Numeric keys that don't conflict aren't changed, only when a numeric key already exists is the
* value added using array_push()
*
* @param array multiple variables all of which must be arrays
* @return array
* @throws \InvalidArgumentException
*/
public static function merge()
{
$array = func_get_arg(0);
$arrays = array_slice(func_get_args(), 1);
if ( ! is_array($array))
{
throw new \InvalidArgumentException('Arr::merge() - all arguments must be arrays.');
}
foreach ($arrays as $arr)
{
if ( ! is_array($arr))
{
throw new \InvalidArgumentException('Arr::merge() - all arguments must be arrays.');
}
foreach ($arr as $k => $v)
{
// numeric keys are appended
if (is_int($k))
{
array_key_exists($k, $array) ? array_push($array, $v) : $array[$k] = $v;
}
elseif (is_array($v) and array_key_exists($k, $array) and is_array($array[$k]))
{
$array[$k] = static::merge($array[$k], $v);
}
else
{
$array[$k] = $v;
}
}
}
return $array;
}
/**
* Prepends a value with an asociative key to an array.
* Will overwrite if the value exists.
*
* @param array $arr the array to prepend to
* @param string|array $key the key or array of keys and values
* @param mixed $valye the value to prepend
*/
public static function prepend(&$arr, $key, $value = null)
{
$arr = (is_array($key) ? $key : array($key => $value)) + $arr;
}
/**
* Recursive in_array
*
* @param mixed $needle what to search for
* @param array $haystack array to search in
* @return bool wether the needle is found in the haystack.
*/
public static function in_array_recursive($needle, $haystack, $strict = false)
{
foreach ($haystack as $value)
{
if ( ! $strict and $needle == $value)
{
return true;
}
elseif ($needle === $value)
{
return true;
}
elseif (is_array($value) and static::in_array_recursive($needle, $value, $strict))
{
return true;
}
}
return false;
}
/**
* Checks if the given array is a multidimensional array.
*
* @param array $arr the array to check
* @param array $all_keys if true, check that all elements are arrays
* @return bool true if its a multidimensional array, false if not
*/
public static function is_multi($arr, $all_keys = false)
{
$values = array_filter($arr, 'is_array');
return $all_keys ? count($arr) === count($values) : count($values) > 0;
}
/**
* Searches the array for a given value and returns the
* corresponding key or default value.
* If $recursive is set to true, then the Arr::search()
* function will return a delimiter-notated key using $delimiter.
*
* @param array $array The search array
* @param mixed $value The searched value
* @param string $default The default value
* @param bool $recursive Whether to get keys recursive
* @param string $delimiter The delimiter, when $recursive is true
* @return mixed
*/
public static function search($array, $value, $default = null, $recursive = true, $delimiter = '.')
{
if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
{
throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
if ( ! is_null($default) and ! is_int($default) and ! is_string($default))
{
throw new \InvalidArgumentException('Expects parameter 3 to be an string or integer or null.');
}
if ( ! is_string($delimiter))
{
throw new \InvalidArgumentException('Expects parameter 5 must be an string.');
}
$key = array_search($value, $array);
if ($recursive and $key === false)
{
$keys = array();
foreach ($array as $k => $v)
{
if (is_array($v))
{
$rk = static::search($v, $value, $default, true, $delimiter);
if ($rk !== $default)
{
$keys = array($k, $rk);
break;
}
}
}
$key = count($keys) ? implode($delimiter, $keys) : false;
}
return $key === false ? $default : $key;
}
/**
* Returns only unique values in an array. It does not sort. First value is used.
*
* @param array $arr the array to dedup
* @return array array with only de-duped values
*/
public static function unique($arr)
{
// filter out all duplicate values
return array_filter($arr, function($item)
{
// contrary to popular belief, this is not as static as you think...
static $vars = array();
if (in_array($item, $vars, true))
{
// duplicate
return false;
}
else
{
// record we've had this value
$vars[] = $item;
// unique
return true;
}
});
}
/**
* Calculate the sum of an array
*
* @param array $array the array containing the values
* @param string $key key of the value to pluck
* @return numeric the sum value
*/
public static function sum($array, $key)
{
if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
{
throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
return array_sum(static::pluck($array, $key));
}
}
| dailenearanas/iJMC-WebApp | fuel/core/classes/arr.php | PHP | mit | 25,244 |
<?php
/*
* Created by tpay.com.
* Date: 19.06.2017
* Time: 11:13
*/
namespace tpayLibs\src\_class_tpay\Validators\PaymentTypes;
use tpayLibs\src\_class_tpay\Validators\PaymentTypesInterface;
use tpayLibs\src\Dictionaries\Payments\CardFieldsDictionary;
class PaymentTypeCard implements PaymentTypesInterface
{
public function getRequestFields()
{
return CardFieldsDictionary::REQUEST_FIELDS;
}
public function getResponseFields()
{
return CardFieldsDictionary::RESPONSE_FIELDS;
}
}
| tpaycom/transferuj | tpayLibs/src/_class_tpay/Validators/PaymentTypes/PaymentTypeCard.php | PHP | mit | 530 |
package de.hilling.maven.release.testprojects.versioninheritor;
public class App {
public static void main(String[] args) {
System.out.println("1 + 2 = 3");
}
}
| guhilling/smart-release-plugin | test-projects/ear-project/project-lib/src/main/java/de/hilling/maven/release/testprojects/versioninheritor/App.java | Java | mit | 178 |
#pragma once
#include <stack>
#include <queue>
#include <vector>
class ExpressionParser {
public:
ExpressionParser(const std::string &expr);
~ExpressionParser();
double eval();
private:
struct token {
char c;
double d;
bool isNum;
bool isOp;
token() : c(0), isNum(false), isOp(true) {};
};
const std::string m_expr;
std::vector<token> tokens;
std::stack<token> m_opstack;
std::queue<token> m_revpol;
std::stack<double> m_output;
void tokenizeExpr();
void shuntingYard();
void evalRevPol();
};
| frolv/osrs-twitch-bot | src/ExpressionParser.h | C | mit | 541 |
from __future__ import unicode_literals
import os
import os.path
import subprocess
from pre_commit.util import cmd_output
class PrefixedCommandRunner(object):
"""A PrefixedCommandRunner allows you to run subprocess commands with
comand substitution.
For instance:
PrefixedCommandRunner('/tmp/foo').run(['{prefix}foo.sh', 'bar', 'baz'])
will run ['/tmp/foo/foo.sh', 'bar', 'baz']
"""
def __init__(
self,
prefix_dir,
popen=subprocess.Popen,
makedirs=os.makedirs
):
self.prefix_dir = prefix_dir.rstrip(os.sep) + os.sep
self.__popen = popen
self.__makedirs = makedirs
def _create_path_if_not_exists(self):
if not os.path.exists(self.prefix_dir):
self.__makedirs(self.prefix_dir)
def run(self, cmd, **kwargs):
self._create_path_if_not_exists()
replaced_cmd = [
part.replace('{prefix}', self.prefix_dir) for part in cmd
]
return cmd_output(*replaced_cmd, __popen=self.__popen, **kwargs)
def path(self, *parts):
path = os.path.join(self.prefix_dir, *parts)
return os.path.normpath(path)
def exists(self, *parts):
return os.path.exists(self.path(*parts))
@classmethod
def from_command_runner(cls, command_runner, path_end):
"""Constructs a new command runner from an existing one by appending
`path_end` to the command runner's prefix directory.
"""
return cls(
command_runner.path(path_end),
popen=command_runner.__popen,
makedirs=command_runner.__makedirs,
)
| barrysteyn/pre-commit | pre_commit/prefixed_command_runner.py | Python | mit | 1,661 |
pub use self::arp::ArpScheme;
pub use self::config::NetConfigScheme;
pub use self::ethernet::EthernetScheme;
pub use self::icmp::IcmpScheme;
pub use self::ip::IpScheme;
pub use self::tcp::TcpScheme;
pub use self::udp::UdpScheme;
pub mod arp;
pub mod config;
pub mod ethernet;
pub mod icmp;
pub mod ip;
pub mod tcp;
pub mod udp;
| rexlunae/redox | kernel/network/schemes/mod.rs | Rust | mit | 329 |
class Child
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String
belongs_to :parent, optional: true
end
| monkbroc/rails_admin_import | spec/dummy_app/app/mongoid/child.rb | Ruby | mit | 140 |
using System;
using System.Text;
using ECommon.Components;
using ECommon.Remoting;
using ECommon.Serializing;
using EQueue.Protocols;
using EQueue.Protocols.Brokers;
using EQueue.Protocols.Brokers.Requests;
using EQueue.Protocols.NameServers.Requests;
using EQueue.Utils;
namespace EQueue.NameServer.RequestHandlers
{
public class SetQueueConsumerVisibleForClusterRequestHandler : IRequestHandler
{
private NameServerController _nameServerController;
private IBinarySerializer _binarySerializer;
public SetQueueConsumerVisibleForClusterRequestHandler(NameServerController nameServerController)
{
_binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
_nameServerController = nameServerController;
}
public RemotingResponse HandleRequest(IRequestHandlerContext context, RemotingRequest remotingRequest)
{
var request = _binarySerializer.Deserialize<SetQueueConsumerVisibleForClusterRequest>(remotingRequest.Body);
var requestService = new BrokerRequestService(_nameServerController);
requestService.ExecuteActionToAllClusterBrokers(request.ClusterName, async remotingClient =>
{
var requestData = _binarySerializer.Serialize(new SetQueueConsumerVisibleRequest(request.Topic, request.QueueId, request.Visible));
var remotingResponse = await remotingClient.InvokeAsync(new RemotingRequest((int)BrokerRequestCode.SetQueueConsumerVisible, requestData), 30000);
context.SendRemotingResponse(remotingResponse);
});
return RemotingResponseFactory.CreateResponse(remotingRequest);
}
}
}
| tangxuehua/equeue | src/EQueue/NameServer/RequestHandlers/SetQueueConsumerVisibleForClusterRequestHandler.cs | C# | mit | 1,757 |
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LCC.ControlesLCCGestion.filtros;
namespace LCC.WebGestion.presupuestos
{
public partial class presupuestos_FiltroPresupuesto : RaizFiltroASCX
{
public override PROT.ControlesEspeciales.PanelBuscador PanelBuscador
{
get
{
return bus;
}
}
public override PROT.ControlesEspeciales.ControlFiltro ControlFiltro
{
get
{
return c;
}
}
protected void dv_SelectedIndexChanged(object sender, EventArgs e)
{
suc.Param = Int32.Parse(dv.SelectedValue);
suc.Preparar(bus.FiltroActual, bus.ObjetoNegocio);
tip.Param = Int32.Parse(dv.SelectedValue);
tip.Preparar(bus.FiltroActual, bus.ObjetoNegocio);
mat.Param = Int32.Parse(dv.SelectedValue);
mat.Preparar(bus.FiltroActual, bus.ObjetoNegocio);
us.Param = Int32.Parse(dv.SelectedValue);
us.Preparar(bus.FiltroActual, bus.ObjetoNegocio);
o1.ServicioParam = dv.SelectedValue;
tar.ServicioParam = dv.SelectedValue;
ta1.ServicioParam = dv.SelectedValue;
ta2.ServicioParam = dv.SelectedValue;
des.ServicioParam = dv.SelectedValue;
obn.ServicioParam = dv.SelectedValue;
}
}
} | pacoferre/Dosconf | Frontend/PROT/Search/FiltroPresupuesto.ascx.cs | C# | mit | 1,367 |
"""
Python Blueprint
================
Does not install python itself, only develop and setup tools.
Contains pip helper for other blueprints to use.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.python
"""
from fabric.decorators import task
from refabric.api import run, info
from refabric.context_managers import sudo
from . import debian
__all__ = ['setup']
pip_log_file = '/tmp/pip.log'
@task
def setup():
"""
Install python develop tools
"""
install()
def install():
with sudo():
info('Install python dependencies')
debian.apt_get('install', 'python-dev', 'python-setuptools')
run('easy_install pip')
run('touch {}'.format(pip_log_file))
debian.chmod(pip_log_file, mode=777)
pip('install', 'setuptools', '--upgrade')
def pip(command, *options):
info('Running pip {}', command)
run('pip {0} {1} -v --log={2} --log-file={2}'.format(command, ' '.join(options), pip_log_file))
| gelbander/blues | blues/python.py | Python | mit | 997 |
#!/bin/sh
controllerIP=`grep controller /etc/hosts | awk '{print $1}'`
#controllerIP=192.168.122.75
controllerIP=127.0.0.1
echo controllerIP $controllerIP
file=/etc/pike/cinder/cinder.conf
orig=/etc/pike/cinder/.orig-$(basename $file)
jdate=`date "+%Y_%j_%H_%M"`
orig=${orig}${jdate}
if [ ! -e $orig ] ; then
cp -p $file $orig
fi
function crudset {
file=/etc/pike/cinder/cinder.conf
section=database
key=connection
val='mysql+pymysql://cinder:cloud@controller/cinder'
if [ $1 ] ; then file="$1" ; fi
if [ $2 ] ; then section="$2" ; fi
if [ $3 ] ; then key="$3" ; fi
if [ $4 ] ; then val="$4" ; fi
touch $file
crudini --set --existing $file $section $key $val
if [ $? != 0 ] ; then
crudini --set $file $section $key $val
fi
crudini --get $file $section $key
}
function cinderset {
crudset $file database connection 'mysql+pymysql://cinder:cloud@controller/cinder'
crudset $file DEFAULT transport_url rabbit://openstack:cloud@controller
crudset $file DEFAULT auth_strategy keystone
crudset $file DEFAULT my_ip $controllerIP
crudset $file DEFAULT enabled_backends lvm
crudset $file DEFAULT glance_api_servers http://controller:9292
crudset $file keystone_authtoken auth_uri http://controller:5000
crudset $file keystone_authtoken auth_url http://controller:35357
crudset $file keystone_authtoken memcached_servers controller:11211
crudset $file keystone_authtoken auth_type password
crudset $file keystone_authtoken project_domain_name default
crudset $file keystone_authtoken user_domain_name default
crudset $file keystone_authtoken project_name service
crudset $file keystone_authtoken username cinder
crudset $file keystone_authtoken password cloud
crudset $file lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
crudset $file lvm volume_group cinder-volumes
crudset $file lvm iscsi_protocol iscsi
crudset $file lvm iscsi_helper lioadm
crudset $file oslo_concurrency lock_path /var/lib/cinder/tmp
}
function cinder_test {
openstack volume create --size 1 volume1
openstack volume list
# openstack server add volume instance-name volume1
}
echo diff $orig $file
diff $orig $file
echo cinder whatcloud instructions seem congruent with openstack.org manual install guide:
echo avoid password-prompt and instead set it directly ... see funcs in authsetup.sh
echo su -s /bin/sh -c \'cinder-manage db sync\' cinder
echo systemctl start lvm2-lvmetad.service
echo pvcreate /dev/vdb
echo vgcreate cinder-volumes /dev/vdb
echo systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
| OpenSciViz/cloud | openstack/src/bash/cinder-pike.sh | Shell | mit | 2,605 |
var path = require('path'),
fs = require('fs'),
Source = require(hexo.lib_dir + '/core/source'),
config_dir = path.dirname(hexo.configfile),
config = hexo.config;
function testver(){
var ver = hexo.env.version.split('.');
var test = true;
if (ver[0] < 2) test = false;
else if (ver[0] == 2 && ver[1] < 5) test = false;
if (test) return;
var hexo_curver = 'hexo'.red + (' V' + hexo.env.version).green;
var theme_curver = 'chenall'.green + ' V2.2'.red;
var error = 'Current version of ' + hexo_curver + ' Does not apply to the theme ' + theme_curver;
error += ',Please use theme ' + 'chenall '.green + 'V1.0'.red + ' or upgrade to' + ' hexo 2.5.0 '.green + 'or latest.';
error +='\n\n\t当前版本 ' + hexo_curver + ' 不适用于主题 ' + theme_curver + '\n请使用' + 'chenall '.green + 'V1.0'.red + ' 版主题或升级hexo到' + ' 2.5.0 '.green + '以上';
error +='\n\nchenall V1.0:\n' + 'svn co https://github.com/chenall/hexo-theme-chenall/tags/V1.0 themes/chenall'.yellow;
error +='\n\nhexo latest(升级):\n\t' + 'npm update hexo'.yellow;
error +='\n\nhexo V2.5.X(安装指定版本):\n\t' + 'npm install hexo@2.5.3 -g'.yellow;
error += '\n\n\t有什么疑问可以联系我 http://chenall.net';
hexo.log.e(error);
process.exit(1);
}
function checkenv(){
var store = hexo.extend.renderer.store;
var error = '';
if (!store['ejs']) error += '\tnpm install hexo-renderer-ejs\n';
if (!store['md']) error += '\tnpm install hexo-renderer-marked\n';
if (!store['styl']) error +='\tnpm install hexo-renderer-stylus\n';
if (error){
hexo.log.e('\t主题使用环境检测失败\n\n\t缺少必要插件,请使用以下命令安装:\n\n',error);
process.exit(1);
}
}
testver();
checkenv();
if (hexo.hasOwnProperty('env') && hexo.env.hasOwnProperty('debug')) hexo.debug = hexo.env.debug;
hexo.__dump = function(obj){
var cache = [];
return JSON.stringify(obj,function(key, value){
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
cache.push(value);
}
return value;
});
}
if (config.CustomDir && typeof(config.CustomDir) == 'object'){
var joinPath = function(){
var str = path.join.apply(this, arguments);
if (str[str.length - 1] !== path.sep) str += path.sep;
return str;
};
var custom = config.CustomDir;
['public_dir','source_dir','scaffold_dir'].forEach(function(p){
if (!custom[p]) return;
if (custom[p] == 'auto'){
hexo.constant(p,joinPath(config_dir,p));
} else {
var test = custom[p].match(/^:config(.*)$/);
if (test){
hexo.constant(p,joinPath(config_dir,test[1]));
} else {
hexo.constant(p,joinPath(config_dir,custom[p]));
}
}
})
hexo.source = new Source();
}
var load_default_usercfg = function(){
var cfg = global.usercfg = {
ajax_widgets: true,
updated: true,
cached_widgets:true
};
cfg.twbs_style = ['primary','success','info','warning','danger'];
var user_cfg = hexo.source_dir + '_' + hexo.config.theme + '.yml';
if (!fs.existsSync(user_cfg)){
user_cfg = hexo.theme_dir + '_config.yml';
cfg.themeconfig = hexo.render.renderSync({path: user_cfg});
hexo.log.i("Theme config file: " + user_cfg.green);
}
cfg.twbs_sty = function(i){return cfg.twbs_style[i%4];}
hexo.log.d('Using theme ' + 'chenall V2.2'.green);
}
hexo.on('ready',load_default_usercfg);
| chenall/hexo-theme-chenall | scripts/config.js | JavaScript | mit | 3,624 |
<?php
namespace Alcodo\AsyncCss\Commands;
use Alcodo\AsyncCss\Cache\CssKeys;
use Illuminate\Console\Command;
class Show extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'alcodo:asynccss:show';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Show all generated css async paths';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$keys = CssKeys::show();
if ($keys === null) {
$this->info('Cache is empty');
return true;
}
if (is_array($keys)) {
foreach ($keys as $key) {
$path = CssKeys::getSinglePath($key);
$this->info('Path: '.$path);
}
}
return true;
}
}
| alcodo/async-css | Commands/Show.php | PHP | mit | 1,079 |
#!/usr/bin/env ruby
$:.unshift File.expand_path('../../../lib', __FILE__)
$stdout.sync = true
require 'philotic'
require 'awesome_print'
class NamedQueueConsumer < Philotic::Consumer
# subscribe to an existing named queue
subscribe_to :test_queue
# use acknowledgements
auto_acknowledge
# REQUEUE the message with RabbitMQ if consume throws these errors. I.e., something went wrong with the consumer
# Only valid with ack_messages
# requeueable_errors PossiblyTransientErrorOne, PossiblyTransientErrorTwo
# REJECT the message with RabbitMQ if consume throws these errors. I.e., The message is malformed/invalid
# Only valid with ack_messages
# rejectable_errors BadMessageError
def consume(message)
ap named: message.attributes
end
end
class AnonymousQueueConsumer < Philotic::Consumer
# subscribe anonymously to a set of headers:
# subscribe_to header_1: 'value_1',
# header_2: 'value_2',
# header_3: 'value_3'
subscribe_to philotic_firehose: true
def consume(message)
ap anon: message.attributes
end
end
#run the consumers
AnonymousQueueConsumer.subscribe
NamedQueueConsumer.subscribe
# keep the parent thread alive
Philotic.endure
| nkeyes/philotic | examples/subscribing/consumer.rb | Ruby | mit | 1,218 |
# wedding-rsvp
A simple concept for RSVPing to a wedding
### Technologies
* Sinatra
* ActiveRecord
* Postgres
* MVC Structure
| davidlhayes/wedding-rsvp | README.md | Markdown | mit | 128 |
#include "arrow.h"
/**
* @brief Arrow::Arrow
*/
Arrow::Arrow() : Shape(SHAPES::ARROW) {
}
/**
* @brief Arrow::Arrow
* @param col Colour of the new object
* @param pos Starting point for the new object
*/
Arrow::Arrow(QColor col, QPoint pos) : Shape(SHAPES::ARROW, col, pos) {
}
/**
* @brief Arrow::draw
* Draws the object on top of the specified frame.
* @param frame Frame to draw on.
* @return Returns the frame with drawing.
*/
cv::Mat Arrow::draw(cv::Mat &frame) {
cv::arrowedLine(frame, draw_start, draw_end, colour, LINE_THICKNESS);
return frame;
}
/**
* @brief Arrow::handle_new_pos
* Function to handle the new position of the mouse.
* Does not need to store the new position.
* @param pos
*/
void Arrow::handle_new_pos(QPoint pos) {
}
/**
* @brief Arrow::write
* @param json
* Writes to a Json object.
*/
void Arrow::write(QJsonObject& json) {
write_shape(json);
}
/**
* @brief Arrow::read
* @param json
* Reads from a Json object.
*/
void Arrow::read(const QJsonObject& json) {
read_shape(json);
}
| NFCSKL/ViAn | ViAn/Video/shapes/arrow.cpp | C++ | mit | 1,054 |
const request = require('request-promise');
const oauth = require('./config').auth;
const rootUrl = 'https://api.twitter.com/1.1';
let allItems = [];
/* API methods */
const API = {
/**
* Search for tweets
* @param options {Object} Options object containing:
* - text (Required) : String
* - count (optional) : Number
* - result_type (optional) : String
* - geocode (optional) : String (lat long radius_in_miles)
* - since_id (optional) : Number - start search from this ID
* - max_id (optional) : Number - end search on this ID
*/
search: (options) => {
return new Promise((resolve, reject) => {
const {text, count = 100, result_type = 'popular', since_id = 0, max_id, geocode} = options;
let params =
`?q=${encodeURIComponent(options.text)}` +
`&count=${count}` +
`&result_type=${result_type}` +
`&since_id=${since_id}`;
if (max_id) {
params += `&max_id=${max_id}`;
}
if (geocode) {
params += `&geocode=${encodeURIComponent(geocode)}`;
}
allItems = [];
API.searchByStringParam(params).then((items) => resolve(items)).catch((err) => reject(err));
});
},
/**
* Search w/ params
* @param stringParams {String} Params as string
*/
searchByStringParam: (stringParams) =>
new Promise((resolve, reject) => {
const searchCallback = (res) => {
const result = JSON.parse(res);
if (result && result.statuses) {
result.statuses.forEach(item => allItems.push(item));
console.log('[Search] So far we have', allItems.length, 'items');
// If we have the next_results, search again for the rest (sort of a pagination)
const nextRes = result.search_metadata.next_results;
if (nextRes) {
API.searchByStringParam(nextRes).then((items) => resolve(items));
} else {
resolve(allItems);
}
} else {
resolve(null);
}
};
request.get({url: `${rootUrl}/search/tweets.json${stringParams}`, oauth})
.then(res => searchCallback(res))
.catch(err => reject(err));
})
,
/**
* Retweet a tweet
* @param tweetId {String} identifier for the tweet
*/
retweet: (tweetId) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/statuses/retweet/${tweetId}.json`, oauth})
.then((res) => resolve(res))
.catch((err) => reject(err))
)
,
/**
* Like (aka favorite) a tweet
* @param tweetId {String} identifier for the tweet
*/
like: (tweetId) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/favorites/create.json?id=${tweetId}`, oauth})
.then((res) => resolve(res))
.catch((err) => reject(err))
)
,
/**
* Follow a user by username
* @param userId {String} identifier for the user
*/
follow: (userId) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/friendships/create.json?user_id=${userId}`, oauth})
.then((res) => resolve(res))
.catch((err) => reject(err))
)
,
/**
* Follow a user by username
* @param userName {String} username identifier for the user
*/
followByUsername: (userName) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/friendships/create.json?screen_name=${userName}`, oauth})
.then((res) => resolve(res))
.catch((err) => reject(err))
)
,
/**
* Block a user
* @param userId {String} ID of the user to block
*/
blockUser: (userId) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/blocks/create.json?user_id=${userId}`, oauth})
.then((res) => resolve(res))
.catch((err) => reject(err))
)
,
/** Get list of blocked users for the current user */
getBlockedUsers: () =>
new Promise((resolve, reject) =>
request.get({url: `${rootUrl}/blocks/list.json`, oauth})
.then((res) => resolve(JSON.parse(res).users.map((user) => user.id)))
.catch((err) => reject(err))
)
,
/**
* Get a user's tweets
* @param userId {String} identifier for the user
* @param count {Number} max tweets to retrieve
*/
getTweetsForUser: (userId, count) =>
new Promise((resolve, reject) =>
request.get({url: `${rootUrl}/statuses/user_timeline.json?user_id=${userId}&count=${count}`, oauth})
.then((response) => resolve(response))
.catch((err) => reject(err))
)
,
/**
* Delete a tweet
* @param tweetId {String} identifier for the tweet
*/
deleteTweet: (tweetId) =>
new Promise((resolve, reject) =>
request.post({url: `${rootUrl}/statuses/destroy/${tweetId}.json`, oauth})
.then(() => {
console.log('Deleted tweet', tweetId);
resolve();
})
.catch((err) => reject(err))
)
,
/**
* Reply to a tweet
* (The Reply on Twitter is basically a Status Update containing @username, where username is author of the original tweet)
* @param tweet {Object} The full Tweet we want to reply to
*/
replyToTweet: (tweet) =>
new Promise((resolve, reject) => {
try {
const text = encodeURIComponent(`@${tweet.user.screen_name} `);
request.post({
url: `${rootUrl}/statuses/update.json?status=${text}&in_reply_to_status_id=${tweet.id}`,
oauth
})
.then(() => resolve())
.catch(err => reject(err))
} catch (err) {
reject(err);
}
})
};
module.exports = API;
| raulrene/Twitter-ContestJS-bot | api-functions.js | JavaScript | mit | 6,401 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Extensions
{
public static class IEnumerableExtensions
{
public static T Sum<T>(this IEnumerable<T> enumerable)
{
dynamic sum = 0;
foreach (var element in enumerable)
{
sum += element;
}
return sum;
}
public static T Product<T>(this IEnumerable<T> enumerable)
{
dynamic Prod = 1;
foreach (var element in enumerable)
{
Prod *= element;
}
return Prod;
}
public static T Min<T>(this IEnumerable<T> enumerable)
where T : IComparable<T>
{
T result = enumerable.First();
foreach (var element in enumerable)
{
if (result.CompareTo(element) > 0)
{
result = element;
}
}
return result;
}
public static T Max<T>(this IEnumerable<T> enumerable)
where T : IComparable<T>
{
T result = enumerable.First();
foreach (var element in enumerable)
{
if (result.CompareTo(element) < 0)
{
result = element;
}
}
return result;
}
public static T Average<T>(this IEnumerable<T> enumerable)
{
return (dynamic)enumerable.Sum() / enumerable.Count();
}
}
}
| SHAMMY1/Telerik-Academy-2016 | OOP/Homeworks/03.ExtensionsDelegatesLambda/ExtensionsDelegatesLambdaHW/Extensions/IEnumerableExtensions.cs | C# | mit | 1,214 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (version 1.7.0_79) on Fri Sep 09 15:51:56 CST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>S - 索引</title>
<meta name="date" content="2016-09-09">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="S - \u7D22\u5F15";
}
//-->
</script>
<noscript>
<div>您的浏览器已禁用 JavaScript。</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="跳过导航链接"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../overview-summary.html">概览</a></li>
<li>程序包</li>
<li>类</li>
<li><a href="../overview-tree.html">树</a></li>
<li><a href="../deprecated-list.html">已过时</a></li>
<li class="navBarCell1Rev">索引</li>
<li><a href="../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-15.html">上一个字母</a></li>
<li><a href="index-17.html">下一个字母</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-16.html" target="_top">框架</a></li>
<li><a href="index-16.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">所有类</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="contentContainer"><a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">I</a> <a href="index-9.html">J</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">O</a> <a href="index-14.html">P</a> <a href="index-15.html">R</a> <a href="index-16.html">S</a> <a href="index-17.html">T</a> <a href="index-18.html">U</a> <a href="index-19.html">V</a> <a name="_S_">
<!-- -->
</a>
<h2 class="title">S</h2>
<dl>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#sChattingTarget">sChattingTarget</a></span> - 类 中的静态变量cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/ContactManager.html#sendInvitationRequest(java.lang.String,%20java.lang.String,%20java.lang.String,%20cn.jpush.im.api.BasicCallback)">sendInvitationRequest(String, String, String, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/ContactManager.html" title="cn.jpush.im.android.api中的类">ContactManager</a></dt>
<dd>
<div class="block">发送添加好友请求。</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#sendMessage(cn.jpush.im.android.api.model.Message)">sendMessage(Message)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">发送消息</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setAddress(java.lang.String)">setAddress(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/CustomContent.html#setAllValues(java.util.Map)">setAllValues(Map<? extends String, ? extends String>)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/CustomContent.html" title="cn.jpush.im.android.api.content中的类">CustomContent</a></dt>
<dd>
<div class="block">将map中所有键值对放入消息体,</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setBirthday(long)">setBirthday(long)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setBlacklist(int)">setBlacklist(int)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MessageContent.html#setBooleanExtra(java.lang.String,%20java.lang.Boolean)">setBooleanExtra(String, Boolean)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MessageContent.html" title="cn.jpush.im.android.api.content中的类">MessageContent</a></dt>
<dd>
<div class="block">设置消息体中的附加字段</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/CustomContent.html#setBooleanValue(java.lang.String,%20java.lang.Boolean)">setBooleanValue(String, Boolean)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/CustomContent.html" title="cn.jpush.im.android.api.content中的类">CustomContent</a></dt>
<dd>
<div class="block">设置自定义消息体中的值</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setcTime(long)">setcTime(long)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#setDebugMode(boolean)">setDebugMode(boolean)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">设置debug模式,sdk将会输出更多debug信息。</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setDesc(java.lang.String)">setDesc(String)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setEventId(long)">setEventId(long)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setEventType(int)">setEventType(int)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setExtra(int)">setExtra(int)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MessageContent.html#setExtras(java.util.Map)">setExtras(Map<String, String>)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MessageContent.html" title="cn.jpush.im.android.api.content中的类">MessageContent</a></dt>
<dd>
<div class="block">设置消息体中的附加字段</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MediaContent.html#setFileUploaded(boolean)">setFileUploaded(boolean)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MediaContent.html" title="cn.jpush.im.android.api.content中的类">MediaContent</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setfromUserAppKey(java.lang.String)">setfromUserAppKey(String)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setFromUsername(java.lang.String)">setFromUsername(String)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setGender(cn.jpush.im.android.api.model.UserInfo.Gender)">setGender(UserInfo.Gender)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setGid(long)">setGid(long)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/ImageContent.html#setImg_link(java.lang.String)">setImg_link(String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/ImageContent.html" title="cn.jpush.im.android.api.content中的类">ImageContent</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MediaContent.html#setLocalPath(java.lang.String)">setLocalPath(String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MediaContent.html" title="cn.jpush.im.android.api.content中的类">MediaContent</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/ImageContent.html#setLocalThumbnailPath(java.lang.String)">setLocalThumbnailPath(String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/ImageContent.html" title="cn.jpush.im.android.api.content中的类">ImageContent</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MediaContent.html#setMediaID(java.lang.String)">setMediaID(String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MediaContent.html" title="cn.jpush.im.android.api.content中的类">MediaContent</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setNickname(java.lang.String)">setNickname(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/GroupInfo.html#setNoDisturb(int,%20cn.jpush.im.api.BasicCallback)">setNoDisturb(int, BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/GroupInfo.html" title="cn.jpush.im.android.api.model中的类">GroupInfo</a></dt>
<dd>
<div class="block">将此群组设置为免打扰。</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setNoDisturb(int,%20cn.jpush.im.api.BasicCallback)">setNoDisturb(int, BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd>
<div class="block">将此用户设置为免打扰。</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#setNoDisturbGlobal(int,%20cn.jpush.im.api.BasicCallback)">setNoDisturbGlobal(int, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">设置全局免打扰标识,设置之后用户在所有设备上收到消息时通知栏都不会弹出消息通知。</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setNotename(java.lang.String)">setNotename(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setNoteText(java.lang.String)">setNoteText(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#setNotificationMode(int)">setNotificationMode(int)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">设置通知的展示类型</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MessageContent.html#setNumberExtra(java.lang.String,%20java.lang.Number)">setNumberExtra(String, Number)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MessageContent.html" title="cn.jpush.im.android.api.content中的类">MessageContent</a></dt>
<dd>
<div class="block">设置消息体中的附加字段</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/CustomContent.html#setNumberValue(java.lang.String,%20java.lang.Number)">setNumberValue(String, Number)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/CustomContent.html" title="cn.jpush.im.android.api.content中的类">CustomContent</a></dt>
<dd>
<div class="block">设置自定义消息体中的值</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/Message.html#setOnContentDownloadProgressCallback(cn.jpush.im.android.api.callback.ProgressUpdateCallback)">setOnContentDownloadProgressCallback(ProgressUpdateCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Message.html" title="cn.jpush.im.android.api.model中的类">Message</a></dt>
<dd>
<div class="block">设置监听消息所带附件(图片、语音等)下载进度的回调接口</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/Message.html#setOnContentUploadProgressCallback(cn.jpush.im.android.api.callback.ProgressUpdateCallback)">setOnContentUploadProgressCallback(ProgressUpdateCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Message.html" title="cn.jpush.im.android.api.model中的类">Message</a></dt>
<dd>
<div class="block">设置监听消息所带附件(图片、语音等)上传进度的回调接口</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/Message.html#setOnSendCompleteCallback(cn.jpush.im.api.BasicCallback)">setOnSendCompleteCallback(BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Message.html" title="cn.jpush.im.android.api.model中的类">Message</a></dt>
<dd>
<div class="block">设置监听消息发送完成的回调接口</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setRegion(java.lang.String)">setRegion(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setReturnCode(int)">setReturnCode(int)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setSignature(java.lang.String)">setSignature(String)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/UserInfo.html#setStar(int)">setStar(int)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/UserInfo.html" title="cn.jpush.im.android.api.model中的类">UserInfo</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/MessageContent.html#setStringExtra(java.lang.String,%20java.lang.String)">setStringExtra(String, String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/MessageContent.html" title="cn.jpush.im.android.api.content中的类">MessageContent</a></dt>
<dd>
<div class="block">设置消息体中的附加字段</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/content/CustomContent.html#setStringValue(java.lang.String,%20java.lang.String)">setStringValue(String, String)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/CustomContent.html" title="cn.jpush.im.android.api.content中的类">CustomContent</a></dt>
<dd>
<div class="block">设置自定义消息体中的值</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html#setToUsernameList(java.util.List)">setToUsernameList(List<String>)</a></span> - 类 中的方法cn.jpush.im.android.api.event.<a href="../cn/jpush/im/android/api/event/BaseNotificationEvent.Builder.html" title="cn.jpush.im.android.api.event中的类">BaseNotificationEvent.Builder</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/model/Conversation.html#setUnReadMessageCnt(int)">setUnReadMessageCnt(int)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Conversation.html" title="cn.jpush.im.android.api.model中的类">Conversation</a></dt>
<dd>
<div class="block">设置会话中的未读消息数</div>
</dd>
<dt><span class="strong"><a href="../cn/jpush/im/android/api/JMessageClient.html#swapEnvironment(Context,%20java.lang.Boolean)">swapEnvironment(Context, Boolean)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd> </dd>
</dl>
<a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">I</a> <a href="index-9.html">J</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">O</a> <a href="index-14.html">P</a> <a href="index-15.html">R</a> <a href="index-16.html">S</a> <a href="index-17.html">T</a> <a href="index-18.html">U</a> <a href="index-19.html">V</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="跳过导航链接"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../overview-summary.html">概览</a></li>
<li>程序包</li>
<li>类</li>
<li><a href="../overview-tree.html">树</a></li>
<li><a href="../deprecated-list.html">已过时</a></li>
<li class="navBarCell1Rev">索引</li>
<li><a href="../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-15.html">上一个字母</a></li>
<li><a href="index-17.html">下一个字母</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-16.html" target="_top">框架</a></li>
<li><a href="index-16.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">所有类</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| fendouai/jpush-docs | zh/JMessage/docs/client/im_android_api_docs/index-files/index-16.html | HTML | mit | 22,793 |
using System;
using System.Collections;
using UnityEngine;
using VRStandardAssets.Common;
using VRStandardAssets.Utils;
namespace VRStandardAssets.ShootingGallery
{
// This script handles a target in the shooter scenes.
// It includes what should happen when it is hit and
// how long before it despawns.
public class ShootingTarget : MonoBehaviour
{
public event Action<ShootingTarget> OnRemove; // This event is triggered when the target needs to be removed.
[SerializeField] private int m_Score = 1; // This is the amount added to the users score when the target is hit.
[SerializeField] private float m_TimeOutDuration = 2f; // How long the target lasts before it disappears.
[SerializeField] private float m_DestroyTimeOutDuration = 2f; // When the target is hit, it shatters. This is how long before the shattered pieces disappear.
[SerializeField] private GameObject m_DestroyPrefab; // The prefab for the shattered target.
[SerializeField] private AudioClip m_DestroyClip; // The audio clip to play when the target shatters.
[SerializeField] private AudioClip m_SpawnClip; // The audio clip that plays when the target appears.
[SerializeField] private AudioClip m_MissedClip; // The audio clip that plays when the target disappears without being hit.
private Transform m_CameraTransform; // Used to make sure the target is facing the camera.
private VRInteractiveItem m_InteractiveItem; // Used to handle the user clicking whilst looking at the target.
private AudioSource m_Audio; // Used to play the various audio clips.
private Renderer m_Renderer; // Used to make the target disappear before it is removed.
private Collider m_Collider; // Used to make sure the target doesn't interupt other shots happening.
private bool m_IsEnding; // Whether the target is currently being removed by another source.
private void Awake()
{
// Setup the references.
m_CameraTransform = Camera.main.transform;
m_Audio = GetComponent<AudioSource> ();
m_InteractiveItem = GetComponent<VRInteractiveItem>();
m_Renderer = GetComponent<Renderer>();
m_Collider = GetComponent<Collider>();
}
private void OnEnable ()
{
m_InteractiveItem.OnDown += HandleDown;
}
private void OnDisable ()
{
m_InteractiveItem.OnDown -= HandleDown;
}
private void OnDestroy()
{
// Ensure the event is completely unsubscribed when the target is destroyed.
OnRemove = null;
}
public void Restart (float gameTimeRemaining)
{
// When the target is spawned turn the visual and physical aspects on.
m_Renderer.enabled = true;
m_Collider.enabled = true;
// Since the target has just spawned, it's not ending yet.
m_IsEnding = false;
// Play the spawn clip.
m_Audio.clip = m_SpawnClip;
m_Audio.Play();
// Make sure the target is facing the camera.
transform.LookAt(m_CameraTransform);
// Start the time out for when the target would naturally despawn.
StartCoroutine (MissTarget());
// Start the time out for when the game ends.
// Note this will only come into effect if the game time remaining is less than the time out duration.
StartCoroutine (GameOver (gameTimeRemaining));
}
private IEnumerator MissTarget()
{
// Wait for the target to disappear naturally.
yield return new WaitForSeconds (m_TimeOutDuration);
// If by this point it's already ending, do nothing else.
if(m_IsEnding)
yield break;
// Otherwise this is ending the target's lifetime.
m_IsEnding = true;
// Turn off the visual and physical aspects.
m_Renderer.enabled = false;
m_Collider.enabled = false;
// Play the clip of the target being missed.
m_Audio.clip = m_MissedClip;
m_Audio.Play();
// Wait for the clip to finish.
yield return new WaitForSeconds(m_MissedClip.length);
// Tell subscribers that this target is ready to be removed.
if (OnRemove != null)
OnRemove(this);
}
private IEnumerator GameOver (float gameTimeRemaining)
{
// Wait for the game to end.
yield return new WaitForSeconds (gameTimeRemaining);
// If by this point it's already ending, do nothing else.
if(m_IsEnding)
yield break;
// Otherwise this is ending the target's lifetime.
m_IsEnding = true;
// Turn off the visual and physical aspects.
m_Renderer.enabled = false;
m_Collider.enabled = false;
// Tell subscribers that this target is ready to be removed.
if (OnRemove != null)
OnRemove (this);
}
private void HandleDown()
{
// If it's already ending, do nothing else.
if (m_IsEnding)
return;
// Otherwise this is ending the target's lifetime.
m_IsEnding = true;
// Turn off the visual and physical aspects.
m_Renderer.enabled = false;
m_Collider.enabled = false;
// Play the clip of the target being hit.
m_Audio.clip = m_DestroyClip;
m_Audio.Play();
// Add to the player's score.
SessionData.AddScore(m_Score);
// Instantiate the shattered target prefab in place of this target.
GameObject destroyedTarget = Instantiate(m_DestroyPrefab, transform.position, transform.rotation) as GameObject;
// Destroy the shattered target after it's time out duration.
Destroy(destroyedTarget, m_DestroyTimeOutDuration);
// Tell subscribers that this target is ready to be removed.
if (OnRemove != null)
OnRemove(this);
}
}
} | SerKale/voxyl | Voxyl/Assets/VRSampleScenes/Scripts/ShootingGallery/ShootingTarget.cs | C# | mit | 6,853 |
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import __version__
from ansible.errors import AnsibleError
from distutils.version import LooseVersion
from operator import eq, ge, gt
from sys import version_info
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
version_requirement = '2.5.0.0'
version_tested_max = '2.7.5'
python3_required_version = '2.5.3'
if version_info[0] == 3 and not ge(LooseVersion(__version__), LooseVersion(python3_required_version)):
raise AnsibleError(('Ansible >= {} is required when using Python 3.\n'
'Either downgrade to Python 2 or update your Ansible version to {}.').format(python3_required_version, python3_required_version))
if not ge(LooseVersion(__version__), LooseVersion(version_requirement)):
raise AnsibleError(('Trellis no longer supports Ansible {}.\n'
'Please upgrade to Ansible {} or higher.').format(__version__, version_requirement))
elif gt(LooseVersion(__version__), LooseVersion(version_tested_max)):
display.warning(u'You Ansible version is {} but this version of Trellis has only been tested for '
u'compatability with Ansible {} -> {}. It is advisable to check for Trellis updates or '
u'downgrade your Ansible version.'.format(__version__, version_requirement, version_tested_max))
if eq(LooseVersion(__version__), LooseVersion('2.5.0')):
display.warning(u'You Ansible version is {}. Consider upgrading your Ansible version to avoid '
u'erroneous warnings such as `Removed restricted key from module data...`'.format(__version__))
# Import BaseVarsPlugin after Ansible version check.
# Otherwise import error for Ansible versions older than 2.4 would prevent display of version check message.
from ansible.plugins.vars import BaseVarsPlugin
class VarsModule(BaseVarsPlugin):
def get_vars(self, loader, path, entities, cache=True):
return {}
| jeffstieler/bedrock-ansible | lib/trellis/plugins/vars/version.py | Python | mit | 2,048 |
//@flow
const {foo, Bar, baz, qux} = require('./jsdoc-exports');
const {
DefaultedStringEnum,
InitializedStringEnum,
NumberEnum,
BooleanEnum,
SymbolEnum,
} = require('./jsdoc-objects');
/** a JSDoc in the same file */
function x() {}
( );
// ^
| mroch/flow | tests/autocomplete/jsdoc.js | JavaScript | mit | 261 |
ace.define("ace/mode/tex_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var TexHighlightRules = function(textClass) {
if (!textClass)
textClass = "text";
this.$rules = {
"start" : [
{
token : "comment",
regex : "%.*$"
}, {
token : textClass, // non-command
regex : "\\\\[$&%#\\{\\}]"
}, {
token : "keyword", // command
regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
next : "nospell"
}, {
token : "keyword", // command
regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
}, {
token : "paren.keyword.operator",
regex : "[[({]"
}, {
token : "paren.keyword.operator",
regex : "[\\])}]"
}, {
token : textClass,
regex : "\\s+"
}
],
"nospell" : [
{
token : "comment",
regex : "%.*$",
next : "start"
}, {
token : "nospell." + textClass, // non-command
regex : "\\\\[$&%#\\{\\}]"
}, {
token : "keyword", // command
regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
}, {
token : "keyword", // command
regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
next : "start"
}, {
token : "paren.keyword.operator",
regex : "[[({]"
}, {
token : "paren.keyword.operator",
regex : "[\\])]"
}, {
token : "paren.keyword.operator",
regex : "}",
next : "start"
}, {
token : "nospell." + textClass,
regex : "\\s+"
}, {
token : "nospell." + textClass,
regex : "\\w+"
}
]
};
};
oop.inherits(TexHighlightRules, TextHighlightRules);
exports.TexHighlightRules = TexHighlightRules;
});
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var MatchingBraceOutdent = function() {};
(function() {
this.checkOutdent = function(line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*\}/.test(input);
};
this.autoOutdent = function(doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*\})/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.$getIndent = function(line) {
return line.match(/^\s*/)[0];
};
}).call(MatchingBraceOutdent.prototype);
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
ace.define("ace/mode/tex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function(suppressHighlighting) {
if (suppressHighlighting)
this.HighlightRules = TextHighlightRules;
else
this.HighlightRules = TexHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = this.$defaultBehaviour;
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "%";
this.getNextLineIndent = function(state, line, tab) {
return this.$getIndent(line);
};
this.allowAutoInsert = function() {
return false;
};
this.$id = "ace/mode/tex";
}).call(Mode.prototype);
exports.Mode = Mode;
});
(function() {
ace.require(["ace/mode/tex"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
| NPellet/jsGraph | web/site/js/ace-builds/src-noconflict/mode-tex.js | JavaScript | mit | 5,261 |
/**
* This code was auto-generated by a Codezu.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
*/
package com.mozu.api.contracts.paymentservice.extensibility.v1;
import java.util.List;
import java.util.HashMap;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.joda.time.DateTime;
import java.io.IOException;
import java.lang.ClassNotFoundException;
import com.mozu.api.contracts.paymentservice.extensibility.v1.ConnectionStatuses;
import com.mozu.api.contracts.paymentservice.extensibility.v1.KeyValueTuple;
/**
* Contains a credit response
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class GatewayCreditResponse implements Serializable
{
// Default Serial Version UID
private static final long serialVersionUID = 1L;
/**
* Set this to true if the transaction is declined or fails for any reason.
*/
protected Boolean isDeclined;
public Boolean getIsDeclined() {
return this.isDeclined;
}
public void setIsDeclined(Boolean isDeclined) {
this.isDeclined = isDeclined;
}
/**
* Contains the response code from the gateway.
*/
protected String responseCode;
public String getResponseCode() {
return this.responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
/**
* Contains the text for the response, eg, 'Insufficient funds'.
*/
protected String responseText;
public String getResponseText() {
return this.responseText;
}
public void setResponseText(String responseText) {
this.responseText = responseText;
}
/**
* Contains the id for the transaction provided by the gateway.
*/
protected String transactionId;
public String getTransactionId() {
return this.transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
/**
* Contains information about the interaction with the gateway.
*/
protected ConnectionStatuses remoteConnectionStatus;
public ConnectionStatuses getRemoteConnectionStatus() {
return this.remoteConnectionStatus;
}
public void setRemoteConnectionStatus(ConnectionStatuses remoteConnectionStatus) {
this.remoteConnectionStatus = remoteConnectionStatus;
}
/**
* Contains information not in the object allowing flexibility.
*/
protected List<KeyValueTuple> responseData;
public List<KeyValueTuple> getResponseData() {
return this.responseData;
}
public void setResponseData(List<KeyValueTuple> responseData) {
this.responseData = responseData;
}
}
| Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/contracts/paymentservice/extensibility/v1/GatewayCreditResponse.java | Java | mit | 2,610 |
module Hello
module Business
module Management
class ResetPassword < Base
attr_reader :password_credential
def initialize(password_credential)
@password_credential = password_credential
end
def update_password(plain_text_password)
if @password_credential.update(password: plain_text_password)
@password_credential.reset_verifying_token!
return true
else
merge_errors_to_self
return false
end
end
def user
password_credential.user
end
private
def merge_errors_to_self
hash = @password_credential.errors.to_hash
hash.each { |k, v| v.each { |v1| errors.add(k, v1) } }
end
end
end
end
end
| brodock/hello | lib/hello/business/management/reset_password.rb | Ruby | mit | 812 |
#region Copyright
//
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2016
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
#region Usings
using Telerik.Web.UI;
#endregion
namespace DotNetNuke.Web.UI.WebControls
{
public class DnnInputManager : RadInputManager
{
}
} | yiji/Dnn.Platform | DNN Platform/DotNetNuke.Web.Deprecated/UI/WebControls/DnnInputManager.cs | C# | mit | 1,363 |
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
namespace Js
{
#ifdef TARGET_64
// This base class has a 4-byte length field. Change struct pack to 4 on 64bit to avoid 4 padding bytes here.
#pragma pack(push, 4)
#endif
//
// A base class for all array-like objects types, that can serve as an Object's internal array:
// JavascriptArray/ES5Array or TypedArray.
//
class ArrayObject : public DynamicObject
{
protected:
Field(uint32) length;
protected:
DEFINE_VTABLE_CTOR_ABSTRACT(ArrayObject, DynamicObject);
ArrayObject(DynamicType * type, bool initSlots = true, uint32 length = 0)
: DynamicObject(type, initSlots), length(length)
{
}
ArrayObject(DynamicType * type, ScriptContext * scriptContext)
: DynamicObject(type, scriptContext), length(0)
{
}
// For boxing stack instance
ArrayObject(ArrayObject * instance, bool deepCopy);
void __declspec(noreturn) ThrowItemNotConfigurableError(PropertyId propId = Constants::NoProperty);
void VerifySetItemAttributes(PropertyId propId, PropertyAttributes attributes);
public:
uint32 GetLength() const { return length; }
static uint32 GetOffsetOfLength() { return offsetof(ArrayObject, length); }
// objectArray support
virtual BOOL SetItemWithAttributes(uint32 index, Var value, PropertyAttributes attributes) = 0;
virtual BOOL SetItemAttributes(uint32 index, PropertyAttributes attributes);
virtual BOOL SetItemAccessors(uint32 index, Var getter, Var setter);
virtual BOOL IsObjectArrayFrozen();
virtual JavascriptEnumerator * GetIndexEnumerator(EnumeratorFlags flags, ScriptContext* requestContext) = 0;
};
#ifdef TARGET_64
#pragma pack(pop)
#endif
} // namespace Js
| Microsoft/ChakraCore | lib/Runtime/Types/ArrayObject.h | C | mit | 2,179 |
(function(){
'use strict';
angular
.module('app')
.factory('ceUsers', ceUsers);
ceUsers.$inject = ['$resource'];
function ceUsers ($resource) {
console.log('ok');
return $resource('https://mysterious-eyrie-9135.herokuapp.com/users/:username',
{username: '@username'},
{'update': { method: 'PUT'}}
);
}
})();
| ArnaudBertrand/CookeasyWeb | src/app/resources/users.resource.js | JavaScript | mit | 351 |
<?php
/**
* Version : 1.2.0
* Author : inc2734
* Author URI : http://2inc.org
* Created : April 17, 2015
* Modified : July 31, 2015
* License : GPLv2 or later
* License URI: license.txt
*/
?>
<div class="container">
<div class="row">
<div class="col-md-9">
<main id="main" role="main">
<?php Habakiri::the_bread_crumb(); ?>
<?php
$name = ( is_search() ) ? 'search' : 'archive';
get_template_part( 'content', $name );
?>
<!-- end #main --></main>
<!-- end .col-md-9 --></div>
<div class="col-md-3">
<?php get_sidebar(); ?>
<!-- end .col-md-3 --></div>
<!-- end .row --></div>
<!-- end .container --></div> | OopsMouse/mori.site | www/wordpress/wp-content/themes/habakiri/blog_templates/archive/right-sidebar.php | PHP | mit | 670 |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Db
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* Zend_Exception
*/
/**
* @category Zend
* @package Zend_Db
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Exception extends Zend_Exception
{
}
| musicsnap/LearnCode | php/code/yaf/application/library/Zend/Db/Exception.php | PHP | mit | 1,039 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Newtonsoft.Json.Linq;
using ReactNative.Bridge;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ReactNative.Tests.Bridge
{
[TestClass]
public class ReactInstanceTests
{
[TestMethod]
public async Task ReactInstance_GetModules()
{
var module = new TestNativeModule();
var reactContext = new ReactContext();
var registry = new NativeModuleRegistry.Builder(reactContext)
.Add(module)
.Build();
var executor = new MockJavaScriptExecutor
{
OnCallFunctionReturnFlushedQueue = (_, __, ___) => JValue.CreateNull(),
OnFlushQueue = () => JValue.CreateNull(),
OnInvokeCallbackAndReturnFlushedQueue = (_, __) => JValue.CreateNull()
};
var builder = new ReactInstance.Builder()
{
QueueConfiguration = TestReactQueueConfiguration.Create(_ => { }),
Registry = registry,
JavaScriptExecutorFactory = () => executor,
BundleLoader = JavaScriptBundleLoader.CreateFileLoader("ms-appx:///Resources/test.js"),
};
var instance = await DispatcherHelpers.CallOnDispatcherAsync(() => builder.Build());
reactContext.InitializeWithInstance(instance);
var actualModule = instance.GetNativeModule<TestNativeModule>();
Assert.AreSame(module, actualModule);
var firstJSModule = instance.GetJavaScriptModule<TestJavaScriptModule>();
var secondJSModule = instance.GetJavaScriptModule<TestJavaScriptModule>();
Assert.AreSame(firstJSModule, secondJSModule);
await DispatcherHelpers.CallOnDispatcherAsync(instance.DisposeAsync);
}
[TestMethod]
public async Task ReactInstance_Initialize_Dispose()
{
var mre = new ManualResetEvent(false);
var module = new TestNativeModule
{
OnInitialized = () => mre.Set(),
};
var reactContext = new ReactContext();
var registry = new NativeModuleRegistry.Builder(reactContext)
.Add(module)
.Build();
var executor = new MockJavaScriptExecutor
{
OnCallFunctionReturnFlushedQueue = (_, __, ___) => JValue.CreateNull(),
OnFlushQueue = () => JValue.CreateNull(),
OnInvokeCallbackAndReturnFlushedQueue = (_, __) => JValue.CreateNull()
};
var builder = new ReactInstance.Builder()
{
QueueConfiguration = TestReactQueueConfiguration.Create(_ => { }),
Registry = registry,
JavaScriptExecutorFactory = () => executor,
BundleLoader = JavaScriptBundleLoader.CreateFileLoader("ms-appx:///Resources/test.js"),
};
var instance = await DispatcherHelpers.CallOnDispatcherAsync(() => builder.Build());
reactContext.InitializeWithInstance(instance);
await DispatcherHelpers.CallOnDispatcherAsync(async () => await instance.InitializeAsync());
var caught = false;
await DispatcherHelpers.CallOnDispatcherAsync(async () =>
{
try
{
await instance.InitializeAsync();
}
catch (InvalidOperationException)
{
caught = true;
}
});
Assert.IsTrue(caught);
mre.WaitOne();
Assert.AreEqual(1, module.InitializeCalls);
await DispatcherHelpers.CallOnDispatcherAsync(instance.DisposeAsync);
Assert.AreEqual(1, module.OnReactInstanceDisposeCalls);
// Dispose is idempotent
await DispatcherHelpers.CallOnDispatcherAsync(instance.DisposeAsync);
Assert.AreEqual(1, module.OnReactInstanceDisposeCalls);
Assert.IsTrue(instance.IsDisposed);
}
[TestMethod]
public async Task ReactInstance_ExceptionHandled_DoesNotDispose()
{
var eventHandler = new AutoResetEvent(false);
var module = new OnDisposeNativeModule(() => eventHandler.Set());
var registry = new NativeModuleRegistry.Builder(new ReactContext())
.Add(module)
.Build();
var executor = new MockJavaScriptExecutor
{
OnCallFunctionReturnFlushedQueue = (_, __, ___) => JValue.CreateNull(),
OnFlushQueue = () => JValue.CreateNull(),
OnInvokeCallbackAndReturnFlushedQueue = (_, __) => JValue.CreateNull()
};
var exception = new Exception();
var tcs = new TaskCompletionSource<Exception>(TaskCreationOptions.RunContinuationsAsynchronously);
var builder = new ReactInstance.Builder()
{
QueueConfiguration = TestReactQueueConfiguration.Create(tcs.SetResult),
Registry = registry,
JavaScriptExecutorFactory = () => executor,
BundleLoader = JavaScriptBundleLoader.CreateFileLoader("ms-appx:///Resources/test.js"),
};
var instance = await DispatcherHelpers.CallOnDispatcherAsync(() => builder.Build());
instance.QueueConfiguration.JavaScriptQueue.Dispatch(() =>
{
throw exception;
});
var actualException = await tcs.Task;
Assert.AreSame(exception, actualException);
Assert.IsFalse(eventHandler.WaitOne(500));
Assert.IsFalse(instance.IsDisposed);
}
class TestNativeModule : NativeModuleBase
{
public Action OnInitialized
{
get;
set;
}
public int InitializeCalls
{
get;
set;
}
public int OnReactInstanceDisposeCalls
{
get;
set;
}
public override string Name
{
get
{
return "Test";
}
}
public override void Initialize()
{
InitializeCalls++;
OnInitialized?.Invoke();
}
public override Task OnReactInstanceDisposeAsync()
{
OnReactInstanceDisposeCalls++;
return Task.CompletedTask;
}
}
class OnDisposeNativeModule : NativeModuleBase
{
private readonly Action _onDispose;
public OnDisposeNativeModule(Action onDispose)
{
_onDispose = onDispose;
}
public override string Name
{
get
{
return "Test";
}
}
public override Task OnReactInstanceDisposeAsync()
{
_onDispose();
return Task.CompletedTask;
}
}
class TestJavaScriptModule : JavaScriptModuleBase
{
}
}
}
| bluejeans/react-native-windows | ReactWindows/ReactNative.Tests/Bridge/ReactInstanceTests.cs | C# | mit | 7,510 |
using System;
using Machine.Specifications;
namespace FactoryGirl.NET.Specs {
[Subject(typeof(FactoryGirl))]
public class FactoryGirlSpecs : ICleanupAfterEveryContextInAssembly {
[Subject(typeof(FactoryGirl))]
public class When_we_define_a_factory {
Establish context = () => { };
Because of = () => FactoryGirl.Define(() => new Dummy());
It should_contain_the_definition = () => FactoryGirl.DefinedFactories.ShouldContain(typeof(Dummy));
}
[Subject(typeof(FactoryGirl))]
public class When_a_factory_has_been_defined {
Establish context = () => FactoryGirl.Define(() => new Dummy());
[Subject(typeof(FactoryGirl))]
public class When_we_define_the_same_factory_again {
Because of = () => exception = Catch.Exception(() => FactoryGirl.Define(() => new Dummy()));
It should_throw_a_DuplicateFactoryException = () => exception.ShouldBeOfType<DuplicateFactoryException>();
static Exception exception;
}
[Subject(typeof(FactoryGirl))]
public class When_we_build_a_default_object {
Because of = () => builtObject = FactoryGirl.Build<Dummy>();
It should_build_the_object = () => builtObject.ShouldNotBeNull();
It should_assign_the_default_value_for_the_property = () => builtObject.Value.ShouldEqual(Dummy.DefaultValue);
static Dummy builtObject;
}
[Subject(typeof(FactoryGirl))]
public class When_we_build_a_customized_object {
Because of = () => builtObject = FactoryGirl.Build<Dummy>(x => x.Value = 42);
It should_update_the_specified_value = () => builtObject.Value.ShouldEqual(42);
static Dummy builtObject;
}
}
public void AfterContextCleanup() {
FactoryGirl.ClearFactoryDefinitions();
}
}
} | junshao/FactoryGirl.NET | FactoryGirl.NET.Specs/FactoryGirlSpecs.cs | C# | mit | 2,054 |
"""
A Pygments lexer for Magpie.
"""
from setuptools import setup
__author__ = 'Robert Nystrom'
setup(
name='Magpie',
version='1.0',
description=__doc__,
author=__author__,
packages=['magpie'],
entry_points='''
[pygments.lexers]
magpielexer = magpie:MagpieLexer
'''
) | munificent/magpie-optionally-typed | doc/site/magpie/setup.py | Python | mit | 305 |
'use strict';
import gulp from 'gulp';
import gutil from 'gulp-util';
import uglify from 'gulp-uglify';
import stylus from 'gulp-stylus';
import watch from 'gulp-watch';
import plumber from 'gulp-plumber';
import cleanCss from 'gulp-clean-css';
import imagemin from 'gulp-imagemin';
import concat from 'gulp-concat';
import babel from 'gulp-babel';
// Minificação dos arquivos .js
gulp.task('minjs', () => {
return gulp
// Define a origem dos arquivos .js
.src(['src/js/**/*.js'])
// Prevençãao de erros
.pipe(plumber())
// Suporte para o padrão ES6
.pipe(babel({
presets: ['es2015']
}))
// Realiza minificação
.pipe(uglify())
// Altera a extenção do arquivo
.pipe(concat('app.min.js'))
// Salva os arquivos minificados na pasta de destino
.pipe(gulp.dest('dist/js'));
});
gulp.task('stylus', () => {
return gulp
// Define a origem dos arquivos .scss
.src('src/stylus/**/*.styl')
// Prevençãao de erros
.pipe(plumber())
// Realiza o pré-processamento para css
.pipe(stylus())
// Realiza a minificação do css
.pipe(cleanCss())
// Altera a extenção do arquivo
.pipe(concat('style.min.css'))
// Salva os arquivos processados na pasta de destino
.pipe(gulp.dest('dist/css'));
});
gulp.task('images', () =>
gulp.src('src/assets/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/assets'))
);
gulp.task('watch', function() {
gulp.start('default')
gulp.watch('src/js/**/*.js', ['minjs'])
gulp.watch('src/stylus/**/*.styl', ['stylus'])
gulp.watch('src/assets/*', ['images'])
});
gulp.task('default', ['minjs', 'stylus', 'images']);
| davidalves1/missas-sao-pedro | gulpfile.babel.js | JavaScript | mit | 1,796 |
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEveCorporationMemberSecurityLog extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('corporation_msec_log', function(Blueprint $table)
{
$table->increments('id');
$table->integer('corporationID');
$table->integer('characterID');
$table->string('characterName');
$table->dateTime('changeTime');
$table->integer('issuerID');
$table->string('issuerName');
$table->string('roleLocationType');
$table->string('hash')->unique();
// Indexes
$table->index('characterID');
$table->index('corporationID');
$table->index('hash');
$table->timestamps();
});
}
// changeTime,characterID,issuerID,roleLocationType
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('corporation_msec_log');
}
}
| omgninjaz/seat | app/database/migrations/2014_04_03_071610_CreateEveCorporationMemberSecurityLog.php | PHP | mit | 959 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>PCAP Report</title>
<!-- Bootstrap core CSS -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
html,
body { height:100% }
</style>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Sample View for {{md5}} md5</h1>
</div>
<pre>{{md5_view|pprint}}</pre>
</div>
</body>
</html> | djtotten/workbench | workbench/clients/static/templates/md5_view.html | HTML | mit | 970 |
require 'shellwords'
require 'fileutils'
module Hibiki
class Downloading
CH_NAME = 'hibiki'
def initialize
@a = Mechanize.new
@a.user_agent_alias = 'Windows Chrome'
end
def download(program)
infos = get_infos(program)
if infos['episode']['id'] != program.episode_id
Rails.logger.error("episode outdated. title=#{program.title} expected_episode_id=#{program.episode_id} actual_episode_id=#{infos['episode']['id']}")
program.state = HibikiProgramV2::STATE[:outdated]
return
end
live_flg = infos['episode'].try(:[], 'video').try(:[], 'live_flg')
if live_flg == nil || live_flg == true
program.state = HibikiProgramV2::STATE[:not_downloadable]
return
end
url = get_m3u8_url(infos['episode']['video']['id'])
unless download_hls(program, url)
program.state = HibikiProgramV2::STATE[:failed]
return
end
program.state = HibikiProgramV2::STATE[:done]
end
def get_infos(program)
res = get_api("https://vcms-api.hibiki-radio.jp/api/v1/programs/#{program.access_id}")
infos = JSON.parse(res.body)
end
def get_m3u8_url(video_id)
res = get_api("https://vcms-api.hibiki-radio.jp/api/v1/videos/play_check?video_id=#{video_id}")
play_infos = JSON.parse(res.body)
play_infos['playlist_url']
end
def download_hls(program, m3u8_url)
file_path = Main::file_path_working(CH_NAME, title(program), 'mp4')
arg = "\
-loglevel error \
-y \
-i #{Shellwords.escape(m3u8_url)} \
-vcodec copy -acodec copy -bsf:a aac_adtstoasc \
#{Shellwords.escape(file_path)}"
Main::prepare_working_dir(CH_NAME)
exit_status, output = Main::ffmpeg(arg)
unless exit_status.success?
Rails.logger.error "rec failed. program:#{program}, exit_status:#{exit_status}, output:#{output}"
return false
end
if output.present?
Rails.logger.warn "hibiki ffmpeg command:#{arg} output:#{output}"
end
Main::move_to_archive_dir(CH_NAME, program.created_at, file_path)
true
end
def get_api(url)
@a.get(
url,
[],
"http://hibiki-radio.jp/",
'X-Requested-With' => 'XMLHttpRequest',
'Origin' => 'http://hibiki-radio.jp'
)
end
def title(program)
date = program.created_at.strftime('%Y_%m_%d')
title = "#{date}_#{program.title}_#{program.episode_name}"
if program.cast.present?
cast = program.cast.gsub(',', ' ')
title += "_#{cast}"
end
title
end
end
end
| t-ashula/net-radio-archive | lib/hibiki/downloading.rb | Ruby | mit | 2,639 |
---
date: 2014-10-23
title: Open Source at Facebook
speaker: Patrick Shuff from Facebook
type: Meeting
---
Thursday, 2014-10-23 at 7:00pm in Caldwell Labs 120, Patrick Shuff (an engineer at Facebook) will present "Open Source at Facebook". Description follows:
Facebook serves requests for over 1.3 billion people every month. I will give a brief overview of our Traffic/CDN (e.g. images and videos) infrastructure and how open source software is core to being able to deliver all of those bits to the world every day!
Laptops are encouraged but not required, and as always, there will be pizza.
| OSUOSC/open-source-club-website | _events/2014-10-23-open-source-at-facebook.md | Markdown | mit | 599 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="bs" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>buynowcoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The buynowcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your buynowcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-58"/>
<source>buynowcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show information about buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send coins to a buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-202"/>
<source>buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+180"/>
<source>&About buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>buynowcoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to buynowcoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About buynowcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about buynowcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid buynowcoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. buynowcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid buynowcoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>buynowcoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start buynowcoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start buynowcoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the buynowcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the buynowcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting buynowcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show buynowcoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting buynowcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the buynowcoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the buynowcoin-Qt help message to get a list with possible buynowcoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>buynowcoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>buynowcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the buynowcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the buynowcoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 BTC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>123.456 BTC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a buynowcoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a buynowcoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified buynowcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a buynowcoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter buynowcoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation>Sve</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Danas</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Ovaj mjesec</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Prošli mjesec</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Ove godine</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>buynowcoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or buynowcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: buynowcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: buynowcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong buynowcoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=buynowcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "buynowcoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. buynowcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of buynowcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart buynowcoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. buynowcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | buynowcoin/buynowcoin | src/qt/locale/bitcoin_bs.ts | TypeScript | mit | 108,053 |
require File.dirname(__FILE__) + '/init'
class NamedRouteCollectionTest < Test::Unit::TestCase
def setup
@controller = TestController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@request.host = 'example.com'
ActionController::UrlWriter.default_url_options[:host] = nil
ActionController::Base.relative_url_root = nil
end
def test_should_alias_method_chain_url_helpers
[ActionController::Base, ActionView::Base].each do |klass|
assert klass.method_defined?(:normal_action_url_with_proxy)
assert klass.method_defined?(:normal_action_url_without_proxy)
end
end
def test_should_not_alias_method_chain_path_helpers
[ActionController::Base, ActionView::Base].each do |klass|
assert !klass.method_defined?(:normal_action_path_with_proxy)
assert !klass.method_defined?(:normal_action_path_without_proxy)
end
end
end | shuber/proxy | test/named_route_collection_test.rb | Ruby | mit | 950 |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M21 17h-1v-6c0-1.1-.9-2-2-2H7v-.74c0-.46-.56-.7-.89-.37L4.37 9.63c-.2.2-.2.53 0 .74l1.74 1.74c.33.33.89.1.89-.37V11h4v3H5c-.55 0-1 .45-1 1v2c0 1.1.9 2 2 2h2c0 1.66 1.34 3 3 3s3-1.34 3-3h7c.55 0 1-.45 1-1s-.45-1-1-1zm-10 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm7-6h-4v-3h3c.55 0 1 .45 1 1v2zm-8-8h7v.74c0 .46.56.7.89.37l1.74-1.74c.2-.2.2-.53 0-.74l-1.74-1.74c-.33-.33-.89-.1-.89.37V4h-7c-.55 0-1 .45-1 1s.45 1 1 1z"
}), 'RvHookupRounded');
exports.default = _default; | oliviertassinari/material-ui | packages/mui-icons-material/lib/RvHookupRounded.js | JavaScript | mit | 894 |
import { set } from 'ember-metal';
import { jQuery } from 'ember-views';
import { moduleFor, RenderingTest } from '../../utils/test-case';
import { Component, compile } from '../../utils/helpers';
import { strip } from '../../utils/abstract-test-case';
class AbstractAppendTest extends RenderingTest {
constructor() {
super();
this.components = [];
this.ids = [];
}
teardown() {
this.component = null;
this.components.forEach(component => {
this.runTask(() => component.destroy());
});
this.ids.forEach(id => {
let $element = jQuery(id).remove();
this.assert.strictEqual($element.length, 0, `Should not leak element: #${id}`);
});
super();
}
/* abstract append(component): Element; */
didAppend(component) {
this.components.push(component);
this.ids.push(component.elementId);
}
['@test lifecycle hooks during component append'](assert) {
let hooks = [];
let oldRegisterComponent = this.registerComponent;
let componentsByName = {};
// TODO: refactor/combine with other life-cycle tests
this.registerComponent = function(name, _options) {
function pushHook(hookName) {
hooks.push([name, hookName]);
}
let options = {
ComponentClass: _options.ComponentClass.extend({
init() {
expectDeprecation(() => { this._super(...arguments); }, /didInitAttrs called/);
if (name in componentsByName) {
throw new TypeError('Component named: ` ' + name + ' ` already registered');
}
componentsByName[name] = this;
pushHook('init');
this.on('init', () => pushHook('on(init)'));
},
didInitAttrs(options) {
pushHook('didInitAttrs', options);
},
didReceiveAttrs() {
pushHook('didReceiveAttrs');
},
willInsertElement() {
pushHook('willInsertElement');
},
willRender() {
pushHook('willRender');
},
didInsertElement() {
pushHook('didInsertElement');
},
didRender() {
pushHook('didRender');
},
didUpdateAttrs() {
pushHook('didUpdateAttrs');
},
willUpdate() {
pushHook('willUpdate');
},
didUpdate() {
pushHook('didUpdate');
},
willDestroyElement() {
pushHook('willDestroyElement');
},
willClearRender() {
pushHook('willClearRender');
},
didDestroyElement() {
pushHook('didDestroyElement');
},
willDestroy() {
pushHook('willDestroy');
this._super(...arguments);
}
}),
template: _options.template
};
oldRegisterComponent.call(this, name, options);
};
this.registerComponent('x-parent', {
ComponentClass: Component.extend({
layoutName: 'components/x-parent'
}),
template: '[parent: {{foo}}]{{#x-child bar=foo}}[yielded: {{foo}}]{{/x-child}}'
});
this.registerComponent('x-child', {
ComponentClass: Component.extend({
tagName: ''
}),
template: '[child: {{bar}}]{{yield}}'
});
let XParent = this.owner._lookupFactory('component:x-parent');
this.component = XParent.create({ foo: 'zomg' });
assert.deepEqual(hooks, [
['x-parent', 'init'],
['x-parent', 'didInitAttrs'],
['x-parent', 'didReceiveAttrs'],
['x-parent', 'on(init)']
], 'creation of x-parent');
hooks.length = 0;
this.element = this.append(this.component);
assert.deepEqual(hooks, [
['x-parent', 'willInsertElement'],
['x-child', 'init'],
['x-child', 'didInitAttrs'],
['x-child', 'didReceiveAttrs'],
['x-child', 'on(init)'],
['x-child', 'willRender'],
['x-child', 'willInsertElement'],
['x-child', 'didInsertElement'],
['x-child', 'didRender'],
['x-parent', 'didInsertElement'],
['x-parent', 'didRender']
], 'appending of x-parent');
hooks.length = 0;
this.runTask(() => componentsByName['x-parent'].rerender());
assert.deepEqual(hooks, [
['x-parent', 'willUpdate'],
['x-parent', 'willRender'],
['x-parent', 'didUpdate'],
['x-parent', 'didRender']
], 'rerender x-parent');
hooks.length = 0;
this.runTask(() => componentsByName['x-child'].rerender());
assert.deepEqual(hooks, [
['x-parent', 'willUpdate'],
['x-parent', 'willRender'],
['x-child', 'willUpdate'],
['x-child', 'willRender'],
['x-child', 'didUpdate'],
['x-child', 'didRender'],
['x-parent', 'didUpdate'],
['x-parent', 'didRender']
], 'rerender x-child');
hooks.length = 0;
this.runTask(() => set(this.component, 'foo', 'wow'));
assert.deepEqual(hooks, [
['x-parent', 'willUpdate'],
['x-parent', 'willRender'],
['x-child', 'didUpdateAttrs'],
['x-child', 'didReceiveAttrs'],
['x-child', 'willUpdate'],
['x-child', 'willRender'],
['x-child', 'didUpdate'],
['x-child', 'didRender'],
['x-parent', 'didUpdate'],
['x-parent', 'didRender']
], 'set foo = wow');
hooks.length = 0;
this.runTask(() => set(this.component, 'foo', 'zomg'));
assert.deepEqual(hooks, [
['x-parent', 'willUpdate'],
['x-parent', 'willRender'],
['x-child', 'didUpdateAttrs'],
['x-child', 'didReceiveAttrs'],
['x-child', 'willUpdate'],
['x-child', 'willRender'],
['x-child', 'didUpdate'],
['x-child', 'didRender'],
['x-parent', 'didUpdate'],
['x-parent', 'didRender']
], 'set foo = zomg');
hooks.length = 0;
this.runTask(() => this.component.destroy());
assert.deepEqual(hooks, [
['x-parent', 'willDestroyElement'],
['x-parent', 'willClearRender'],
['x-child', 'willDestroyElement'],
['x-child', 'willClearRender'],
['x-child', 'didDestroyElement'],
['x-parent', 'didDestroyElement'],
['x-parent', 'willDestroy'],
['x-child', 'willDestroy']
], 'destroy');
}
['@test appending, updating and destroying a single component'](assert) {
let willDestroyCalled = 0;
this.registerComponent('x-parent', {
ComponentClass: Component.extend({
layoutName: 'components/x-parent',
willDestroyElement() {
willDestroyCalled++;
}
}),
template: '[parent: {{foo}}]{{#x-child bar=foo}}[yielded: {{foo}}]{{/x-child}}'
});
this.registerComponent('x-child', {
ComponentClass: Component.extend({
tagName: ''
}),
template: '[child: {{bar}}]{{yield}}'
});
let XParent = this.owner._lookupFactory('component:x-parent');
this.component = XParent.create({ foo: 'zomg' });
assert.ok(!this.component.element, 'precond - should not have an element');
this.element = this.append(this.component);
let componentElement = this.component.element;
this.assertComponentElement(componentElement, { content: '[parent: zomg][child: zomg][yielded: zomg]' });
assert.equal(componentElement.parentElement, this.element, 'It should be attached to the target');
this.runTask(() => this.rerender());
this.assertComponentElement(componentElement, { content: '[parent: zomg][child: zomg][yielded: zomg]' });
assert.equal(componentElement.parentElement, this.element, 'It should be attached to the target');
this.runTask(() => set(this.component, 'foo', 'wow'));
this.assertComponentElement(componentElement, { content: '[parent: wow][child: wow][yielded: wow]' });
assert.equal(componentElement.parentElement, this.element, 'It should be attached to the target');
this.runTask(() => set(this.component, 'foo', 'zomg'));
this.assertComponentElement(componentElement, { content: '[parent: zomg][child: zomg][yielded: zomg]' });
assert.equal(componentElement.parentElement, this.element, 'It should be attached to the target');
this.runTask(() => this.component.destroy());
if (this.isHTMLBars) {
// Bug in Glimmer – component should not have .element at this point
assert.ok(!this.component.element, 'It should not have an element');
}
assert.ok(!componentElement.parentElement, 'The component element should be detached');
this.assert.equal(willDestroyCalled, 1);
}
['@test appending, updating and destroying multiple components'](assert) {
let willDestroyCalled = 0;
this.registerComponent('x-first', {
ComponentClass: Component.extend({
layoutName: 'components/x-first',
willDestroyElement() {
willDestroyCalled++;
}
}),
template: 'x-first {{foo}}!'
});
this.registerComponent('x-second', {
ComponentClass: Component.extend({
layoutName: 'components/x-second',
willDestroyElement() {
willDestroyCalled++;
}
}),
template: 'x-second {{bar}}!'
});
let First = this.owner._lookupFactory('component:x-first');
let Second = this.owner._lookupFactory('component:x-second');
let first = First.create({ foo: 'foo' });
let second = Second.create({ bar: 'bar' });
this.assert.ok(!first.element, 'precond - should not have an element');
this.assert.ok(!second.element, 'precond - should not have an element');
let wrapper1, wrapper2;
this.runTask(() => wrapper1 = this.append(first));
this.runTask(() => wrapper2 = this.append(second));
let componentElement1 = first.element;
let componentElement2 = second.element;
this.assertComponentElement(componentElement1, { content: 'x-first foo!' });
this.assertComponentElement(componentElement2, { content: 'x-second bar!' });
assert.equal(componentElement1.parentElement, wrapper1, 'The first component should be attached to the target');
assert.equal(componentElement2.parentElement, wrapper2, 'The second component should be attached to the target');
this.runTask(() => set(first, 'foo', 'FOO'));
this.assertComponentElement(componentElement1, { content: 'x-first FOO!' });
this.assertComponentElement(componentElement2, { content: 'x-second bar!' });
assert.equal(componentElement1.parentElement, wrapper1, 'The first component should be attached to the target');
assert.equal(componentElement2.parentElement, wrapper2, 'The second component should be attached to the target');
this.runTask(() => set(second, 'bar', 'BAR'));
this.assertComponentElement(componentElement1, { content: 'x-first FOO!' });
this.assertComponentElement(componentElement2, { content: 'x-second BAR!' });
assert.equal(componentElement1.parentElement, wrapper1, 'The first component should be attached to the target');
assert.equal(componentElement2.parentElement, wrapper2, 'The second component should be attached to the target');
this.runTask(() => {
set(first, 'foo', 'foo');
set(second, 'bar', 'bar');
});
this.assertComponentElement(componentElement1, { content: 'x-first foo!' });
this.assertComponentElement(componentElement2, { content: 'x-second bar!' });
assert.equal(componentElement1.parentElement, wrapper1, 'The first component should be attached to the target');
assert.equal(componentElement2.parentElement, wrapper2, 'The second component should be attached to the target');
this.runTask(() => {
first.destroy();
second.destroy();
});
if (this.isHTMLBars) {
// Bug in Glimmer – component should not have .element at this point
assert.ok(!first.element, 'The first component should not have an element');
assert.ok(!second.element, 'The second component should not have an element');
}
assert.ok(!componentElement1.parentElement, 'The first component element should be detached');
assert.ok(!componentElement2.parentElement, 'The second component element should be detached');
this.assert.equal(willDestroyCalled, 2);
}
['@test can appendTo while rendering'](assert) {
let owner = this.owner;
let append = (component) => {
return this.append(component);
};
let element1, element2;
this.registerComponent('first-component', {
ComponentClass: Component.extend({
layout: compile('component-one'),
didInsertElement() {
element1 = this.element;
let SecondComponent = owner._lookupFactory('component:second-component');
append(SecondComponent.create());
}
})
});
this.registerComponent('second-component', {
ComponentClass: Component.extend({
layout: compile(`component-two`),
didInsertElement() {
element2 = this.element;
}
})
});
let FirstComponent = this.owner._lookupFactory('component:first-component');
this.runTask(() => append(FirstComponent.create()));
this.assertComponentElement(element1, { content: 'component-one' });
this.assertComponentElement(element2, { content: 'component-two' });
}
['@test can appendTo and remove while rendering'](assert) {
let owner = this.owner;
let append = (component) => {
return this.append(component);
};
let element1, element2, element3, element4, component1, component2;
this.registerComponent('foo-bar', {
ComponentClass: Component.extend({
layout: compile('foo-bar'),
init() {
this._super(...arguments);
component1 = this;
},
didInsertElement() {
element1 = this.element;
let OtherRoot = owner._lookupFactory('component:other-root');
this._instance = OtherRoot.create({
didInsertElement() {
element2 = this.element;
}
});
append(this._instance);
},
willDestroy() {
this._instance.destroy();
}
})
});
this.registerComponent('baz-qux', {
ComponentClass: Component.extend({
layout: compile('baz-qux'),
init() {
this._super(...arguments);
component2 = this;
},
didInsertElement() {
element3 = this.element;
let OtherRoot = owner._lookupFactory('component:other-root');
this._instance = OtherRoot.create({
didInsertElement() {
element4 = this.element;
}
});
append(this._instance);
},
willDestroy() {
this._instance.destroy();
}
})
});
let instantiatedRoots = 0;
let destroyedRoots = 0;
this.registerComponent('other-root', {
ComponentClass: Component.extend({
layout: compile(`fake-thing: {{counter}}`),
init() {
this._super(...arguments);
this.counter = instantiatedRoots++;
},
willDestroy() {
destroyedRoots++;
this._super(...arguments);
}
})
});
this.render(strip`
{{#if showFooBar}}
{{foo-bar}}
{{else}}
{{baz-qux}}
{{/if}}
`, { showFooBar: true });
this.assertComponentElement(element1, { });
this.assertComponentElement(element2, { content: 'fake-thing: 0' });
assert.equal(instantiatedRoots, 1);
this.assertStableRerender();
this.runTask(() => set(this.context, 'showFooBar', false));
assert.equal(instantiatedRoots, 2);
assert.equal(destroyedRoots, 1);
this.assertComponentElement(element3, { });
this.assertComponentElement(element4, { content: 'fake-thing: 1' });
this.runTask(() => {
component1.destroy();
component2.destroy();
});
assert.equal(instantiatedRoots, 2);
assert.equal(destroyedRoots, 2);
}
}
moduleFor('append: no arguments (attaching to document.body)', class extends AbstractAppendTest {
append(component) {
this.runTask(() => component.append());
this.didAppend(component);
return document.body;
}
});
moduleFor('appendTo: a selector', class extends AbstractAppendTest {
append(component) {
this.runTask(() => component.appendTo('#qunit-fixture'));
this.didAppend(component);
return jQuery('#qunit-fixture')[0];
}
['@test raises an assertion when the target does not exist in the DOM'](assert) {
this.registerComponent('foo-bar', {
ComponentClass: Component.extend({
layoutName: 'components/foo-bar'
}),
template: 'FOO BAR!'
});
let FooBar = this.owner._lookupFactory('component:foo-bar');
this.component = FooBar.create();
assert.ok(!this.component.element, 'precond - should not have an element');
this.runTask(() => {
expectAssertion(() => {
this.component.appendTo('#does-not-exist-in-dom');
}, /You tried to append to \(#does-not-exist-in-dom\) but that isn't in the DOM/);
});
assert.ok(!this.component.element, 'component should not have an element');
}
});
moduleFor('appendTo: an element', class extends AbstractAppendTest {
append(component) {
let element = jQuery('#qunit-fixture')[0];
this.runTask(() => component.appendTo(element));
this.didAppend(component);
return element;
}
});
moduleFor('appendTo: with multiple components', class extends AbstractAppendTest {
append(component) {
this.runTask(() => component.appendTo('#qunit-fixture'));
this.didAppend(component);
return jQuery('#qunit-fixture')[0];
}
});
moduleFor('renderToElement: no arguments (defaults to a body context)', class extends AbstractAppendTest {
append(component) {
expectDeprecation(/Using the `renderToElement` is deprecated in favor of `appendTo`. Called in/);
let wrapper;
this.runTask(() => wrapper = component.renderToElement());
this.didAppend(component);
this.assert.equal(wrapper.tagName, 'BODY', 'wrapper is a body element');
this.assert.notEqual(wrapper, document.body, 'wrapper is not document.body');
this.assert.ok(!wrapper.parentNode, 'wrapper is detached');
return wrapper;
}
});
moduleFor('renderToElement: a div', class extends AbstractAppendTest {
append(component) {
expectDeprecation(/Using the `renderToElement` is deprecated in favor of `appendTo`. Called in/);
let wrapper;
this.runTask(() => wrapper = component.renderToElement('div'));
this.didAppend(component);
this.assert.equal(wrapper.tagName, 'DIV', 'wrapper is a body element');
this.assert.ok(!wrapper.parentNode, 'wrapper is detached');
return wrapper;
}
});
| Leooo/ember.js | packages/ember-glimmer/tests/integration/components/append-test.js | JavaScript | mit | 18,760 |
<html lang="en">
<head>
<title>ARM Options - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="ARM_002dDependent.html#ARM_002dDependent" title="ARM-Dependent">
<link rel="next" href="ARM-Syntax.html#ARM-Syntax" title="ARM Syntax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ARM-Options"></a>
Next: <a rel="next" accesskey="n" href="ARM-Syntax.html#ARM-Syntax">ARM Syntax</a>,
Up: <a rel="up" accesskey="u" href="ARM_002dDependent.html#ARM_002dDependent">ARM-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.4.1 Options</h4>
<p><a name="index-ARM-options-_0028none_0029-614"></a><a name="index-options-for-ARM-_0028none_0029-615"></a>
<a name="index-g_t_0040code_007b_002dmcpu_003d_007d-command-line-option_002c-ARM-616"></a>
<dl><dt><code>-mcpu=</code><var>processor</var><code>[+</code><var>extension</var><code>...]</code><dd>This option specifies the target processor. The assembler will issue an
error message if an attempt is made to assemble an instruction which
will not execute on the target processor. The following processor names are
recognized:
<code>arm1</code>,
<code>arm2</code>,
<code>arm250</code>,
<code>arm3</code>,
<code>arm6</code>,
<code>arm60</code>,
<code>arm600</code>,
<code>arm610</code>,
<code>arm620</code>,
<code>arm7</code>,
<code>arm7m</code>,
<code>arm7d</code>,
<code>arm7dm</code>,
<code>arm7di</code>,
<code>arm7dmi</code>,
<code>arm70</code>,
<code>arm700</code>,
<code>arm700i</code>,
<code>arm710</code>,
<code>arm710t</code>,
<code>arm720</code>,
<code>arm720t</code>,
<code>arm740t</code>,
<code>arm710c</code>,
<code>arm7100</code>,
<code>arm7500</code>,
<code>arm7500fe</code>,
<code>arm7t</code>,
<code>arm7tdmi</code>,
<code>arm7tdmi-s</code>,
<code>arm8</code>,
<code>arm810</code>,
<code>strongarm</code>,
<code>strongarm1</code>,
<code>strongarm110</code>,
<code>strongarm1100</code>,
<code>strongarm1110</code>,
<code>arm9</code>,
<code>arm920</code>,
<code>arm920t</code>,
<code>arm922t</code>,
<code>arm940t</code>,
<code>arm9tdmi</code>,
<code>fa526</code> (Faraday FA526 processor),
<code>fa626</code> (Faraday FA626 processor),
<code>arm9e</code>,
<code>arm926e</code>,
<code>arm926ej-s</code>,
<code>arm946e-r0</code>,
<code>arm946e</code>,
<code>arm946e-s</code>,
<code>arm966e-r0</code>,
<code>arm966e</code>,
<code>arm966e-s</code>,
<code>arm968e-s</code>,
<code>arm10t</code>,
<code>arm10tdmi</code>,
<code>arm10e</code>,
<code>arm1020</code>,
<code>arm1020t</code>,
<code>arm1020e</code>,
<code>arm1022e</code>,
<code>arm1026ej-s</code>,
<code>fa606te</code> (Faraday FA606TE processor),
<code>fa616te</code> (Faraday FA616TE processor),
<code>fa626te</code> (Faraday FA626TE processor),
<code>fmp626</code> (Faraday FMP626 processor),
<code>fa726te</code> (Faraday FA726TE processor),
<code>arm1136j-s</code>,
<code>arm1136jf-s</code>,
<code>arm1156t2-s</code>,
<code>arm1156t2f-s</code>,
<code>arm1176jz-s</code>,
<code>arm1176jzf-s</code>,
<code>mpcore</code>,
<code>mpcorenovfp</code>,
<code>cortex-a5</code>,
<code>cortex-a7</code>,
<code>cortex-a8</code>,
<code>cortex-a9</code>,
<code>cortex-a15</code>,
<code>cortex-r4</code>,
<code>cortex-r4f</code>,
<code>cortex-r5</code>,
<code>cortex-r7</code>,
<code>cortex-m7</code>,
<code>cortex-m4</code>,
<code>cortex-m3</code>,
<code>cortex-m1</code>,
<code>cortex-m0</code>,
<code>cortex-m0plus</code>,
<code>ep9312</code> (ARM920 with Cirrus Maverick coprocessor),
<code>i80200</code> (Intel XScale processor)
<code>iwmmxt</code> (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor)
and
<code>xscale</code>.
The special name <code>all</code> may be used to allow the
assembler to accept instructions valid for any ARM processor.
<p>In addition to the basic instruction set, the assembler can be told to
accept various extension mnemonics that extend the processor using the
co-processor instruction space. For example, <code>-mcpu=arm920+maverick</code>
is equivalent to specifying <code>-mcpu=ep9312</code>.
<p>Multiple extensions may be specified, separated by a <code>+</code>. The
extensions should be specified in ascending alphabetical order.
<p>Some extensions may be restricted to particular architectures; this is
documented in the list of extensions below.
<p>Extension mnemonics may also be removed from those the assembler accepts.
This is done be prepending <code>no</code> to the option that adds the extension.
Extensions that are removed should be listed after all extensions which have
been added, again in ascending alphabetical order. For example,
<code>-mcpu=ep9312+nomaverick</code> is equivalent to specifying <code>-mcpu=arm920</code>.
<p>The following extensions are currently supported:
<code>crypto</code> (Cryptography Extensions for v8-A architecture, implies <code>fp+simd</code>),
<code>fp</code> (Floating Point Extensions for v8-A architecture),
<code>idiv</code> (Integer Divide Extensions for v7-A and v7-R architectures),
<code>iwmmxt</code>,
<code>iwmmxt2</code>,
<code>maverick</code>,
<code>mp</code> (Multiprocessing Extensions for v7-A and v7-R architectures),
<code>os</code> (Operating System for v6M architecture),
<code>sec</code> (Security Extensions for v6K and v7-A architectures),
<code>simd</code> (Advanced SIMD Extensions for v8-A architecture, implies <code>fp</code>),
<code>virt</code> (Virtualization Extensions for v7-A architecture, implies
<code>idiv</code>),
and
<code>xscale</code>.
<p><a name="index-g_t_0040code_007b_002dmarch_003d_007d-command-line-option_002c-ARM-617"></a><br><dt><code>-march=</code><var>architecture</var><code>[+</code><var>extension</var><code>...]</code><dd>This option specifies the target architecture. The assembler will issue
an error message if an attempt is made to assemble an instruction which
will not execute on the target architecture. The following architecture
names are recognized:
<code>armv1</code>,
<code>armv2</code>,
<code>armv2a</code>,
<code>armv2s</code>,
<code>armv3</code>,
<code>armv3m</code>,
<code>armv4</code>,
<code>armv4xm</code>,
<code>armv4t</code>,
<code>armv4txm</code>,
<code>armv5</code>,
<code>armv5t</code>,
<code>armv5txm</code>,
<code>armv5te</code>,
<code>armv5texp</code>,
<code>armv6</code>,
<code>armv6j</code>,
<code>armv6k</code>,
<code>armv6z</code>,
<code>armv6zk</code>,
<code>armv6-m</code>,
<code>armv6s-m</code>,
<code>armv7</code>,
<code>armv7-a</code>,
<code>armv7ve</code>,
<code>armv7-r</code>,
<code>armv7-m</code>,
<code>armv7e-m</code>,
<code>armv8-a</code>,
<code>iwmmxt</code>
and
<code>xscale</code>.
If both <code>-mcpu</code> and
<code>-march</code> are specified, the assembler will use
the setting for <code>-mcpu</code>.
<p>The architecture option can be extended with the same instruction set
extension options as the <code>-mcpu</code> option.
<p><a name="index-g_t_0040code_007b_002dmfpu_003d_007d-command-line-option_002c-ARM-618"></a><br><dt><code>-mfpu=</code><var>floating-point-format</var><dd>
This option specifies the floating point format to assemble for. The
assembler will issue an error message if an attempt is made to assemble
an instruction which will not execute on the target floating point unit.
The following format options are recognized:
<code>softfpa</code>,
<code>fpe</code>,
<code>fpe2</code>,
<code>fpe3</code>,
<code>fpa</code>,
<code>fpa10</code>,
<code>fpa11</code>,
<code>arm7500fe</code>,
<code>softvfp</code>,
<code>softvfp+vfp</code>,
<code>vfp</code>,
<code>vfp10</code>,
<code>vfp10-r0</code>,
<code>vfp9</code>,
<code>vfpxd</code>,
<code>vfpv2</code>,
<code>vfpv3</code>,
<code>vfpv3-fp16</code>,
<code>vfpv3-d16</code>,
<code>vfpv3-d16-fp16</code>,
<code>vfpv3xd</code>,
<code>vfpv3xd-d16</code>,
<code>vfpv4</code>,
<code>vfpv4-d16</code>,
<code>fpv4-sp-d16</code>,
<code>fpv5-sp-d16</code>,
<code>fpv5-d16</code>,
<code>fp-armv8</code>,
<code>arm1020t</code>,
<code>arm1020e</code>,
<code>arm1136jf-s</code>,
<code>maverick</code>,
<code>neon</code>,
<code>neon-vfpv4</code>,
<code>neon-fp-armv8</code>,
and
<code>crypto-neon-fp-armv8</code>.
<p>In addition to determining which instructions are assembled, this option
also affects the way in which the <code>.double</code> assembler directive behaves
when assembling little-endian code.
<p>The default is dependent on the processor selected. For Architecture 5 or
later, the default is to assembler for VFP instructions; for earlier
architectures the default is to assemble for FPA instructions.
<p><a name="index-g_t_0040code_007b_002dmthumb_007d-command-line-option_002c-ARM-619"></a><br><dt><code>-mthumb</code><dd>This option specifies that the assembler should start assembling Thumb
instructions; that is, it should behave as though the file starts with a
<code>.code 16</code> directive.
<p><a name="index-g_t_0040code_007b_002dmthumb_002dinterwork_007d-command-line-option_002c-ARM-620"></a><br><dt><code>-mthumb-interwork</code><dd>This option specifies that the output generated by the assembler should
be marked as supporting interworking.
<p><a name="index-g_t_0040code_007b_002dmimplicit_002dit_007d-command-line-option_002c-ARM-621"></a><br><dt><code>-mimplicit-it=never</code><dt><code>-mimplicit-it=always</code><dt><code>-mimplicit-it=arm</code><dt><code>-mimplicit-it=thumb</code><dd>The <code>-mimplicit-it</code> option controls the behavior of the assembler when
conditional instructions are not enclosed in IT blocks.
There are four possible behaviors.
If <code>never</code> is specified, such constructs cause a warning in ARM
code and an error in Thumb-2 code.
If <code>always</code> is specified, such constructs are accepted in both
ARM and Thumb-2 code, where the IT instruction is added implicitly.
If <code>arm</code> is specified, such constructs are accepted in ARM code
and cause an error in Thumb-2 code.
If <code>thumb</code> is specified, such constructs cause a warning in ARM
code and are accepted in Thumb-2 code. If you omit this option, the
behavior is equivalent to <code>-mimplicit-it=arm</code>.
<p><a name="index-g_t_0040code_007b_002dmapcs_002d26_007d-command-line-option_002c-ARM-622"></a><a name="index-g_t_0040code_007b_002dmapcs_002d32_007d-command-line-option_002c-ARM-623"></a><br><dt><code>-mapcs-26</code><dt><code>-mapcs-32</code><dd>These options specify that the output generated by the assembler should
be marked as supporting the indicated version of the Arm Procedure.
Calling Standard.
<p><a name="index-g_t_0040code_007b_002dmatpcs_007d-command-line-option_002c-ARM-624"></a><br><dt><code>-matpcs</code><dd>This option specifies that the output generated by the assembler should
be marked as supporting the Arm/Thumb Procedure Calling Standard. If
enabled this option will cause the assembler to create an empty
debugging section in the object file called .arm.atpcs. Debuggers can
use this to determine the ABI being used by.
<p><a name="index-g_t_0040code_007b_002dmapcs_002dfloat_007d-command-line-option_002c-ARM-625"></a><br><dt><code>-mapcs-float</code><dd>This indicates the floating point variant of the APCS should be
used. In this variant floating point arguments are passed in FP
registers rather than integer registers.
<p><a name="index-g_t_0040code_007b_002dmapcs_002dreentrant_007d-command-line-option_002c-ARM-626"></a><br><dt><code>-mapcs-reentrant</code><dd>This indicates that the reentrant variant of the APCS should be used.
This variant supports position independent code.
<p><a name="index-g_t_0040code_007b_002dmfloat_002dabi_003d_007d-command-line-option_002c-ARM-627"></a><br><dt><code>-mfloat-abi=</code><var>abi</var><dd>This option specifies that the output generated by the assembler should be
marked as using specified floating point ABI.
The following values are recognized:
<code>soft</code>,
<code>softfp</code>
and
<code>hard</code>.
<p><a name="index-g_t_0040code_007b_002deabi_003d_007d-command-line-option_002c-ARM-628"></a><br><dt><code>-meabi=</code><var>ver</var><dd>This option specifies which EABI version the produced object files should
conform to.
The following values are recognized:
<code>gnu</code>,
<code>4</code>
and
<code>5</code>.
<p><a name="index-g_t_0040code_007b_002dEB_007d-command-line-option_002c-ARM-629"></a><br><dt><code>-EB</code><dd>This option specifies that the output generated by the assembler should
be marked as being encoded for a big-endian processor.
<p><a name="index-g_t_0040code_007b_002dEL_007d-command-line-option_002c-ARM-630"></a><br><dt><code>-EL</code><dd>This option specifies that the output generated by the assembler should
be marked as being encoded for a little-endian processor.
<p><a name="index-g_t_0040code_007b_002dk_007d-command-line-option_002c-ARM-631"></a><a name="index-PIC-code-generation-for-ARM-632"></a><br><dt><code>-k</code><dd>This option specifies that the output of the assembler should be marked
as position-independent code (PIC).
<p><a name="index-g_t_0040code_007b_002d_002dfix_002dv4bx_007d-command-line-option_002c-ARM-633"></a><br><dt><code>--fix-v4bx</code><dd>Allow <code>BX</code> instructions in ARMv4 code. This is intended for use with
the linker option of the same name.
<p><a name="index-g_t_0040code_007b_002dmwarn_002ddeprecated_007d-command-line-option_002c-ARM-634"></a><br><dt><code>-mwarn-deprecated</code><dt><code>-mno-warn-deprecated</code><dd>Enable or disable warnings about using deprecated options or
features. The default is to warn.
</dl>
</body></html>
| trfiladelfo/tdk | gcc-arm-none-eabi/share/doc/gcc-arm-none-eabi/html/as.html/ARM-Options.html | HTML | mit | 14,858 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall.Content.Scene;
using FlatRedBall;
using FlatRedBall.IO;
namespace EditorObjects.EditorSettings
{
public class AIEditorPropertiesSave
{
public const string Extension = "aiep";
public CameraSave BoundsCamera;
public CameraSave Camera = new CameraSave();
public bool BoundsVisible = false;
// For loading.
public AIEditorPropertiesSave()
{
Camera.Z = 40;
// do nothing
}
public void SetFromRuntime(Camera camera, Camera boundsCamera, bool boundsVisible)
{
Camera = CameraSave.FromCamera(camera);
if (boundsCamera != null)
{
BoundsCamera = CameraSave.FromCamera(boundsCamera, true);
}
BoundsVisible = boundsVisible;
// Gui.GuiData.listWindow
}
public static AIEditorPropertiesSave Load(string fileName)
{
AIEditorPropertiesSave toReturn = new AIEditorPropertiesSave();
FileManager.XmlDeserialize(fileName, out toReturn);
return toReturn;
}
public void Save(string fileName)
{
FileManager.XmlSerialize(this, fileName);
}
}
}
| GorillaOne/FlatRedBall | FRBDK/FRBDK Supporting Projects/EditorObjects/EditorSettings/AIEditorPropertiesSave.cs | C# | mit | 1,372 |
pub fn compress(src: &str) -> String {
if src.is_empty() {
src.to_owned()
} else {
let mut compressed = String::new();
let mut chars = src.chars().peekable();
while let Some(c) = chars.peek().cloned() {
let mut counter = 0;
while let Some(n) = chars.peek().cloned() {
if c == n {
counter += 1;
chars.next();
} else {
break;
}
}
compressed.push_str(counter.to_string().as_str());
compressed.push(c);
}
compressed
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn compress_empty_string() {
assert_eq!(compress(""), "");
}
#[test]
fn compress_unique_chars_string() {
assert_eq!(compress("abc"), "1a1b1c");
}
#[test]
fn compress_doubled_chars_string() {
assert_eq!(compress("aabbcc"), "2a2b2c");
}
}
| Alex-Diez/Rust-TDD-Katas | string_compression_kata/src/day_7.rs | Rust | mit | 996 |
require 'spec_helper'
try_spec do
require './spec/fixtures/bookmark'
describe DataMapper::TypesFixtures::Bookmark do
supported_by :all do
before :all do
DataMapper::TypesFixtures::Bookmark.auto_migrate!
end
let(:resource) do
DataMapper::TypesFixtures::Bookmark.create(
:title => 'Check this out',
:uri => uri,
:shared => false,
:tags => %w[ misc ]
)
end
before do
resource.should be_saved
end
context 'without URI' do
let(:uri) { nil }
it 'can be found by uri' do
DataMapper::TypesFixtures::Bookmark.first(:uri => uri).should eql(resource)
end
describe 'when reloaded' do
before do
resource.reload
end
it 'has no uri' do
resource.uri.should be(nil)
end
end
end
describe 'with a blank URI' do
let(:uri) { '' }
it 'can be found by uri' do
DataMapper::TypesFixtures::Bookmark.first(:uri => uri).should eql(resource)
end
describe 'when reloaded' do
before do
resource.reload
end
it 'is loaded as URI object' do
resource.uri.should be_an_instance_of(Addressable::URI)
end
it 'has the same original URI' do
resource.uri.to_s.should eql(uri)
end
end
end
describe 'with invalid URI' do
let(:uri) { 'this is def. not URI' }
it 'is perfectly valid (URI type does not provide auto validations)' do
resource.save.should be(true)
end
end
%w[
http://apple.com
http://www.apple.com
http://apple.com/
http://apple.com/iphone
http://www.google.com/search?client=safari&rls=en-us&q=LED&ie=UTF-8&oe=UTF-8
http://books.google.com
http://books.google.com/
http://db2.clouds.megacorp.net:8080
https://github.com
https://github.com/
http://www.example.com:8088/never/ending/path/segments/
http://db2.clouds.megacorp.net:8080/resources/10
http://www.example.com:8088/never/ending/path/segments
http://books.google.com/books?id=uSUJ3VhH4BsC&printsec=frontcover&dq=subject:%22+Linguistics+%22&as_brr=3&ei=DAHPSbGQE5rEzATk1sShAQ&rview=1
http://books.google.com:80/books?uid=14472359158468915761&rview=1
http://books.google.com/books?id=Ar3-TXCYXUkC&printsec=frontcover&rview=1
http://books.google.com/books/vp6ae081e454d30f89b6bca94e0f96fc14.js
http://www.google.com/images/cleardot.gif
http://books.google.com:80/books?id=Ar3-TXCYXUkC&printsec=frontcover&rview=1#PPA5,M1
http://www.hulu.com/watch/64923/terminator-the-sarah-connor-chronicles-to-the-lighthouse
http://hulu.com:80/browse/popular/tv
http://www.hulu.com/watch/62475/the-simpsons-gone-maggie-gone#s-p1-so-i0
].each do |uri|
describe "with URI set to '#{uri}'" do
let(:uri) { uri }
it 'can be found by uri' do
DataMapper::TypesFixtures::Bookmark.first(:uri => uri).should_not be(nil)
end
describe 'when reloaded' do
before do
resource.reload
end
it 'matches a normalized form of the original URI' do
resource.uri.should eql(Addressable::URI.parse(uri).normalize)
end
end
end
end
end
end
end
| troygnichols/dm-types | spec/integration/uri_spec.rb | Ruby | mit | 3,551 |
import readdirRecursive from "fs-readdir-recursive";
import * as babel from "@babel/core";
import path from "path";
import fs from "fs";
import * as watcher from "./watcher";
export function chmod(src: string, dest: string): void {
try {
fs.chmodSync(dest, fs.statSync(src).mode);
} catch (err) {
console.warn(`Cannot change permissions of ${dest}`);
}
}
type ReaddirFilter = (filename: string) => boolean;
export function readdir(
dirname: string,
includeDotfiles: boolean,
filter?: ReaddirFilter,
): Array<string> {
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
const stat = fs.statSync(path.join(currentDirectory, filename));
if (stat.isDirectory()) return true;
return (
(includeDotfiles || filename[0] !== ".") && (!filter || filter(filename))
);
});
}
export function readdirForCompilable(
dirname: string,
includeDotfiles: boolean,
altExts?: Array<string>,
): Array<string> {
return readdir(dirname, includeDotfiles, function (filename) {
return isCompilableExtension(filename, altExts);
});
}
/**
* Test if a filename ends with a compilable extension.
*/
export function isCompilableExtension(
filename: string,
altExts?: readonly string[],
): boolean {
const exts = altExts || babel.DEFAULT_EXTENSIONS;
const ext = path.extname(filename);
return exts.includes(ext);
}
export function addSourceMappingUrl(code: string, loc: string): string {
return code + "\n//# sourceMappingURL=" + path.basename(loc);
}
const CALLER = {
name: "@babel/cli",
};
export function transformRepl(
filename: string,
code: string,
opts: any,
): Promise<any> {
opts = {
...opts,
caller: CALLER,
filename,
};
return new Promise((resolve, reject) => {
babel.transform(code, opts, (err, result) => {
if (err) reject(err);
else resolve(result);
});
});
}
export async function compile(
filename: string,
opts: any | Function,
): Promise<any> {
opts = {
...opts,
caller: CALLER,
};
// TODO (Babel 8): Use `babel.transformFileAsync`
const result: any = await new Promise((resolve, reject) => {
babel.transformFile(filename, opts, (err, result) => {
if (err) reject(err);
else resolve(result);
});
});
if (result) {
if (!process.env.BABEL_8_BREAKING) {
if (!result.externalDependencies) return result;
}
watcher.updateExternalDependencies(filename, result.externalDependencies);
}
return result;
}
export function deleteDir(path: string): void {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file) {
const curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) {
// recurse
deleteDir(curPath);
} else {
// delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
process.on("uncaughtException", function (err) {
console.error(err);
process.exitCode = 1;
});
export function withExtension(filename: string, ext: string = ".js") {
const newBasename = path.basename(filename, path.extname(filename)) + ext;
return path.join(path.dirname(filename), newBasename);
}
export function debounce(fn: () => void, time: number) {
let timer;
function debounced() {
clearTimeout(timer);
timer = setTimeout(fn, time);
}
debounced.flush = () => {
clearTimeout(timer);
fn();
};
return debounced;
}
| babel/babel | packages/babel-cli/src/babel/util.ts | TypeScript | mit | 3,448 |
namespace WebApiContrib.Formatting.Xlsx.Tests.TestData
{
public class BooleanTestItem
{
public bool Value1 { get; set; }
[ExcelColumn(TrueValue="Yes", FalseValue="No")]
public bool Value2 { get; set; }
public bool? Value3 { get; set; }
[ExcelColumn(TrueValue = "Yes", FalseValue = "No")]
public bool? Value4 { get; set; }
}
}
| balajichekka/WebApiContrib.Formatting.Xlsx | test/WebApiContrib.Formatting.Xlsx.Tests/TestData/BooleanTestItem.cs | C# | mit | 392 |
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\ApiBundle\DependencyInjection;
use Sylius\Bundle\ApiBundle\Form\Type\ClientType;
use Sylius\Bundle\ApiBundle\Model\AccessToken;
use Sylius\Bundle\ApiBundle\Model\AccessTokenInterface;
use Sylius\Bundle\ApiBundle\Model\AuthCode;
use Sylius\Bundle\ApiBundle\Model\AuthCodeInterface;
use Sylius\Bundle\ApiBundle\Model\Client;
use Sylius\Bundle\ApiBundle\Model\ClientInterface;
use Sylius\Bundle\ApiBundle\Model\RefreshToken;
use Sylius\Bundle\ApiBundle\Model\RefreshTokenInterface;
use Sylius\Bundle\ApiBundle\Model\UserInterface;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Resource\Factory\Factory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_api');
$rootNode
->children()
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
->end()
;
$this->addResourcesSection($rootNode);
return $treeBuilder;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addResourcesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('resources')
->addDefaultsIfNotSet()
->children()
->arrayNode('api_user')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->isRequired()->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(UserInterface::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('api_client')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(Client::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(ClientInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('default')->defaultValue(ClientType::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_access_token')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(AccessToken::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(AccessTokenInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_refresh_token')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(RefreshToken::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(RefreshTokenInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_auth_code')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(AuthCode::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(AuthCodeInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
;
}
}
| adamelso/Sylius | src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php | PHP | mit | 9,956 |
<!DOCTYPE html>
<!--Aegis Framework | MIT License | http://www.aegisframework.com/ -->
<html lang="en">
<head>
<title>Bad Request</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html,
body {
width: 100%;
height: 100%;
}
body {
text-align: center;
color: rgb(84, 84, 84);
margin: 0;
display: flex;
justify-content: center;
align-items: center;
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Open Sans", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
}
h1,
h2 {
font-weight: lighter;
}
h1 {
font-size: 4em;
}
h2 {
font-size: 2em;
}
</style>
</head>
<body>
<div>
<h1>Request Timeout</h1>
<h2>The server timed out waiting for the request.</h2>
</div>
</body>
</html> | Monogatari/Monogatari | dist/engine/error/408.html | HTML | mit | 889 |
using System.Collections.Generic;
using System;
using UnityEngine;
public class EventService
{
public delegate void EventDelegate<T>(T e) where T : GameEvent;
Dictionary<Type, Delegate> delegates = new Dictionary<Type, Delegate>();
public void AddListener<T>(EventDelegate<T> listener) where T : GameEvent {
Type type = typeof(T);
Delegate d;
if (delegates.TryGetValue(type, out d)) {
delegates[type] = Delegate.Combine(d, listener);
}
else {
delegates[type] = listener;
}
}
public void RemoveListener<T>(EventDelegate<T> listener) where T : GameEvent {
Type type = typeof(T);
Delegate d;
if (delegates.TryGetValue(type, out d)) {
Delegate currentDel = Delegate.Remove(d, listener);
if (currentDel == null) {
delegates.Remove(type);
}
else {
delegates[type] = currentDel;
}
}
}
public void Dispatch<T>(T e) where T : GameEvent {
if (e == null) {
Debug.Log("Invalid event argument: " + e.GetType());
return;
}
Type type = e.GetType();
Delegate d;
if (delegates.TryGetValue(type, out d)) {
EventDelegate<T> callback = d as EventDelegate<T>;
if (callback != null) {
callback(e);
}
else {
Debug.Log("Not removed callback: " + type);
}
}
}
}
public class GameEvent { } | kicholen/GamePrototype | Assets/Script/Controller/Service/EventService/EventService.cs | C# | mit | 1,277 |
(function () {
var g = void 0,
k = !0,
m = null,
o = !1,
p, q = this,
r = function (a) {
var b = typeof a;
if ("object" == b) if (a) {
if (a instanceof Array) return "array";
if (a instanceof Object) return b;
var c = Object.prototype.toString.call(a);
if ("[object Window]" == c) return "object";
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array";
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function"
} else return "null";
else if ("function" == b && "undefined" == typeof a.call) return "object";
return b
},
aa = function (a) {
var b = r(a);
return "array" == b || "object" == b && "number" == typeof a.length
},
u = function (a) {
return "string" == typeof a
},
ba = function (a) {
a = r(a);
return "object" == a || "array" == a || "function" == a
},
ca = function (a, b, c) {
return a.call.apply(a.bind, arguments)
},
da = function (a, b, c) {
if (!a) throw Error();
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function () {
var c = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(c, d);
return a.apply(b, c)
}
}
return function () {
return a.apply(b, arguments)
}
},
v = function (a, b, c) {
v = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? ca : da;
return v.apply(m, arguments)
},
ea = function (a, b) {
function c() {}
c.prototype = b.prototype;
a.Sa = b.prototype;
a.prototype = new c
};
Function.prototype.bind = Function.prototype.bind ||
function (a, b) {
if (1 < arguments.length) {
var c = Array.prototype.slice.call(arguments, 1);
c.unshift(this, a);
return v.apply(m, c)
}
return v(this, a)
};
var w = function (a) {
this.stack = Error().stack || "";
if (a) this.message = "" + a
};
ea(w, Error);
w.prototype.name = "CustomError";
var fa = function (a, b) {
for (var c = 1; c < arguments.length; c++) var d = ("" + arguments[c]).replace(/\$/g, "$$$$"),
a = a.replace(/\%s/, d);
return a
},
ma = function (a) {
if (!ga.test(a)) return a; - 1 != a.indexOf("&") && (a = a.replace(ha, "&")); - 1 != a.indexOf("<") && (a = a.replace(ia, "<")); - 1 != a.indexOf(">") && (a = a.replace(ka, ">")); - 1 != a.indexOf('"') && (a = a.replace(la, """));
return a
},
ha = /&/g,
ia = /</g,
ka = />/g,
la = /\"/g,
ga = /[&<>\"]/;
var x = function (a, b) {
b.unshift(a);
w.call(this, fa.apply(m, b));
b.shift();
this.Ra = a
};
ea(x, w);
x.prototype.name = "AssertionError";
var y = function (a, b, c) {
if (!a) {
var d = Array.prototype.slice.call(arguments, 2),
f = "Assertion failed";
if (b) var f = f + (": " + b),
e = d;
throw new x("" + f, e || []);
}
};
var z = Array.prototype,
na = z.indexOf ?
function (a, b, c) {
y(a.length != m);
return z.indexOf.call(a, b, c)
} : function (a, b, c) {
c = c == m ? 0 : 0 > c ? Math.max(0, a.length + c) : c;
if (u(a)) return !u(b) || 1 != b.length ? -1 : a.indexOf(b, c);
for (; c < a.length; c++) if (c in a && a[c] === b) return c;
return -1
}, oa = z.forEach ?
function (a, b, c) {
y(a.length != m);
z.forEach.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, f = u(a) ? a.split("") : a, e = 0; e < d; e++) e in f && b.call(c, f[e], e, a)
}, pa = function (a) {
return z.concat.apply(z, arguments)
}, qa = function (a) {
if ("array" == r(a)) return pa(a);
for (var b = [], c = 0, d = a.length; c < d; c++) b[c] = a[c];
return b
}, ra = function (a, b, c) {
y(a.length != m);
return 2 >= arguments.length ? z.slice.call(a, b) : z.slice.call(a, b, c)
};
var A = function (a, b) {
this.x = a !== g ? a : 0;
this.y = b !== g ? b : 0
};
A.prototype.toString = function () {
return "(" + this.x + ", " + this.y + ")"
};
var sa = function (a, b) {
for (var c in a) b.call(g, a[c], c, a)
},
ta = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),
ua = function (a, b) {
for (var c, d, f = 1; f < arguments.length; f++) {
d = arguments[f];
for (c in d) a[c] = d[c];
for (var e = 0; e < ta.length; e++) c = ta[e], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c])
}
};
var B, va, C, wa, xa = function () {
return q.navigator ? q.navigator.userAgent : m
};
wa = C = va = B = o;
var D;
if (D = xa()) {
var ya = q.navigator;
B = 0 == D.indexOf("Opera");
va = !B && -1 != D.indexOf("MSIE");
C = !B && -1 != D.indexOf("WebKit");
wa = !B && !C && "Gecko" == ya.product
}
var za = B,
E = va,
F = wa,
G = C,
Aa;
a: {
var H = "",
I;
if (za && q.opera) var Ba = q.opera.version,
H = "function" == typeof Ba ? Ba() : Ba;
else if (F ? I = /rv\:([^\);]+)(\)|;)/ : E ? I = /MSIE\s+([^\);]+)(\)|;)/ : G && (I = /WebKit\/(\S+)/), I) var Ca = I.exec(xa()),
H = Ca ? Ca[1] : "";
if (E) {
var Da, Ea = q.document;
Da = Ea ? Ea.documentMode : g;
if (Da > parseFloat(H)) {
Aa = "" + Da;
break a
}
}
Aa = H
}
var Fa = Aa,
Ga = {},
Ha = function (a) {
var b;
if (!(b = Ga[a])) {
b = 0;
for (var c = ("" + Fa).replace(/^[\s\xa0]+|[\s\xa0]+$/g, "").split("."), d = ("" + a).replace(/^[\s\xa0]+|[\s\xa0]+$/g, "").split("."), f = Math.max(c.length, d.length), e = 0; 0 == b && e < f; e++) {
var h = c[e] || "",
n = d[e] || "",
j = RegExp("(\\d*)(\\D*)", "g"),
t = RegExp("(\\d*)(\\D*)", "g");
do {
var i = j.exec(h) || ["", "", ""],
l = t.exec(n) || ["", "", ""];
if (0 == i[0].length && 0 == l[0].length) break;
b = ((0 == i[1].length ? 0 : parseInt(i[1], 10)) < (0 == l[1].length ? 0 : parseInt(l[1], 10)) ? -1 : (0 == i[1].length ? 0 : parseInt(i[1], 10)) > (0 == l[1].length ? 0 : parseInt(l[1], 10)) ? 1 : 0) || ((0 == i[2].length) < (0 == l[2].length) ? -1 : (0 == i[2].length) > (0 == l[2].length) ? 1 : 0) || (i[2] < l[2] ? -1 : i[2] > l[2] ? 1 : 0)
} while (0 == b)
}
b = Ga[a] = 0 <= b
}
return b
},
Ia = {},
J = function (a) {
return Ia[a] || (Ia[a] = E && document.documentMode && document.documentMode >= a)
};
var Ja, Ka = !E || J(9);
!F && !E || E && J(9) || F && Ha("1.9.1");
E && Ha("9");
var La = function (a, b) {
var c;
c = (c = a.className) && "function" == typeof c.split ? c.split(/\s+/) : [];
var d = ra(arguments, 1),
f;
f = c;
for (var e = 0, h = 0; h < d.length; h++) 0 <= na(f, d[h]) || (f.push(d[h]), e++);
f = e == d.length;
a.className = c.join(" ");
return f
};
var Ma = function (a) {
return a ? new K(L(a)) : Ja || (Ja = new K)
},
Na = function (a, b) {
var c = b && "*" != b ? b.toUpperCase() : "";
return a.querySelectorAll && a.querySelector && (!G || "CSS1Compat" == document.compatMode || Ha("528")) && c ? a.querySelectorAll(c + "") : a.getElementsByTagName(c || "*")
},
Pa = function (a, b) {
sa(b, function (b, d) {
"style" == d ? a.style.cssText = b : "class" == d ? a.className = b : "for" == d ? a.htmlFor = b : d in Oa ? a.setAttribute(Oa[d], b) : 0 == d.lastIndexOf("aria-", 0) ? a.setAttribute(d, b) : a[d] = b
})
},
Oa = {
cellpadding: "cellPadding",
cellspacing: "cellSpacing",
colspan: "colSpan",
rowspan: "rowSpan",
valign: "vAlign",
height: "height",
width: "width",
usemap: "useMap",
frameborder: "frameBorder",
maxlength: "maxLength",
type: "type"
},
Qa = function (a, b, c) {
function d(c) {
c && b.appendChild(u(c) ? a.createTextNode(c) : c)
}
for (var f = 2; f < c.length; f++) {
var e = c[f];
if (aa(e) && !(ba(e) && 0 < e.nodeType)) {
var h;
a: {
if (e && "number" == typeof e.length) {
if (ba(e)) {
h = "function" == typeof e.item || "string" == typeof e.item;
break a
}
if ("function" == r(e)) {
h = "function" == typeof e.item;
break a
}
}
h = o
}
oa(h ? qa(e) : e, d)
} else d(e)
}
},
L = function (a) {
return 9 == a.nodeType ? a : a.ownerDocument || a.document
},
K = function (a) {
this.C = a || q.document || document
};
K.prototype.za = function (a, b, c) {
var d = this.C,
f = arguments,
e = f[0],
h = f[1];
if (!Ka && h && (h.name || h.type)) {
e = ["<", e];
h.name && e.push(' name="', ma(h.name), '"');
if (h.type) {
e.push(' type="', ma(h.type), '"');
var n = {};
ua(n, h);
h = n;
delete h.type
}
e.push(">");
e = e.join("")
}
e = d.createElement(e);
if (h) u(h) ? e.className = h : "array" == r(h) ? La.apply(m, [e].concat(h)) : Pa(e, h);
2 < f.length && Qa(d, e, f);
return e
};
K.prototype.createElement = function (a) {
return this.C.createElement(a)
};
K.prototype.createTextNode = function (a) {
return this.C.createTextNode(a)
};
K.prototype.appendChild = function (a, b) {
a.appendChild(b)
};
var M = function (a) {
var b;
a: {
b = L(a);
if (b.defaultView && b.defaultView.getComputedStyle && (b = b.defaultView.getComputedStyle(a, m))) {
b = b.position || b.getPropertyValue("position");
break a
}
b = ""
}
return b || (a.currentStyle ? a.currentStyle.position : m) || a.style && a.style.position
},
Ra = function (a) {
if (E && !J(8)) return a.offsetParent;
for (var b = L(a), c = M(a), d = "fixed" == c || "absolute" == c, a = a.parentNode; a && a != b; a = a.parentNode) if (c = M(a), d = d && "static" == c && a != b.documentElement && a != b.body, !d && (a.scrollWidth > a.clientWidth || a.scrollHeight > a.clientHeight || "fixed" == c || "absolute" == c || "relative" == c)) return a;
return m
},
N = function (a) {
var b, c = L(a),
d = M(a),
f = F && c.getBoxObjectFor && !a.getBoundingClientRect && "absolute" == d && (b = c.getBoxObjectFor(a)) && (0 > b.screenX || 0 > b.screenY),
e = new A(0, 0),
h;
b = c ? 9 == c.nodeType ? c : L(c) : document;
if (h = E) if (h = !J(9)) h = "CSS1Compat" != Ma(b).C.compatMode;
h = h ? b.body : b.documentElement;
if (a == h) return e;
if (a.getBoundingClientRect) {
b = a.getBoundingClientRect();
if (E) a = a.ownerDocument, b.left -= a.documentElement.clientLeft + a.body.clientLeft, b.top -= a.documentElement.clientTop + a.body.clientTop;
a = Ma(c).C;
c = !G && "CSS1Compat" == a.compatMode ? a.documentElement : a.body;
a = a.parentWindow || a.defaultView;
c = new A(a.pageXOffset || c.scrollLeft, a.pageYOffset || c.scrollTop);
e.x = b.left + c.x;
e.y = b.top + c.y
} else if (c.getBoxObjectFor && !f) b = c.getBoxObjectFor(a), c = c.getBoxObjectFor(h), e.x = b.screenX - c.screenX, e.y = b.screenY - c.screenY;
else {
b = a;
do {
e.x += b.offsetLeft;
e.y += b.offsetTop;
b != a && (e.x += b.clientLeft || 0, e.y += b.clientTop || 0);
if (G && "fixed" == M(b)) {
e.x += c.body.scrollLeft;
e.y += c.body.scrollTop;
break
}
b = b.offsetParent
} while (b && b != a);
if (za || G && "absolute" == d) e.y -= c.body.offsetTop;
for (b = a;
(b = Ra(b)) && b != c.body && b != h;) if (e.x -= b.scrollLeft, !za || "TR" != b.tagName) e.y -= b.scrollTop
}
return e
},
Ta = function () {
var a = Ma(g),
b = m;
if (E) b = a.C.createStyleSheet(), Sa(b);
else {
var c = Na(a.C, "head")[0];
c || (b = Na(a.C, "body")[0], c = a.za("head"), b.parentNode.insertBefore(c, b));
b = a.za("style");
Sa(b);
a.appendChild(c, b)
}
},
Sa = function (a) {
E ? a.cssText = "canvas:active{cursor:pointer}" : a[G ? "innerText" : "innerHTML"] = "canvas:active{cursor:pointer}"
};
var O = function (a, b) {
var c = {},
d;
for (d in b) c[d] = a.style[d], a.style[d] = b[d];
return c
},
P = function (a, b) {
this.M = a || m;
this.fa = m;
this.ya = b ||
function () {};
this.Q = 0;
this.ta = 0.05
},
Ua = function (a, b) {
a.ya = b
};
P.prototype.s = function () {
if (this.M && this.ta) {
this.Q += this.ta;
if (1 < this.Q) this.Q = 1, this.ta = 0, this.ya();
var a = "0 0 2px rgba(255,0,0," + this.Q + ")",
a = O(this.M, {
boxShadow: a,
MozBoxShadow: a,
webkitBoxShadow: a,
oBoxShadow: a,
msBoxShadow: a,
opacity: this.Q
});
if (!this.fa) this.fa = a
}
};
P.prototype.restore = function () {
this.M && this.fa && O(this.M, this.fa)
};
var Va = function () {
this.H = []
};
Va.prototype.k = function (a, b, c) {
if (a) {
this.H.push(arguments);
var d = a,
f = b,
e = c;
d.addEventListener ? d.addEventListener(f, e, o) : d.attachEvent("on" + f, e)
}
};
var Wa = function (a, b, c) {
a && (a.removeEventListener ? a.removeEventListener(b, c, o) : a.detachEvent("on" + b, c))
};
var Xa = Math.PI / 2,
Q = function (a, b, c) {
this.ca = a;
this.P = document.createElement("div");
this.P.style.position = "absolute";
var a = Math.floor(3 * Math.random() + 0),
d = "\u2744";
1 < a ? d = "\u2745" : 2 < a && (d = "\u2746");
this.P.innerHTML = d;
this.ca.appendChild(this.P);
this.Y = c;
this.X = b;
this.reset()
};
Q.prototype.reset = function () {
this.x = Math.random() * this.X;
this.ea = 4.5 * Math.random() + 1;
this.y = -this.ea;
this.B = 2 * Math.random() + -1;
this.xa = this.ea;
var a = Math.floor(255 * (0.4 * Math.random() + 0.5)).toString(16);
O(this.P, {
fontSize: 2.5 * this.ea + "px",
left: this.x + "px",
top: this.y + "px",
color: "#" + a + a + a
})
};
Q.prototype.move = function (a, b) {
this.y += this.B * b + this.xa * a;
this.B += 0.2 * Math.random() + -0.1;
if (-1 > this.B) this.B = -1;
else if (1 < this.B) this.B = 1;
this.x += this.B * a + this.xa * b;
this.y > this.Y + this.ea && this.reset()
};
Q.prototype.s = function () {
this.P.style.left = this.x + "px";
this.P.style.top = this.y + "px"
};
var R = function (a) {
this.ca = a;
this.X = a.offsetWidth;
this.Y = a.offsetHeight;
this.da = [];
this.ra = 1;
this.sa = 0;
this.Ma = !! navigator.userAgent.match(/(iPod|iPhone|iPad)/)
};
R.prototype.s = function () {
200 > this.da.length && 0.5 > Math.random() && this.da.push(new Q(this.ca, this.X, this.Y));
for (var a = 0, b; b = this.da[a]; a++) b.move(this.ra, this.sa), b.s()
};
R.prototype.Ca = function (a) {
if (this.Ma) {
var b = window.orientation & 2,
c = b ? a.beta : a.gamma / 2,
a = b ? 0 > a.gamma ? 1 : -1 : 0 > a.beta ? -1 : 1;
if (c && 45 > Math.abs(c)) c = a * Xa * (c / 45), this.ra = Math.cos(c), this.sa = Math.sin(c)
} else {
if (!a.gamma && a.x) a.gamma = -(a.x * (180 / Math.PI));
if (a.gamma && 90 > Math.abs(a.gamma)) c = Xa * (a.gamma / 90), this.ra = Math.cos(c), this.sa = Math.sin(c)
}
};
R.prototype.N = function (a, b) {
O(this.ca, {
width: a + "px",
height: b + "px"
});
this.X = a;
this.Y = b;
for (var c = 0, d; d = this.da[c]; c++) {
var f = b;
d.X = a;
d.Y = f
}
};
var Ya = function (a, b, c, d) {
this.oa = b;
this.g = a;
this.x = c;
this.y = d;
this.width = b.width;
this.height = b.height;
this.la = (this.width + 120) / 88;
this.Ea = (this.height + 120) / 66;
this.ga = 0;
this.$ = o;
this.w = [];
this.G = [];
for (a = 0; 66 > a; a++) {
this.w[a] = [];
this.G[a] = [];
b = Math.min(a, 65 - a);
for (c = 0; 88 > c; c++) d = Math.min(c, 87 - c), 8 > d || 8 > b ? (d = 1 - Math.min(d, b) / 8, this.G[a].push(4 * Math.random() * d * d)) : this.G[a].push(0), this.w[a].push(0)
}
this.S = 0;
this.L = [];
this.v = m;
this.ka = [];
this.W = this.aa = 0;
this.I = m;
this.ma = o
},
Za = function (a, b, c) {
b = (b + 60) / a.la | 0;
c = (c + 60) / a.Ea | 0;
return [b, c]
},
$a = function (a, b, c) {
for (var d = 0, f = c - 1; f <= c + 1; f++) for (var e = b - 1; e <= b + 1; e++) var h = a,
n = e,
j = f,
n = Math.max(0, Math.min(87, n)),
j = Math.max(0, Math.min(65, j)),
d = d + h.w[j][n];
return d / 9
},
ab = function (a, b) {
a.$ = k;
b.fillStyle = "rgba(240,246,246,0.8)";
b.fillRect(0, 0, b.canvas.width, b.canvas.height)
};
Ya.prototype.s = function (a) {
if (!(this.$ || 88 < this.ga || 5808 < this.S)) {
a.fillStyle = "rgba(240,246,246,0.08)";
for (var b = 0; 200 > b; b++) {
var c = Math.random() * (this.width + 120) - 60,
d = Math.random() * (this.height + 120) - 60,
f = Za(this, c, d),
e = this.w[f[1]][f[0]];
e >= 4 * (1 + Math.random()) / 2 && (c |= 0, d |= 0, a.beginPath(), a.arc(c, d, e / 4 * this.la | 0, 0, 2 * Math.PI, k), a.fill(), a.closePath(), this.S++)
}
for (b = 0; 200 > b; b++) if (c = Math.random() * (this.width + 120) - 60, d = Math.random() * (this.height + 120) - 60, f = Za(this, c, d), e = this.w[f[1]][f[0]], f = this.G[f[1]][f[0]], e = 2 > e ? Math.max(e, f) : f, e >= Math.random()) e = 3 * Math.min(1, e) * this.la | 0, c |= 0, d |= 0, f = a.createRadialGradient(c, d, 0, c, d, e), f.addColorStop(0, "rgba(240,246,246,0.16)"), f.addColorStop(1, "rgba(240,246,246,0)"), a.fillStyle = f, a.fillRect(c - e + 1, d - e + 1, 2 * e - 1, 2 * e - 1), this.S++
}
bb(this);
bb(this);
for (b = 0; b < this.L.length; b++) this.L[b].s(a)
};
var cb = function (a, b) {
a.ka = b;
a.aa = 0;
a.W = 0;
a.I = m
},
bb = function (a) {
if (!(a.v || a.aa >= a.ka.length)) {
var b = a.ka[a.aa].O;
if (!a.I) a.I = new S, a.L.push(a.I);
a.I.ba.apply(a.I, b[a.W]);
a.W++;
if (a.W >= b.length) a.W = 0, a.aa++, a.I = m
}
},
T = function (a, b) {
a.v && a.v.ba(b[0], b[1])
},
db = function (a) {
a.g.k(window, "touchmove", v(a.Ka, a));
a.g.k(window, "touchstart", v(a.La, a));
a.g.k(window, "touchend", v(a.Ja, a));
a.g.k(window, "mousemove", v(a.Ha, a));
a.g.k(window, "mousedown", v(a.Ga, a));
a.g.k(window, "mouseup", v(a.Ia, a))
};
p = Ya.prototype;
p.Ha = function (a) {
this.v && !this.ma && T(this, [a.clientX - this.x | 0, a.clientY - this.y | 0])
};
p.Ga = function (a) {
if ((a.target || a.srcElement) == this.oa && (0 == a.button || 1 == a.button)) {
var b = [a.clientX - this.x | 0, a.clientY - this.y | 0];
this.v = new S;
this.L.push(this.v);
T(this, b);
a.preventDefault();
return o
}
};
p.Ia = function () {
this.v = m
};
p.La = function (a) {
this.ma = k;
a = a.touches.item(0);
a = [a.clientX - this.x | 0, a.clientY - this.y | 0];
this.v = new S;
this.L.push(this.v);
T(this, a)
};
p.Ja = function (a) {
this.ma = o;
this.v = m;
a.preventDefault();
return o
};
p.Ka = function (a) {
var b = a.touches.item(0);
T(this, [b.clientX - this.x | 0, b.clientY - this.y | 0]);
a.preventDefault();
return o
};
p.N = function (a, b, c) {
this.oa.width = a;
this.oa.height = b;
this.width = a;
this.height = b;
ab(this, c)
};
var S = function () {
this.Qa = this.Oa = 30;
this.O = []
};
S.prototype.ba = function (a, b) {
this.O.push([a, b])
};
S.prototype.s = function (a) {
if (0 != this.O.length) {
var b = a.globalCompositeOperation;
a.globalCompositeOperation = "destination-out";
a.lineWidth = this.Oa;
a.lineCap = "round";
a.lineJoin = "round";
a.beginPath();
var c = this.O[0];
a.moveTo(c[0], c[1] - 1);
for (var d = 0; c = this.O[d]; d++) a.lineTo(c[0], c[1]);
a.stroke();
a.globalCompositeOperation = b
}
};
var U = function (a) {
this.n = this.o = m;
this.g = a;
this.D = new P
},
eb = function (a) {
if (!a.o) return m;
var b = document.createElement("button"),
c = N(a.o),
d = a.o.offsetWidth,
a = a.o.offsetHeight;
navigator.userAgent.match(/iPad/) && (d = 86, a = 40);
document.getElementById("skb") ? (b.className = "lsbb", O(b, {
fontSize: "15px",
background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAmCAYAAAAFvPEHAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAl2cEFnAAAAJgAAACYAB/nYBgAAADFJREFUCNd9jDEKACAQw0L//17BKW4iR3ErbVL20ihE4EkgdVAIo7swBe6av7+pWYcD6Xg4BFIWHrsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMTItMTNUMTA6MTE6MjctMDg6MDD1wN6AAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTEyLTEzVDEwOjExOjI3LTA4OjAwhJ1mPAAAAABJRU5ErkJggg==') repeat-x",
color: "#374A82"
}), b.innerHTML = "\u2652", c.y -= 1) : (b.innerHTML = "Defrost", O(b, {
backgroundColor: "#4d90fe",
backgroundImage: "-webkit-,-moz-,-ms-,-o-,,".split(",").join("linear-gradient(top,#4d90fe,#4787ed);"),
filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#4d90fe',EndColorStr='#4787ed')",
border: "1px solid #3079ed",
borderRadius: "2px",
webkitBorderRadius: "2px",
mozBorderRadius: "2px",
color: "white",
fontSize: "11px",
fontWeight: "bold",
textAlign: "center",
position: "fixed",
top: c.y + "px",
left: c.x + "px",
width: d + "px",
height: a + "px",
padding: "0 8px",
zIndex: 1201,
opacity: 0
}), 30 < a && O(b, {
fontSize: "15px"
}));
return b
};
U.prototype.qa = function (a) {
var b = this.o = document.getElementById("gbqfb") || document.getElementById("sblsbb") || document.getElementsByName("btnG")[0];
if (this.o) {
this.n = eb(this);
this.D.M = this.n;
Ua(this.D, function () {
b.style.visibility = "hidden"
});
var c = this.o.parentNode;
if (c && "sbds" == c.id) c.style.width = c.offsetWidth + "px";
this.g.k(this.n, "click", a);
document.body.insertBefore(this.n, document.body.firstChild)
}
};
U.prototype.detach = function () {
if (this.o && this.n) this.n.parentNode.removeChild(this.n), this.n = m, this.o.style.visibility = "visible"
};
U.prototype.pa = function () {
if (this.o && this.n) {
var a = N(this.o);
this.n.style.top = a.y + "px";
this.n.style.left = a.x + "px"
}
};
var V = function (a, b) {
this.i = b;
this.g = a;
this.U = this.V = this.a = m;
this.va = {};
this.ua = {};
this.p = m;
this.D = new P;
this.m = m
},
fb = function (a) {
function b(a) {
return d.charAt(a >> 6 & 63) + d.charAt(a & 63)
}
function c(a) {
var c = 0;
0 > a && (c = 32, a = -a);
return b(c | a & 31).charAt(1)
}
for (var d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", a = a.i.L, f = [], e = 0, h; h = a[e]; ++e) {
var n = [];
h = h.O;
for (var j = m, t = 0, i; i = h[t]; t++) j && 32 > Math.abs(i[0] - j[0]) && 32 > Math.abs(i[1] - j[1]) ? (j = [i[0] - j[0], i[1] - j[1]], n.push(c(j[0]) + c(j[1]))) : n.push((0 == t ? "" : ";") + (b(i[0]) + b(i[1]))), j = i;
f.push(n.join(""))
}
return "1;" + f.join("!")
},
gb = function (a) {
function b(a) {
var b = String.fromCharCode(a);
return "A" <= b && "Z" >= b ? a - 65 : "a" <= b && "z" >= b ? a - 97 + 26 : "0" <= b && "9" >= b ? a - 48 + 52 : "-" == b ? 62 : "_" == b ? 63 : m
}
function c(a, c) {
var d = b(a.charCodeAt(c)),
e = b(a.charCodeAt(c + 1));
return d === m || e === m ? m : d << 6 | e
}
function d(a, c) {
var d = b(a.charCodeAt(c));
if (d === m) return m;
d & 32 && (d = -(d & 31));
return d
}
var f = /&frostwriting=([A-Za-z0-9-_!;]+)/.exec(window.location.href);
if (!f) return o;
var f = f[1].split("!"),
e = [],
h = 0;
0 < f.length && "1;" == f[0].substr(0, 2) && (f[0] = f[0].substr(2), h = 1);
for (var n = 0, j; j = f[n]; ++n) {
for (var t = new S, i = m, l = 0; l < j.length;) {
var s = o;
if (";" == j.charAt(l)) {
if (0 == h) return o;
l++;
s = k
}
if (0 == h || !i || s) {
if (l + 3 >= j.length) return o;
i = c(j, l);
s = c(j, l + 2);
if (i === m || s === m) return o;
t.ba(i, s);
i = [i, s];
l += 4
} else {
if (l + 1 >= j.length) return o;
var s = d(j, l),
ja = d(j, l + 1);
if (s === m || ja === m) return o;
t.ba(i[0] + s, i[1] + ja);
i = [i[0] + s, i[1] + ja];
l += 2
}
}
e.push(t)
}
cb(a.i, e);
return k
},
hb = function () {
return -1 == window.location.hash.indexOf("&fp=") ? window.location.href : window.location.protocol + "//" + window.location.host + "/search?" + window.location.hash.substr(1).replace(/&fp=[0-9a-z]+/, "")
};
V.prototype.wa = function (a) {
a.stopPropagation();
a.preventDefault();
return o
};
V.prototype.Fa = function (a) {
var b = fb(this),
c = hb() + "&frostwriting=" + b;
if ("1;" == b) W(this, hb(), "Draw something on your window. #letitsnow");
else if (480 < c.length) {
if (this.m !== m) clearTimeout(this.m), this.m = m;
google.letitsnowGCO = v(this.Na, this);
ib(c);
this.m = setTimeout(v(function () {
W(this, window.location.href, "My drawing is too complex to share, but you should try this out and have fun, anyway. #letitsnow");
this.m = m
}, this), 5E3)
} else W(this, c, "Check out what I drew. #letitsnow");
return this.wa(a)
};
var W = function (a, b, c) {
if (a.m !== m) clearTimeout(a.m), a.m = m;
gbar.asmc(function () {
return {
items: [{
properties: {
url: [b],
name: ["Google - Let it snow!"],
image: ["http://www.google.com/images/logos/google_logo_41.png"],
description: [c]
}
}]
}
});
if (document.createEvent) {
var d = document.createEvent("MouseEvents");
d.initEvent("click", k, o);
a.V.dispatchEvent(d)
} else a.V.fireEvent && a.V.fireEvent("onclick")
};
V.prototype.qa = function () {
this.a = document.getElementById("gbgs3");
this.U = document.getElementById("gbwc");
this.V = document.getElementById("gbg3");
if (this.a && this.U && this.V) {
this.p = document.createElement("div");
O(this.p, {
height: this.a.offsetHeight + "px",
width: this.a.offsetWidth + "px"
});
this.a.parentNode.insertBefore(this.p, this.a);
var a = N(this.a);
this.va = O(this.a, {
font: "13px/27px Arial,sans-serif",
left: a.x + "px",
position: "fixed",
top: a.y - this.a.offsetHeight + "px",
zIndex: 1201
});
this.ua = O(this.U, {
background: "#fff",
zIndex: 1201
});
this.a.parentNode.removeChild(this.a);
document.body.appendChild(this.a);
"SPAN" == this.a.tagName ? this.a.style.lineHeight = "20px" : this.D.M = this.a;
this.g.k(this.a, "click", v(this.Fa, this));
this.g.k(this.a, "mousedown", v(this.wa, this))
}
};
V.prototype.detach = function () {
if (this.a && this.U) {
this.m !== m && clearTimeout(this.m);
O(this.a, this.va);
O(this.U, this.ua);
this.D.restore();
for (var a = this.g, b = this.a, c = 0; c < a.H.length; ++c) {
var d = a.H[c];
d && d[0] == b && (Wa.apply(m, d), a.H[c] = m)
}
this.a.parentNode.removeChild(this.a);
this.p.parentNode.insertBefore(this.a, this.p);
this.p.parentNode.removeChild(this.p);
this.p = this.a = m
}
};
V.prototype.pa = function () {
if (this.a && this.p) this.a.style.left = N(this.p).x + "px"
};
V.prototype.Na = function (a) {
a && "OK" == a.status && !a.error && a.id && (clearTimeout(this.m), W(this, a.id, "Check out what I drew. #letitsnow"))
};
var ib = function (a) {
var a = a.replace(window.location.host, "www.google.com"),
b = document.createElement("script");
b.src = "//google-doodles.appspot.com/?callback=google.letitsnowGCO&url=" + encodeURIComponent(a);
document.body.appendChild(b)
};
var jb = Math.floor(60),
kb = Math.floor(300),
X = function () {
this.J = this.i = this.K = this.h = this.A = m;
this.Z = this.ia = o;
this.g = this.F = m;
this.ha = o;
this.T = 0;
this.ja = this.R = m;
this.Da = window.opera || navigator.userAgent.match(/MSIE/) ? jb : kb
},
Y = "goog.egg.snowyfog.Snowyfog".split("."),
Z = q;
!(Y[0] in Z) && Z.execScript && Z.execScript("var " + Y[0]);
for (var $; Y.length && ($ = Y.shift());)!Y.length && X !== g ? Z[$] = X : Z = Z[$] ? Z[$] : Z[$] = {};
X.prototype.init = function () {
var a = this,
b = function () {
document.getElementById("snfloader_script") && (!document.getElementById("foot") && !document.getElementById("bfoot") ? window.setTimeout(b, 50) : (google.rein && google.dstr && (google.rein.push(v(a.Aa, a)), google.dstr.push(v(a.Pa, a))), a.Aa()))
};
b()
};
X.prototype.init = X.prototype.init;
X.prototype.Aa = function () {
if (!google || !google.snowyfogInited) {
google.snowyfogInited = k;
var a = document.createElement("canvas");
document.body.insertBefore(a, document.body.firstChild);
this.h = a;
O(this.h, {
pointerEvents: "none",
position: "fixed",
top: "0",
left: "0",
zIndex: 1200
});
this.h.width = window.innerWidth;
this.h.height = window.innerHeight;
this.T = 0;
this.ha = this.Z = this.ia = o;
this.g = new Va;
this.A = document.createElement("div");
a = window.opera || navigator.userAgent.match(/MSIE/) ? 0 : 800;
O(this.A, {
pointerEvents: "none",
position: "absolute",
zIndex: a,
width: document.body.clientWidth + "px",
height: Math.max(window.innerHeight, document.body.clientHeight) + "px",
overflow: "hidden"
});
document.body.insertBefore(this.A, document.body.firstChild);
this.K = new R(this.A);
this.i = new Ya(this.g, this.h, 0, 0);
this.F = new V(this.g, this.i);
this.J = new U(this.g);
a = v(this.K.Ca, this.K);
this.g.k(window, "resize", v(this.N, this));
this.g.k(window, "deviceorientation", a);
this.g.k(window, "MozOrientation", a);
this.R = this.h.getContext("2d");
gb(this.F) && (ab(this.i, this.R), lb(this));
this.ja = v(this.Ba, this);
window.setTimeout(this.ja, 50)
}
};
X.prototype.Pa = function () {
this.ha = k;
for (var a = this.g, b = 0; b < a.H.length; ++b) {
var c = a.H[b];
c && (Wa.apply(m, c), a.H[b] = m)
}
this.J.detach();
this.F.detach();
if (this.h) this.h.parentNode.removeChild(this.h), this.h = m;
if (this.A) this.A.parentNode.removeChild(this.A), this.A = m
};
var lb = function (a) {
if (!a.ia) a.ia = k, a.h.style.pointerEvents = "auto", Ta(), db(a.i), a.F.qa(), a.J.qa(v(function (a) {
this.Z = o;
this.i = m;
this.h && this.h.parentNode.removeChild(this.h);
this.h = m;
this.J.detach();
this.F.detach();
a.stopPropagation()
}, a))
},
mb = function (a) {
a.K.s();
if (a.Z) {
var b = a.i;
if (!(580.8 > b.S) && !(b.$ || 88 < b.ga)) {
for (var c = b.S = 0, d = 0; 66 > d; d++) for (var f = 0; 88 > f; f++) b.w[d][f] += b.G[d][f], 3.5 <= b.w[d][f] && c++;
b.ga++;
if (c >= 70.4 * 66) b.$ = k;
else for (d = 0; 66 > d; d++) for (f = 0; 88 > f; f++) if (c = 4 - b.w[d][f], c > 4 * Math.random() && 0.7 < Math.random()) {
var e = Math.min(1, 3 * $a(b, f, d)) * Math.random();
b.G[d][f] = c * e
} else b.G[d][f] = 0
}
a.i.s(a.R);
a.J.D.s();
a.F.D.s()
}
};
X.prototype.Ba = function () {
if (!this.ha) {
window.setTimeout(this.ja, 50);
this.T++;
if (this.T == jb) this.Z = k;
this.T == this.Da && lb(this);
mb(this)
}
};
X.prototype.N = function () {
this.K && this.K.N(document.body.offsetWidth, Math.max(document.body.offsetHeight, window.innerHeight));
this.i && (!navigator.userAgent.match(/iPad/) || this.T > jb) && this.i.N(window.innerWidth, window.innerHeight, this.R);
lb(this);
this.J.pa();
this.F.pa();
this.A && this.R && mb(this)
};
X.prototype.resize = X.prototype.N;
})(); | coolspring1293/coolspring1293.github.io | snow.js | JavaScript | mit | 41,004 |
import { Type } from '@ephox/katamari';
// some elements, such as mathml, don't have style attributes
// others, such as angular elements, have style attributes that aren't a CSSStyleDeclaration
const isSupported = (dom: Node): dom is HTMLStyleElement =>
// eslint-disable-next-line @typescript-eslint/unbound-method
(dom as HTMLStyleElement).style !== undefined && Type.isFunction((dom as HTMLStyleElement).style.getPropertyValue);
export { isSupported };
| tinymce/tinymce | modules/sugar/src/main/ts/ephox/sugar/impl/Style.ts | TypeScript | mit | 463 |
del *.o
fasm asm_code.asm asm_code.o
gcc -c mcities.c
gcc -c system/kolibri.c
gcc -c system/stdlib.c
gcc -c system/string.c
gcc -c system/ctype.c
ld -nostdlib -T kolibri.ld -o mcities asm_code.o kolibri.o stdlib.o string.o ctype.o mcities.o
objcopy mcities -O binary
kpack mcities
del *.o
pause | devlato/kolibrios-llvm | programs/games/mcities/compile.bat | Batchfile | mit | 294 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_66-internal) on Tue Dec 08 09:26:31 GMT 2015 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.apache.jena.vocabulary.TestManifest (Apache Jena)</title>
<meta name="date" content="2015-12-08">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.jena.vocabulary.TestManifest (Apache Jena)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/jena/vocabulary/TestManifest.html" title="class in org.apache.jena.vocabulary">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/jena/vocabulary/class-use/TestManifest.html" target="_top">Frames</a></li>
<li><a href="TestManifest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.jena.vocabulary.TestManifest" class="title">Uses of Class<br>org.apache.jena.vocabulary.TestManifest</h2>
</div>
<div class="classUseContainer">No usage of org.apache.jena.vocabulary.TestManifest</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/jena/vocabulary/TestManifest.html" title="class in org.apache.jena.vocabulary">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/jena/vocabulary/class-use/TestManifest.html" target="_top">Frames</a></li>
<li><a href="TestManifest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Licenced under the Apache License, Version 2.0</small></p>
</body>
</html>
| manonsys/MVC | libs/Jena/javadoc-core/org/apache/jena/vocabulary/class-use/TestManifest.html | HTML | mit | 4,581 |
<?php
namespace Backend\Modules\MediaLibrary\Actions;
use Backend\Core\Language\Language;
use Backend\Modules\MediaLibrary\Domain\MediaFolder\MediaFolder;
use Backend\Modules\MediaLibrary\Domain\MediaGroup\MediaGroupType;
use Backend\Modules\MediaLibrary\Domain\MediaItem\MediaItemSelectionDataGrid;
use Backend\Modules\MediaLibrary\Domain\MediaItem\Type;
class MediaBrowserImages extends MediaBrowser
{
public function display(string $template = null): void
{
parent::display($template ?? '/' . $this->getModule() . '/Layout/Templates/MediaBrowser.html.twig');
}
protected function parse(): void
{
// Parse files necessary for the media upload helper
MediaGroupType::parseFiles();
parent::parseDataGrids($this->mediaFolder);
/** @var int|null $mediaFolderId */
$mediaFolderId = ($this->mediaFolder instanceof MediaFolder) ? $this->mediaFolder->getId() : null;
$this->template->assign('folderId', $mediaFolderId);
$this->template->assign('tree', $this->get('media_library.manager.tree_media_browser_images')->getHTML());
$this->header->addJsData('MediaLibrary', 'openedFolderId', $mediaFolderId);
}
protected function getDataGrids(MediaFolder $mediaFolder = null): array
{
return array_map(
function ($type) use ($mediaFolder) {
$dataGrid = MediaItemSelectionDataGrid::getDataGrid(
Type::fromString($type),
($mediaFolder !== null) ? $mediaFolder->getId() : null
);
return [
'label' => Language::lbl('MediaMultiple' . ucfirst($type)),
'tabName' => 'tab' . ucfirst($type),
'mediaType' => $type,
'html' => $dataGrid->getContent(),
'numberOfResults' => $dataGrid->getNumResults(),
];
},
[Type::IMAGE]
);
}
}
| jeroendesloovere/forkcms | src/Backend/Modules/MediaLibrary/Actions/MediaBrowserImages.php | PHP | mit | 1,977 |
import HomeRoute from 'routes/Home';
describe('(Route) Home', () => {
let _component;
beforeEach(() => {
_component = HomeRoute.component();
});
it('Should return a route configuration object', () => {
expect(typeof HomeRoute).to.equal('object');
});
it('Should define a route component', () => {
expect(_component.type).to.equal('div');
});
});
| krizkasper/react-redux-kriz | tests/routes/Home/index.spec.js | JavaScript | mit | 402 |
using GE.WebUI.ViewModels.Abstracts;
using SX.WebCore.MvcControllers;
namespace GE.WebUI.Controllers
{
public sealed class RssController : SxRssController<VMMaterial>
{
}
} | simlex-titul2005/game-exe.com | GE.WebUI/Controllers/RssController.cs | C# | mit | 188 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>MagicMirror: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MagicMirror
 <span id="projectnumber">0.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>testing</b></li><li class="navelem"><b>internal2</b></li><li class="navelem"><a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">TypeWithoutFormatter</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">testing::internal2::TypeWithoutFormatter< T, kTypeKind > Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">testing::internal2::TypeWithoutFormatter< T, kTypeKind ></a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>PrintValue</b>(const T &value,::std::ostream *os) (defined in <a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">testing::internal2::TypeWithoutFormatter< T, kTypeKind ></a>)</td><td class="entry"><a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">testing::internal2::TypeWithoutFormatter< T, kTypeKind ></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>PrintValue</b>(const T &value,::std::ostream *os) (defined in <a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">testing::internal2::TypeWithoutFormatter< T, kTypeKind ></a>)</td><td class="entry"><a class="el" href="classtesting_1_1internal2_1_1_type_without_formatter.html">testing::internal2::TypeWithoutFormatter< T, kTypeKind ></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 25 2015 01:03:00 for MagicMirror by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| larlf/mirror_client | doc/html/classtesting_1_1internal2_1_1_type_without_formatter-members.html | HTML | mit | 5,586 |
#ifndef __TYPES_H__
#define __TYPES_H__
typedef unsigned char byte;
typedef signed long int intsize;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long int int64;
typedef unsigned long int uintsize;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long int uint64;
typedef float float32;
typedef double float64;
#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
#define __bool_true_false_are_defined
typedef byte bool;
#define true ((bool) 1)
#define false ((bool) 0)
#endif
#ifndef NULL
#define NULL ((void*) 0)
#endif
#endif
| nathanfaucett/c-types | src/lib.h | C | mit | 663 |
import 'docs/src/modules/components/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './input.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default Page;
| Kagami/material-ui | pages/api/input.js | JavaScript | mit | 297 |
<script type="text/stache">
<input value:to="H1" value:from="H2" value:bind="H3" on:value="H4"
value:to="H1" value:from="H2" value:bind="H3" on:value="H4">
</script>
<script src="../foo/bar/steal/steal.js">
Component.extend({
tag: 'my-tag',
template: stache(
'<input value:to="H1" value:from="H2" value:bind="H3" on:value="H4" ' +
'value:to="H1" value:from="H2" value:bind="H3" on:value="H4">'
)
});
</script>
| ccummings/can-migrate-codemods | test/fixtures/version-3/can-stache-bindings/colon-bindings-output-implicit.html | HTML | mit | 445 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.