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
<?php namespace Doctrine\Tests\Models\CompositeKeyInheritance; /** * @Entity */ class JoinedChildClass extends JoinedRootClass { /** * @var string * @Column(type="string") */ public $extension = 'ext'; /** * @var string * @Column(type="string") * @Id */ private $additionalId = 'additional'; }
javieralfaya/tuitty
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CompositeKeyInheritance/JoinedChildClass.php
PHP
mit
370
#pragma once #define Mortgage_h #include <iostream> #include <math.h> #include <string> using namespace std; class Mortgage { private: /* ************************************************** Class Constants ************************************************** */ const float NUM_MONTHS = 12.0; // Number of months in a year. const float ONE = 1.0; // Const for one. const float HUNDRED = 100.0; // Const for one hundred. /* ************************************************** String Error constants for each possible error. ************************************************** */ const string ERR_AMOUNT = "Invalid Amount!"; const string ERR_RATE = "Invalid Interest Rate!"; const string ERR_YEARS = "Invalid Years!"; /* ************************************************** Class Member Variables ************************************************** */ float monthlyPayment = 0.0; // Monthly Payment. float loanAmount = 0.0; // The dollar amount of the loan. float interestRate = 0.0; // The annual interest rate. float numYears = 0.0; // The number of years of the loan. /* ************************************************** Private Member Functions ************************************************** */ void MonthlyPayment(); float PeriodInterestRate(); float Term(); void ThrowError(const string ERROR); float GetMonthInterest(float balance); float GetMonthPrincipal(float balance); public: /* ************************************************** Public Member Functions ************************************************** */ bool SetLoanAmount(float amount); bool SetInterestRate(float rate); bool SetYears(float years); float GetMonthlyPayment(); void PrintMonthlyPayment(); void PrintStatement(); void AskUser(); };
Vinlock/Moorpark-M10A
M10B/Homework/Homework-3/Multi-Files-Version/Mortgage.h
C
mit
1,810
// Example input: [ '6', '-26 -25 -28 31 2 27' ] function largerThanNeighbours(args) { var i, count = 0, len = +args[0], myArray = args[1].split(' ').map(Number); for (i = 1; i < len - 1; i += 1) { if (myArray[i] > myArray[i - 1] && myArray[i] > myArray[i + 1]) { count += 1; } } return count; } console.log(largerThanNeighbours([ '6', '-26 -25 -28 31 2 27' ]));
SevdalinZhelyazkov/TelerikAcademy
JavaScript Fundamentals/05. Functions/05. LargerThanNeighbours.js
JavaScript
mit
414
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.network.v2019_02_01.implementation; import java.util.List; import com.microsoft.azure.management.network.v2019_02_01.VirtualNetworkGatewayIPConfiguration; import com.microsoft.azure.management.network.v2019_02_01.VirtualNetworkGatewayType; import com.microsoft.azure.management.network.v2019_02_01.VpnType; import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.v2019_02_01.VirtualNetworkGatewaySku; import com.microsoft.azure.management.network.v2019_02_01.VpnClientConfiguration; import com.microsoft.azure.management.network.v2019_02_01.BgpSettings; import com.microsoft.azure.management.network.v2019_02_01.AddressSpace; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; import com.microsoft.azure.Resource; /** * A common class for general resource information. */ @JsonFlatten @SkipParentValidation public class VirtualNetworkGatewayInner extends Resource { /** * IP configurations for virtual network gateway. */ @JsonProperty(value = "properties.ipConfigurations") private List<VirtualNetworkGatewayIPConfiguration> ipConfigurations; /** * The type of this virtual network gateway. Possible values are: 'Vpn' and * 'ExpressRoute'. Possible values include: 'Vpn', 'ExpressRoute'. */ @JsonProperty(value = "properties.gatewayType") private VirtualNetworkGatewayType gatewayType; /** * The type of this virtual network gateway. Possible values are: * 'PolicyBased' and 'RouteBased'. Possible values include: 'PolicyBased', * 'RouteBased'. */ @JsonProperty(value = "properties.vpnType") private VpnType vpnType; /** * Whether BGP is enabled for this virtual network gateway or not. */ @JsonProperty(value = "properties.enableBgp") private Boolean enableBgp; /** * ActiveActive flag. */ @JsonProperty(value = "properties.activeActive") private Boolean activeActive; /** * The reference of the LocalNetworkGateway resource which represents local * network site having default routes. Assign Null value in case of * removing existing default site setting. */ @JsonProperty(value = "properties.gatewayDefaultSite") private SubResource gatewayDefaultSite; /** * The reference of the VirtualNetworkGatewaySku resource which represents * the SKU selected for Virtual network gateway. */ @JsonProperty(value = "properties.sku") private VirtualNetworkGatewaySku sku; /** * The reference of the VpnClientConfiguration resource which represents * the P2S VpnClient configurations. */ @JsonProperty(value = "properties.vpnClientConfiguration") private VpnClientConfiguration vpnClientConfiguration; /** * Virtual network gateway's BGP speaker settings. */ @JsonProperty(value = "properties.bgpSettings") private BgpSettings bgpSettings; /** * The reference of the address space resource which represents the custom * routes address space specified by the the customer for virtual network * gateway and VpnClient. */ @JsonProperty(value = "properties.customRoutes") private AddressSpace customRoutes; /** * The resource GUID property of the VirtualNetworkGateway resource. */ @JsonProperty(value = "properties.resourceGuid") private String resourceGuid; /** * The provisioning state of the VirtualNetworkGateway resource. Possible * values are: 'Updating', 'Deleting', and 'Failed'. */ @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; /** * Gets a unique read-only string that changes whenever the resource is * updated. */ @JsonProperty(value = "etag") private String etag; /** * Resource ID. */ @JsonProperty(value = "id") private String id; /** * Get iP configurations for virtual network gateway. * * @return the ipConfigurations value */ public List<VirtualNetworkGatewayIPConfiguration> ipConfigurations() { return this.ipConfigurations; } /** * Set iP configurations for virtual network gateway. * * @param ipConfigurations the ipConfigurations value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withIpConfigurations(List<VirtualNetworkGatewayIPConfiguration> ipConfigurations) { this.ipConfigurations = ipConfigurations; return this; } /** * Get the type of this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values include: 'Vpn', 'ExpressRoute'. * * @return the gatewayType value */ public VirtualNetworkGatewayType gatewayType() { return this.gatewayType; } /** * Set the type of this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values include: 'Vpn', 'ExpressRoute'. * * @param gatewayType the gatewayType value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withGatewayType(VirtualNetworkGatewayType gatewayType) { this.gatewayType = gatewayType; return this; } /** * Get the type of this virtual network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased'. * * @return the vpnType value */ public VpnType vpnType() { return this.vpnType; } /** * Set the type of this virtual network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased'. * * @param vpnType the vpnType value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withVpnType(VpnType vpnType) { this.vpnType = vpnType; return this; } /** * Get whether BGP is enabled for this virtual network gateway or not. * * @return the enableBgp value */ public Boolean enableBgp() { return this.enableBgp; } /** * Set whether BGP is enabled for this virtual network gateway or not. * * @param enableBgp the enableBgp value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withEnableBgp(Boolean enableBgp) { this.enableBgp = enableBgp; return this; } /** * Get activeActive flag. * * @return the activeActive value */ public Boolean activeActive() { return this.activeActive; } /** * Set activeActive flag. * * @param activeActive the activeActive value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withActiveActive(Boolean activeActive) { this.activeActive = activeActive; return this; } /** * Get the reference of the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. * * @return the gatewayDefaultSite value */ public SubResource gatewayDefaultSite() { return this.gatewayDefaultSite; } /** * Set the reference of the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. * * @param gatewayDefaultSite the gatewayDefaultSite value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withGatewayDefaultSite(SubResource gatewayDefaultSite) { this.gatewayDefaultSite = gatewayDefaultSite; return this; } /** * Get the reference of the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. * * @return the sku value */ public VirtualNetworkGatewaySku sku() { return this.sku; } /** * Set the reference of the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. * * @param sku the sku value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withSku(VirtualNetworkGatewaySku sku) { this.sku = sku; return this; } /** * Get the reference of the VpnClientConfiguration resource which represents the P2S VpnClient configurations. * * @return the vpnClientConfiguration value */ public VpnClientConfiguration vpnClientConfiguration() { return this.vpnClientConfiguration; } /** * Set the reference of the VpnClientConfiguration resource which represents the P2S VpnClient configurations. * * @param vpnClientConfiguration the vpnClientConfiguration value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withVpnClientConfiguration(VpnClientConfiguration vpnClientConfiguration) { this.vpnClientConfiguration = vpnClientConfiguration; return this; } /** * Get virtual network gateway's BGP speaker settings. * * @return the bgpSettings value */ public BgpSettings bgpSettings() { return this.bgpSettings; } /** * Set virtual network gateway's BGP speaker settings. * * @param bgpSettings the bgpSettings value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withBgpSettings(BgpSettings bgpSettings) { this.bgpSettings = bgpSettings; return this; } /** * Get the reference of the address space resource which represents the custom routes address space specified by the the customer for virtual network gateway and VpnClient. * * @return the customRoutes value */ public AddressSpace customRoutes() { return this.customRoutes; } /** * Set the reference of the address space resource which represents the custom routes address space specified by the the customer for virtual network gateway and VpnClient. * * @param customRoutes the customRoutes value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withCustomRoutes(AddressSpace customRoutes) { this.customRoutes = customRoutes; return this; } /** * Get the resource GUID property of the VirtualNetworkGateway resource. * * @return the resourceGuid value */ public String resourceGuid() { return this.resourceGuid; } /** * Set the resource GUID property of the VirtualNetworkGateway resource. * * @param resourceGuid the resourceGuid value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withResourceGuid(String resourceGuid) { this.resourceGuid = resourceGuid; return this; } /** * Get the provisioning state of the VirtualNetworkGateway resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * * @return the provisioningState value */ public String provisioningState() { return this.provisioningState; } /** * Get gets a unique read-only string that changes whenever the resource is updated. * * @return the etag value */ public String etag() { return this.etag; } /** * Set gets a unique read-only string that changes whenever the resource is updated. * * @param etag the etag value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withEtag(String etag) { this.etag = etag; return this; } /** * Get resource ID. * * @return the id value */ public String id() { return this.id; } /** * Set resource ID. * * @param id the id value to set * @return the VirtualNetworkGatewayInner object itself. */ public VirtualNetworkGatewayInner withId(String id) { this.id = id; return this; } }
navalev/azure-sdk-for-java
sdk/network/mgmt-v2019_02_01/src/main/java/com/microsoft/azure/management/network/v2019_02_01/implementation/VirtualNetworkGatewayInner.java
Java
mit
12,847
package cn.edu.gdut.zaoying.Option.series.map; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface SelectedModeBoolean { boolean value() default true; }
zaoying/EChartsAnnotation
src/cn/edu/gdut/zaoying/Option/series/map/SelectedModeBoolean.java
Java
mit
347
using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; namespace Northwind.Web { public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); GlobalConfiguration.Configure(ODataConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } } }
wmccullough/RepositorySharp
src/Sample/Northwind.Web/Global.asax.cs
C#
mit
646
/* * This file is part of OpenByte IDE, licensed under the MIT License (MIT). * * Copyright (c) TorchPowered 2016 * * 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. */ /* * Created by JFormDesigner on Sat Feb 13 16:51:30 ICT 2016 */ package net.openbyte.gui; import net.openbyte.gui.logger.Consumer; import java.awt.*; import javax.swing.*; /** * @author Gary Lee */ public class OutputFrame extends JDialog implements Consumer { public OutputFrame(Frame owner) { super(owner); initComponents(); } public OutputFrame(Dialog owner) { super(owner); initComponents(); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee scrollPane1 = new JScrollPane(); textArea1 = new JTextArea(); //======== this ======== setTitle("Output"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== scrollPane1 ======== { //---- textArea1 ---- textArea1.setEditable(false); scrollPane1.setViewportView(textArea1); } contentPane.add(scrollPane1, BorderLayout.CENTER); setSize(1000, 370); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } @Override public void appendText(String text) { this.textArea1.append(text); } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // Generated using JFormDesigner Evaluation license - Gary Lee private JScrollPane scrollPane1; private JTextArea textArea1; // JFormDesigner - End of variables declaration //GEN-END:variables }
TorchPowered/OpenByte
src/main/java/net/openbyte/gui/OutputFrame.java
Java
mit
2,906
using System; using System.Text; using System.Collections; using System.Collections.Generic; namespace Com.Aspose.Tasks.Model { public class RecurringInfoResponse { public RecurringInfo RecurringInfo { get; set; } public string Code { get; set; } public string Status { get; set; } public override string ToString() { var sb = new StringBuilder(); sb.Append("class RecurringInfoResponse {\n"); sb.Append(" RecurringInfo: ").Append(RecurringInfo).Append("\n"); sb.Append(" Code: ").Append(Code).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append("}\n"); return sb.ToString(); } } }
asposetasks/Aspose_Tasks_Cloud
SDKs/Aspose.Tasks-Cloud-SDK-for-.NET/src/Com/Aspose/Tasks/Model/RecurringInfoResponse.cs
C#
mit
682
"use strict"; var util = require("util"); /** * InvalidRateLimitConfiguration error triggered when passed invalid configurations. * * @param {String} description Extended description * @returns {void} */ function InvalidRateLimiterConfiguration(description) { Error.captureStackTrace(this, this.constructor); this.statusCode = 421; this.name = this.constructor.name; this.message = "Invalid rate limit configuration !!!"; if (description) { this.message += " " + description; } } util.inherits(InvalidRateLimiterConfiguration, Error); module.exports = InvalidRateLimiterConfiguration;
clydeio/clydeio-simple-rate-limiter
lib/invalid-rate-limiter-configuration-error.js
JavaScript
mit
609
@import url('https://fonts.googleapis.com/css?family=Raleway'); html, body { width: 100%; height: 100%; } body { font-family: 'Raleway', sans-serif; margin: 0; font-weight: bold; } h1, h4 { text-align: center; } h4 { font-style: italic; } main { padding: 0 40px; min-height: 80%; } ul.menu { background-color: #2fa4e7; padding: 0; margin: 0; height: 50px; } .nav { width: 100%; } .nav ul { padding-left: 0; } .nav li, .right { display: inline-block; border-radius: 3px; padding-top: 13px; } .nav li:first-of-type { padding-left: 0; } .nav li a { text-decoration-line: none; padding: 10px; color: white; } .nav a:hover { text-decoration: underline; } /** Feedback message. */ .message { margin: 0 40px; border-radius: 5px; color: #fff; padding: 10px; text-align: center; font-size: 20px; } .error { width: 30%; margin: 0 auto; margin-top: 10px; height: 30px; border-radius: 20px; text-align: center; color: white; padding: 5px; background: rgb(194, 53, 53); } footer { text-align: center; position: relative; right: 0; bottom: 0; left: 0; } .head-title { margin-top: 0; text-align: center; } /** Default wrapper */ .container { box-sizing: border-box; width: 100%; height: 100%; } .wrapper { position: relative; border: 1px solid black; box-sizing: border-box; padding: 10px; margin: 10px; } /** Layout */ .inline { display: inline-block; } .row { display: block; } .small { width: 20%; } .medium { width: 33%; } .large { width: 100%; } .cards { display: flex; align-content: flex-start; flex-wrap: wrap; } .form { display: flex; height: 40px; width: 50%; margin: 0 auto; } .center-form { width: 23%; margin: 0 auto; } .form-group label { font-size: 1.2em; } .search { float: left !important; margin-right: 10px !important; margin-left: 30px; } .input-field { float: right; box-sizing: border-box; padding: 10px; border-radius: 10px; border: 2px solid lightgrey; font-size: inherit; } .input-field:focus { outline: none; } .form-group { width: 100%; height: 50px; } .btn-search { margin-top: 3px !important; height: 36px; padding: 5px 10px 5px 10px !important; } .btn { padding: 10px; border: 1px solid lightgrey; border-radius: 5px; color: inherit; margin-left: 5px; margin: 0 auto; vertical-align: middle; } .btn:hover { cursor: pointer; } .btn-primary { color: #ffffff; background-color: #2fa4e7; border-color: #2fa4e7; margin-left: 50%; margin-top: 10px; } .send { margin-left: 5px !important; margin-top: 0 !important; } .btn-success { color: #ffffff; background-color: #73a839; border-color: #73a839; width: 35% !important; border-radius: 20px; height: 45px; } .btn-warning { color: #ffffff; background-color: #dd5600; border-color: #dd5600; } .btn-danger { color: #ffffff; background-color: #c71c22; border-color: #c71c22; width: 35% !important; border-radius: 20px; height: 45px; } #likes { color: darkgreen; } .wrapper::after { clear: both; } .thread-message { color: #ffffff; border-radius: 10px; max-width: 80%; padding: 10px; margin: 5px; word-break: break-all; } .thread-message::after { clear: both; content: ''; } .left { float: left; background-color: dimgray; } .right { float: right; background-color: #2fa4e7; } .message-row { margin: 10px 0; } .clear { clear: both; } .chat-wrapper { width: 80%; margin: auto; } .chat-form { display: flex; height: 50px; margin: 0 auto; width: 49%; } .message-img { width: 100%; } .liked { color: gold; } textarea { width: 90%; border-radius: 10px; resize: none; } #message-wrapper { width: 600px; height: 400px; border: 2px solid rgb(182, 182, 182); margin: 0 auto; margin-top: 20px; margin-bottom: 20px; border-radius: 20px; overflow-y: auto; } /* width */ ::-webkit-scrollbar { width: 15px; } /* Track */ ::-webkit-scrollbar-track { box-shadow: inset 0 0 5px rgb(73, 152, 255); border-radius: 10px; margin-top: 5px; margin-bottom: 5px; } /* Handle */ ::-webkit-scrollbar-thumb { background: #2fa4e7; border-radius: 10px; } .message-row { clear: both; } .threads-list { display: flex; } .thread { display: block; width: 20%; text-align: center; border: 2px solid rgb(182, 182, 182); border-radius: 10px; padding-bottom: 5px; margin: 0 10px 0 10px; } span { font-weight: bolder; font-size: 17px; font-style: italic; text-align: center; padding: 5px; } span.error { animation: fadeOut 1s forwards; animation-delay: 2s; background: #EF5542; color: white; padding: 10px; text-align: center; text-decoration: none; border-radius: 20px; font-weight: normal; position: relative; float: right; margin-top: 10px; overflow: hidden; display: block; } @-webkit-keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
zrusev/SoftUni_2016
12. ExpressJS Fundamentals - Jan 2019/07. Exam Preparation/Messenger/static/css/site.css
CSS
mit
5,106
<h2 class="volsignup">Sign Up to be a Volunteer</h2> <!-- <div ng-show="error">{{vol.error}}</div> --> <form name="form" ng-submit="signUp()"> <div ng-class="{ 'has-error': form.first_name.$dirty && form.first_name.$error.required }"> <div class="form-group"> <label class="sr-only" for="first_name">First Name</label> <input type="text" name="first_name" class="form-control" placeholder="First Name" ng-model="first_name" required /> <span ng-show="form.first_name.$dirty && form.first_name.$error.required" class="help-block">First name is required.</span> </div> </div> <div ng-class="{ 'has-error': form.last_name.$dirty && form.last_name.$error.required }"> <div class="form-group"> <label class="sr-only" for="last_name">Last Name</label> <input type="text" name="last_name" class="form-control" placeholder="Last Name" ng-model="last_name" required /> <ng-show="form.last_name.$dirty && form.last_name.$error.required" class="help-block"></span> </div> </div> <div ng-class="{ 'has-error': email.$dirty && email.$error.required }"> <div class="form-group"> <label class="sr-only" for="email">Email</label> <input type="email" name="email" class="form-control" placeholder="Email" ng-model="email" required /> <span ng-show="email.$dirty && email.$error.required" class="help-block">Email is required.</span> </div> </div> <div ng-class="{ 'has-error': interest.$dirty && interest.$error.required }"> <div class="form-group"> <label class="sr-only" for="interest">Interest</label> <input type="text" name="interest" class="form-control" placeholder="Interest" ng-model="interest" required /> <span ng-show="interest.$dirty && interest.$error.required" class="help-block">Interest is required.</span> </div> </div> <div ng-class="{ 'has-error': form.password.$dirty && form.password.$error.required }"> <div class="form-group"> <label class="sr-only" for="password">Password</label> <input type="password" name="password" class="form-control" placeholder="Password" ng-model="password" required /> <span ng-show="form.password.$dirty && form.password.$error.required" class="help-block"></span> </div> </div> <div class="volsingupbutton" > <button type="submit" class="btn btn-default">Sign Up</button> <p><a href="#/main/new" id="linkssss">Already a member? Sign in</a></p> </div> </form> </div>
TeresaNesteby/chariteer-client-side
app/views/volunteers/new.html
HTML
mit
2,568
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function Target (x, y) { this.left = x; this.top = y; this.right = x + 100; this.bottom = y + 35; } Target.prototype.getBoundingClientRect = function () { return this; } var targets = [ new Target(0, 0), new Target(110, 0), new Target(220, 0), new Target(330, 0), new Target(440, 0), new Target(550, 0), new Target(0, 100), new Target(110, 100), new Target(220, 100), new Target(330, 100), new Target(440, 100), new Target(550, 100), ]; var fixations = [ {x: 30, y: 15, saccade: {x: 0, y: 0, newLine: false}}, {x: 130, y: 10, saccade: {x: 100, y: -5, newLine: false}}, {x: 250, y: -5, saccade: {x: 120, y: -15, newLine: false}}, {x: 370, y: 5, saccade: {x: 120, y: 10, newLine: false}}, {x: 470, y: -10, saccade: {x: 100, y: -15, newLine: false}}, {x: 490, y: 5, saccade: {x: 20, y: 15, newLine: false}}, {x: 590, y: 0, saccade: {x: 100, y: -5, newLine: false}}, {x: 200, y: 30, saccade: {x: -290, y: 30, newLine: true}}, {x: 30, y: 120, saccade: {x: -170, y: 90, newLine: true}}, {x: 130, y: 120, saccade: {x: 100, y: 0, newLine: false}}, {x: 250, y: 115, saccade: {x: 120, y: -5, newLine: false}}, {x: 370, y: 100, saccade: {x: 120, y: -15, newLine: false}}, {x: 470, y: 95, saccade: {x: 100, y: -5, newLine: false}}, {x: 490, y: 95, saccade: {x: 20, y: 0, newLine: false}}, {x: 590, y: 90, saccade: {x: 100, y: -5, newLine: false}}, ]; var model = Geometry.create( targets ); LinePredictor.init( model ); var input = fixations.map( (fix, index) => { return { fix: fix, isReading: index > 1 }; }); describe( 'LinePredictor', function() { describe( '#get( isEnteredReadingMode, currentFixation, currentLine, offset )', function () { var line = null; var results = input.map( (item) => { console.log( '\n ===== NEW FIX =====\n' ); line = LinePredictor.get( item.isReading, item.fix, line, 0 ); if (line) { line.addFixation( item.fix ); } return line; }); it( `should all fixations be mapped`, function () { let fixCount = results.reduce( (count, line) => { return count + (!line ? 1 : 0); }, 0); assert.equal( 0, fixCount ); }); it( `should 8 fixations be mapped onto line 0`, function () { let fixCount = results.reduce( (count, line) => { return count + (line && line.index === 0 ? 1 : 0); }, 0); assert.equal( 8, fixCount ); }); it( `should 7 fixations be mapped onto line 1`, function () { let fixCount = results.reduce( (count, line) => { return count + (line && line.index === 1 ? 1 : 0); }, 0); assert.equal( 7, fixCount ); }); }); });
uta-gasp/reading2
tests/model_linePredictor.js
JavaScript
mit
2,853
var shovel = require('../shovel'), util = require('../util'), temp = require('temp'); module.exports.run = function run(opts, cb) { temp.track(); var racketCodeDir = temp.mkdirSync('racket'), args = ['-l', 'racket/base']; shovel.start(opts, cb, { solutionOnly: function () { if (opts.setup) { var setupFile = util.codeWriteSync('racket', opts.setup, racketCodeDir, 'setup.rkt'); args.push('-t', setupFile); } args.push('-e', opts.solution); return { name: 'racket', args: args }; }, fullProject: function () { throw 'Test framework is not supported'; } }); };
xcthulhu/codewars-runner
lib/runners/racket.js
JavaScript
mit
761
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This screen shows partial list views, both in a screen and in a dialog. # This screen also shows pull to refresh # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class ExamplePartialListXML < PMListScreen refreshable xml_layout :embedded_listview title "View with a ListView Inside" def on_load find(:text_view).on(:tap) do d_opts = { w: rmq.device.width * 0.8, h: rmq.device.height * 0.8, xml_layout: app.r.layout(:dialog_list_view), } dialog = PotionDialog.new(d_opts).dialog # TODO: would be nice if this were wrapped @listview = dialog.findViewById(R::Id::Dialog_list_view) # can't use RMQ here yet simple_data_adapter = PMBaseAdapter.new(data: buncho_cells) @listview.adapter = simple_data_adapter find(@listview).on(:tap) do |parent, view, position, _id| # have fun with those click events find(view).style { |st| st.background_color = rmq.color.random } end end end def table_data [{ cells: buncho_cells }] end def on_refresh mp "I was refreshed!" update_table_data stop_refreshing end private def buncho_cells array_of_cells = [] 100.times do |i| array_of_cells << {title: "Here's cell #{i}"} end array_of_cells end end
infinitered/bluepotion
app/screens/example_partial_list_xml_screen.rb
Ruby
mit
1,421
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), requirejs: { compile: { options: { paths: { requireLib: 'node_modules/requirejs/require' }, include: [ "requireLib" ], baseUrl: ".", mainConfigFile: "app.js", name: "app", optimize: "uglify2", out: "<%= pkg.name %>.min.js" } } } }); // load libs grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-exec'); // building task grunt.registerTask('build', [ 'requirejs' ]); };
szymonkaliski/pex
examples/webOptimizedBuild/gruntfile.js
JavaScript
mit
554
using System; using System.Collections.Generic; using Newtonsoft.Json; using ShopifySharp.Enums; using ShopifySharp.Converters; namespace ShopifySharp { public class ShopifyProductVariant : ShopifyObject { /// <summary> /// The unique numeric identifier for the product. /// </summary> [JsonProperty("product_id")] public long ProductId { get; set; } /// <summary> /// The title of the product variant. /// </summary> [JsonProperty("title")] public string Title { get; set; } /// <summary> /// A unique identifier for the product in the shop. /// </summary> [JsonProperty("sku")] public string SKU { get; set; } /// <summary> /// The order of the product variant in the list of product variants. 1 is the first position. /// </summary> [JsonProperty("position")] public int Position { get; set; } /// <summary> /// The weight of the product variant in grams. /// </summary> [JsonProperty("grams"),JsonConverter(typeof(NullToZeroConverter))] public int Grams { get; set; } /// <summary> /// Specifies whether or not customers are allowed to place an order for a product variant when it's out of stock. /// </summary> [JsonProperty("inventory_policy")] public ShopifyProductInventoryPolicy? InventoryPolicy { get; set; } /// <summary> /// Service that is doing the fulfillment. Can be 'manual' or any custom string. /// </summary> [JsonProperty("fulfillment_service")] public string FulfillmentService { get; set; } /// <summary> /// Specifies whether or not Shopify tracks the number of items in stock for this product variant. /// </summary> [JsonProperty("inventory_management")] public ShopifyProductInventoryManagement? InventoryManagement { get; set; } /// <summary> /// The price of the product variant. /// </summary> [JsonProperty("price")] public double Price { get; set; } /// <summary> /// The competitors prices for the same item. /// </summary> [JsonProperty("compare_at_price", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] public double? CompareAtPrice { get; set; } /// <summary> /// Custom properties that a shop owner can use to define product variants. /// </summary> [JsonProperty("option1")] public string Option1 { get; set; } /// <summary> /// Custom properties that a shop owner can use to define product variants. /// </summary> [JsonProperty("option2")] public string Option2 { get; set; } /// <summary> /// Custom properties that a shop owner can use to define product variants. /// </summary> [JsonProperty("option3")] public string Option3 { get; set; } /// <summary> /// The date and time when the product variant was created. The API returns this value in ISO 8601 format. /// </summary> [JsonProperty("created_at", DefaultValueHandling = DefaultValueHandling.Ignore)] public DateTime CreatedAt { get; set; } /// <summary> /// The date and time when the product variant was last modified. The API returns this value in ISO 8601 format. /// </summary> [JsonProperty("updated_at", DefaultValueHandling = DefaultValueHandling.Ignore)] public DateTime UpdatedAt { get; set; } /// <summary> /// Specifies whether or not a tax is charged when the product variant is sold. /// </summary> [JsonProperty("taxable")] public bool Taxable { get; set; } /// <summary> /// Specifies whether or not a customer needs to provide a shipping address when placing an order for this product variant. /// </summary> [JsonProperty("requires_shipping")] public bool RequiresShipping { get; set; } /// <summary> /// The barcode, UPC or ISBN number for the product. /// </summary> [JsonProperty("barcode")] public string Barcode { get; set; } /// <summary> /// The number of items in stock for this product variant. /// </summary> [JsonProperty("inventory_quantity")] public int InventoryQuantity { get; set; } /// <summary> /// The original stock level the client believes the product variant has. /// This should be sent to avoid a race condition when the item being adjusted is simultaneously sold online. /// </summary> [JsonProperty("old_inventory_quantity")] public int OldInventoryQuantity { get; set; } /// <summary> /// Instead of sending a new and old value for inventory an adjustment value can be sent. /// If an adjustment value is sent it will take priority. /// </summary> [JsonProperty("inventory_quantity_adjustment")] public int InventoryQuantityAdjustment { get; set; } /// <summary> /// The unique numeric identifier for one of the product's images. /// </summary> [JsonProperty("image_id", DefaultValueHandling = DefaultValueHandling.Ignore)] public long? ImageId { get; set; } /// <summary> /// The weight of the product variant in the unit system specified with weight_unit. /// </summary> [JsonProperty("weight")] public double Weight { get; set; } /// <summary> /// The unit system that the product variant's weight is measure in. The weight_unit can be either "g", "kg, "oz", or "lb". /// </summary> [JsonProperty("weight_unit")] public string WeightUnit { get; set; } /// <summary> /// Attaches additional information to a shop's resources. /// </summary> [JsonProperty("metafields")] public IEnumerable<ShopifyMetaField> Metafields { get; set; } } }
Yitzchok/ShopifySharp
ShopifySharp/Entities/ShopifyProductVariant.cs
C#
mit
6,153
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <list> // template <InputIterator Iter> // iterator insert(const_iterator position, Iter first, Iter last); // UNSUPPORTED: sanitizer-new-delete #if _LIBCPP_DEBUG >= 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #endif #include <list> #include <cstdlib> #include <cassert> #include "test_iterators.h" #include "min_allocator.h" int throw_next = 0xFFFF; int count = 0; void* operator new(std::size_t s) throw(std::bad_alloc) { if (throw_next == 0) throw std::bad_alloc(); --throw_next; ++count; return std::malloc(s); } void operator delete(void* p) throw() { --count; std::free(p); } int main() { { int a1[] = {1, 2, 3}; std::list<int> l1; std::list<int>::iterator i = l1.insert(l1.begin(), a1, a1+3); assert(i == l1.begin()); assert(l1.size() == 3); assert(distance(l1.begin(), l1.end()) == 3); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 3); int a2[] = {4, 5, 6}; i = l1.insert(i, a2, a2+3); assert(*i == 4); assert(l1.size() == 6); assert(distance(l1.begin(), l1.end()) == 6); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 4); ++i; assert(*i == 5); ++i; assert(*i == 6); ++i; assert(*i == 3); throw_next = 2; int save_count = count; try { i = l1.insert(i, a2, a2+3); assert(false); } catch (...) { } assert(save_count == count); assert(l1.size() == 6); assert(distance(l1.begin(), l1.end()) == 6); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 4); ++i; assert(*i == 5); ++i; assert(*i == 6); ++i; assert(*i == 3); } throw_next = 0xFFFF; #if _LIBCPP_DEBUG >= 1 { std::list<int> v(100); std::list<int> v2(100); int a[] = {1, 2, 3, 4, 5}; const int N = sizeof(a)/sizeof(a[0]); std::list<int>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a), input_iterator<const int*>(a+N)); assert(false); } #endif #if __cplusplus >= 201103L { int a1[] = {1, 2, 3}; std::list<int, min_allocator<int>> l1; std::list<int, min_allocator<int>>::iterator i = l1.insert(l1.begin(), a1, a1+3); assert(i == l1.begin()); assert(l1.size() == 3); assert(distance(l1.begin(), l1.end()) == 3); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 3); int a2[] = {4, 5, 6}; i = l1.insert(i, a2, a2+3); assert(*i == 4); assert(l1.size() == 6); assert(distance(l1.begin(), l1.end()) == 6); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 4); ++i; assert(*i == 5); ++i; assert(*i == 6); ++i; assert(*i == 3); throw_next = 2; int save_count = count; try { i = l1.insert(i, a2, a2+3); assert(false); } catch (...) { } assert(save_count == count); assert(l1.size() == 6); assert(distance(l1.begin(), l1.end()) == 6); i = l1.begin(); assert(*i == 1); ++i; assert(*i == 2); ++i; assert(*i == 4); ++i; assert(*i == 5); ++i; assert(*i == 6); ++i; assert(*i == 3); } #if _LIBCPP_DEBUG >= 1 { throw_next = 0xFFFF; std::list<int, min_allocator<int>> v(100); std::list<int, min_allocator<int>> v2(100); int a[] = {1, 2, 3, 4, 5}; const int N = sizeof(a)/sizeof(a[0]); std::list<int, min_allocator<int>>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a), input_iterator<const int*>(a+N)); assert(false); } #endif #endif }
fstudio/Phoenix
test/Experimental/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
C++
mit
4,244
namespace OneSky.CSharp.Json { using System; public interface IQuotationDetails { decimal PerWordCost { get; } decimal TotalCost { get; } DateTime WillCompleteAt { get; } long WillCompleteAtTimestamp { get; } int SecondsToComplete { get; } } }
QuadRatNewBy/OneSky.CSharp
OneSky.CSharp/OneSky.CSharp/Json/Objects/IQuotationDetails.cs
C#
mit
307
package org.eluder.coveralls.maven.plugin.service; import java.util.Properties; /* * #[license] * coveralls-maven-plugin * %% * Copyright (C) 2013 - 2016 Tapio Rautonen * %% * 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. * %[license] */ /** * Service specific mojo properties. */ public interface ServiceSetup { /** * @return <code>true</code> if this service is selected, otherwise <code>false</code> */ boolean isSelected(); /** * @return service name */ String getName(); /** * @return service job id, or <code>null</code> if not defined */ String getJobId(); /** * @return service build number, or <code>null</code> if not defined */ String getBuildNumber(); /** * @return service build url, or <code>null</code> if not defined */ String getBuildUrl(); /** * @return git branch name, or <code>null</code> if not defined */ String getBranch(); /** * @return pull request identifier, or <code>null</code> if not defined */ String getPullRequest(); /** * @return environment related to service, or <code>null</code> if not defined */ Properties getEnvironment(); }
trautonen/coveralls-maven-plugin
src/main/java/org/eluder/coveralls/maven/plugin/service/ServiceSetup.java
Java
mit
2,285
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. //Distributed under the Boost Software License, Version 1.0. (See accompanying //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifdef BOOST_QVM_TEST_SINGLE_HEADER # include BOOST_QVM_TEST_SINGLE_HEADER #else # include <boost/qvm/vec_operations.hpp> #endif #include "test_qvm_vector.hpp" #include "gold.hpp" namespace { template <int Dim> void test() { using namespace boost::qvm::sfinae; test_qvm::vector<V1,Dim> x(42,1); test_qvm::scalar_multiply_v(x.b,x.a,0.5f); x/=2; BOOST_QVM_TEST_EQ(x.a,x.b); } } int main() { test<1>(); test<2>(); test<3>(); test<4>(); test<5>(); return boost::report_errors(); }
davehorton/drachtio-server
deps/boost_1_77_0/libs/qvm/test/div_eq_vs_test.cpp
C++
mit
813
module Cms class PeopleController < Cms::AdminController def index @people = @group ? @group.people : Person.top_level end def show @person = Person.find(params[:id]) end def new @person = Person.new end def edit @person = Person.find(params[:id]) end def create person = Person.new(params[:person]) if person.save redirect_path = person.group ? group_path(person.group) : people_path redirect_to people_path(@group), :notice => "Successfully created person" else flash[:error] = "There was an error creating the person" render :action => "new" end end def update person = Person.find(params[:id]) if person.update_attributes(params[:person]) redirect_to people_path(@group), :notice => "Successfully updated person" else flash[:error] = "There was an error updating the person" render :action => "edit" end end def destroy @person = Person.find(params[:id]) @person.destroy redirect_to people_path(@group) end end end
nicholashibberd/cms
controllers/cms/people_controller.rb
Ruby
mit
1,130
package llrb_test import ( "fmt" "github.com/gyuho/goraph/llrb" ) func Example_rotateToLeft() { node3 := llrb.NewNode(llrb.Float64(3)) node3.Black = true node1 := llrb.NewNode(llrb.Float64(1)) node1.Black = true node13 := llrb.NewNode(llrb.Float64(13)) node13.Black = false node9 := llrb.NewNode(llrb.Float64(9)) node9.Black = true node17 := llrb.NewNode(llrb.Float64(17)) node17.Black = true tr := llrb.New(node3) tr.Root.Right = node13 tr.Root.Right.Left = node9 tr.Root.Right.Right = node17 tr.Root.Left = node1 /* 3(B) / \ 1(B) 13(R) / \ 9(B) 17(B) */ fmt.Println("Before tr.Root = llrb.RotateToLeft(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) tr.Root = llrb.RotateToLeft(tr.Root) /* 13(B) / \ 3(R) 17(B) / \ 1(B) 9(B) */ fmt.Println("After tr.Root = llrb.RotateToLeft(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) // Output: // Before tr.Root = llrb.RotateToLeft(tr.Root) // [1(true)] // [[1(true)] 3(true) [[9(true)] 13(false) [17(true)]]] // [[9(true)] 13(false) [17(true)]] // After tr.Root = llrb.RotateToLeft(tr.Root) // [[1(true)] 3(false) [9(true)]] // [[[1(true)] 3(false) [9(true)]] 13(true) [17(true)]] // [17(true)] } func Example_rotateToRight() { node20 := llrb.NewNode(llrb.Float64(20)) node20.Black = true node39 := llrb.NewNode(llrb.Float64(39)) node39.Black = true node25 := llrb.NewNode(llrb.Float64(25)) node25.Black = false node16 := llrb.NewNode(llrb.Float64(16)) node16.Black = false node15 := llrb.NewNode(llrb.Float64(15)) node15.Black = true node17 := llrb.NewNode(llrb.Float64(17)) node17.Black = true tr := llrb.New(node20) tr.Root.Right = node39 tr.Root.Right.Left = node25 tr.Root.Left = node16 tr.Root.Left.Left = node15 tr.Root.Left.Right = node17 /* 20(B) / \ 16(R) 39(B) / \ / 15(B) 17(B) 25(R) */ fmt.Println("Before tr.Root = llrb.RotateToRight(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) tr.Root = llrb.RotateToRight(tr.Root) /* 16(B) / \ 15(B) 20(R) / \ 17(B) 39(B) / 25(R) */ fmt.Println("After tr.Root = llrb.RotateToRight(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) // Output: // Before tr.Root = llrb.RotateToRight(tr.Root) // [[15(true)] 16(false) [17(true)]] // [[[15(true)] 16(false) [17(true)]] 20(true) [[25(false)] 39(true)]] // [[25(false)] 39(true)] // After tr.Root = llrb.RotateToRight(tr.Root) // [15(true)] // [[15(true)] 16(true) [[17(true)] 20(false) [[25(false)] 39(true)]]] // [[17(true)] 20(false) [[25(false)] 39(true)]] } func Example_flipColor() { node3 := llrb.NewNode(llrb.Float64(3)) node3.Black = true node1 := llrb.NewNode(llrb.Float64(1)) node1.Black = true node13 := llrb.NewNode(llrb.Float64(13)) node13.Black = true node9 := llrb.NewNode(llrb.Float64(9)) node9.Black = true node17 := llrb.NewNode(llrb.Float64(17)) node17.Black = true tr := llrb.New(node3) tr.Root.Right = node13 tr.Root.Right.Left = node9 tr.Root.Right.Right = node17 tr.Root.Left = node1 /* 3(B) / \ 1(B) 13(B) / \ 9(B) 17(B) */ fmt.Println("Before llrb.FlipColor(tr.Root.Right)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) llrb.FlipColor(tr.Root.Right) /* 3(B) / \ 1(B) 13(R) / \ 9(R) 17(R) */ fmt.Println("After llrb.FlipColor(tr.Root.Right)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) // Output: // Before llrb.FlipColor(tr.Root.Right) // [1(true)] // [[1(true)] 3(true) [[9(true)] 13(true) [17(true)]]] // [[9(true)] 13(true) [17(true)]] // After llrb.FlipColor(tr.Root.Right) // [1(true)] // [[1(true)] 3(true) [[9(false)] 13(false) [17(false)]]] // [[9(false)] 13(false) [17(false)]] } func Example_moveRedFromRightToLeft() { node3 := llrb.NewNode(llrb.Float64(3)) node3.Black = true node2 := llrb.NewNode(llrb.Float64(2)) node2.Black = true node15 := llrb.NewNode(llrb.Float64(15)) node15.Black = true node1 := llrb.NewNode(llrb.Float64(1)) node1.Black = true node2point5 := llrb.NewNode(llrb.Float64(2.5)) node2point5.Black = true node13 := llrb.NewNode(llrb.Float64(13)) node13.Black = false node17 := llrb.NewNode(llrb.Float64(17)) node17.Black = true tr := llrb.New(node3) tr.Root.Right = node15 tr.Root.Right.Left = node13 tr.Root.Right.Right = node17 tr.Root.Left = node2 tr.Root.Left.Left = node1 tr.Root.Left.Right = node2point5 /* 3(B) / \ 2(B) 15(B) / \ / \ 1(B) 2.5(B) 13(R) 17(B) */ fmt.Println("Before tr.Root = llrb.MoveRedFromRightToLeft(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) tr.Root = llrb.MoveRedFromRightToLeft(tr.Root) /* 13(B) / \ 3(B) 15(B) / \ 2(R) 17(B) / \ 1(B) 2.5(B) */ fmt.Println("After tr.Root = llrb.MoveRedFromRightToLeft(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) // Output: // Before tr.Root = llrb.MoveRedFromRightToLeft(tr.Root) // [[1(true)] 2(true) [2.5(true)]] // [[[1(true)] 2(true) [2.5(true)]] 3(true) [[13(false)] 15(true) [17(true)]]] // [[13(false)] 15(true) [17(true)]] // After tr.Root = llrb.MoveRedFromRightToLeft(tr.Root) // [[[1(true)] 2(false) [2.5(true)]] 3(true)] // [[[[1(true)] 2(false) [2.5(true)]] 3(true)] 13(true) [15(true) [17(true)]]] // [15(true) [17(true)]] } func Example_moveRedFromLeftToRight() { node13 := llrb.NewNode(llrb.Float64(13)) node13.Black = true node3 := llrb.NewNode(llrb.Float64(3)) node3.Black = true node16 := llrb.NewNode(llrb.Float64(16)) node16.Black = true node2 := llrb.NewNode(llrb.Float64(2)) node2.Black = false node9 := llrb.NewNode(llrb.Float64(9)) node9.Black = true node15 := llrb.NewNode(llrb.Float64(15)) node15.Black = true node25 := llrb.NewNode(llrb.Float64(25)) node25.Black = true node1 := llrb.NewNode(llrb.Float64(1)) node1.Black = true node2point5 := llrb.NewNode(llrb.Float64(2.5)) node2point5.Black = true node17 := llrb.NewNode(llrb.Float64(17)) node17.Black = false tr := llrb.New(node13) tr.Root.Right = node16 tr.Root.Right.Left = node15 tr.Root.Right.Right = node25 tr.Root.Right.Right.Left = node17 tr.Root.Left = node3 tr.Root.Left.Left = node2 tr.Root.Left.Right = node9 tr.Root.Left.Left.Left = node1 tr.Root.Left.Left.Right = node2point5 /* 13(B) / \ 3(B) 16(B) / \ / \ 2(R) 9(B) 15(B) 25(B) / \ / 1(B) 2.5(B) 17(R) */ fmt.Println("Before tr.Root = llrb.MoveRedFromLeftToRight(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) tr.Root = llrb.MoveRedFromLeftToRight(tr.Root) /* 3(B) / \ 2(B) 13(B) / \ / \ 1(B) 2.5(B) 9(B) 16(R) / \ 15(B) 25(B) / 17(R) */ fmt.Println("After tr.Root = llrb.MoveRedFromRightToLeft(tr.Root)") fmt.Println(tr.Root.Left) fmt.Println(tr.Root) fmt.Println(tr.Root.Right) // Output: // Before tr.Root = llrb.MoveRedFromLeftToRight(tr.Root) // [[[1(true)] 2(false) [2.5(true)]] 3(true) [9(true)]] // [[[[1(true)] 2(false) [2.5(true)]] 3(true) [9(true)]] 13(true) [[15(true)] 16(true) [[17(false)] 25(true)]]] // [[15(true)] 16(true) [[17(false)] 25(true)]] // After tr.Root = llrb.MoveRedFromRightToLeft(tr.Root) // [[1(true)] 2(true) [2.5(true)]] // [[[1(true)] 2(true) [2.5(true)]] 3(true) [[9(true)] 13(true) [[15(true)] 16(false) [[17(false)] 25(true)]]]] // [[9(true)] 13(true) [[15(true)] 16(false) [[17(false)] 25(true)]]] } func Example_balance() { node13 := llrb.NewNode(llrb.Float64(13)) node13.Black = true node3 := llrb.NewNode(llrb.Float64(3)) node3.Black = false node2 := llrb.NewNode(llrb.Float64(2)) node2.Black = false tr1 := llrb.New(node13) tr1.Root.Left = node3 tr1.Root.Left.Left = node2 /* 13(B) / 3(R) / 2(R) */ tr1.Root = llrb.Balance(tr1.Root) /* 3(R) / \ 2(B) 13(B) */ fmt.Println("After tr1.Root = llrb.Balance(tr1.Root):", tr1) // Output: // After tr1.Root = llrb.Balance(tr1.Root): [[2(true)] 3(false) [13(true)]] // Don't do this: // // tr2 := llrb.New(node13) // tr2.Root.Left = node3 // tr2.Root.Left.Left = node2 // llrb.Balance(tr2.Root) // (X) this will cut off the tree // fmt.Println(tr2) // (X) this will [stack growth] error }
hsavit1/goraph
llrb/example_move_test.go
GO
mit
9,074
import { tee } from "./tee"; import { pump } from "./pump"; import { createDuplex } from "./duplex"; import { wrapAsyncIterableIterator } from "./wrap-async-iterable-iterator"; /** * Calls all target functions in parallel, and returns the yielded values of the _fastest_ one. * * @example * * const ping = race( * * ); */ export const race = (...fns: Function[]) => (...args): AsyncIterableIterator<any> => { return createDuplex((input, output) => { let primaryInput = input as AsyncIterableIterator<any>; let wonFn; fns.forEach((fn, i) => { let spareInput; [spareInput, primaryInput] = tee(primaryInput); const iter =  wrapAsyncIterableIterator(fn(...args)); pump(spareInput, (value) => { return iter.next(value).then(({ value, done }) => { if (wonFn && wonFn !== fn) { return; } wonFn = fn; if (done) { output.return(); } else { output.unshift(value); } }); }).then(() => { if (wonFn === fn) { output.return(); } }); }); }); };
mojo-js/mesh.js
packages/mesh/src/race.ts
TypeScript
mit
1,146
### Initialize SdkboxPlay Initialize the plugin where appropriate in your code. We recommend to do this in the `AppDelegate::applicationDidFinishLaunching()` or `AppController:didFinishLaunchingWithOptions()`. Make sure to include the appropriate headers: ```cpp #include "PluginSdkboxPlay/PluginSdkboxPlay.h" AppDelegate::applicationDidFinishLaunching() { sdkbox::PluginSdkboxPlay::init(); } ``` ### Using SdkboxPlay #### Intro SdkboxPlay is an abstraction for Google Play and Game Center’s social services. Under a common API exposes access to Leaderboards and Achievements for each platform. In order to keep the API fit to the two models, some tradeoffs have been made, which will be detailed in each section ##### Logged in user info Calling the method `sdkbox::SdkboxPlay::getPlayerId()` to get an id per platform that uniquely identifies the logged-in user. Additionally, you can query more information about the user. ######iOS/Android fields These fields are common to ios and android: * player_id * name * display_name making a call to `sdkbox::SdkboxPlay::getPlayerAccountField( const std::string& field )` will return a string with the field contents. If the requested field does not exist, empty string will returned in exchange. `player_id` will be returned by calling `sdkbox::SdkboxPlay::getPlayerId()` too. ######Android only fields For Android platform, there are some other available fields: * title * icon_image_uri * hires_image_uri * last_play_timestamp * retrieved_timestamp * server_auth_code use the same `getPlayerAccountField` to get these values as strings. #####Achievements Achievements are defined on the respective platform’s developer console. There are differences in concept between GooglePlay and GameCenter’s achievements: + Google Play differentiates between achievements, and incremental achievements. Google keeps track of incremental achievements progress. Achievements are achieved only once. + For Game Center, all achievements are incremental, but Game center does not keep track of its progress. Achievements are expected to be achieved during a game session. Achievements can be set to be unlocked several times. + Google Play has the notion of newly unlocked achievement (first time unlocked), and Game Center has the notion of recurrently unlockable achievement. Both concepts are complementary. To keep things consisten, SdkboxPlay API: + Allows you to define non-incremental achievements. For ios, are submitted with an incremental value of 100, which means it will be unlocked. + Allows you to define Incremental achievements. In Google play, incremental achievements have defined their unlocking value on the application console. + For consistency, it is recommended to define Google Play’s achievements with a count of 100. This is the value Game Center expects to be reached to unlock an achievement. ##### Leaderboards Leaderboards are defined on the respective platform’s developer console. To keep things simple, the current SdkboxPlay implementation does not allow to define group leaderboards from iOS. For both platforms, an arbitrary number of leaderboards can be defined. Though both, GooglePlay and GameCenter define leaderboards in the same way, in the runtime there are some differences: + Google Play creates automatically 3 time frames for each leaderboard: daily, weekly and all time best scores. + Game Center creates just one timeframe. This will be resembled on the observer methods for leaderboard operations as described below. #### Usage A call to `sdkbox::SdkboxPlay::init()` will configure the plugin with the selected leaderboards and achievements present in the sdkbox_config.json file. First, a connection to the games services must be done by calling: ```cpp sdkbox::PluginSdkboxPlay::signin(); ``` If connection is successful, you'll be able to use the SdkboxPlay services with the following API: ##### Leaderboards ```cpp void submitScore( const std::string& leaderboard_name, int score ) ``` This method submits a update request to the given leaderboard. The leaderboard name must match any of the leaderboard names defined in the configuration block. If a request is sent to a non existent leaderboard, nothing will happen. Whether to store the new score or not, can be defined in the developer’s console (store always latest score, only maximum, etc.) This method will invoke plugin’s observer method: ```cpp void onScoreSubmitted( const std::string& leaderboard_name, int score, bool maxScoreAllTime, bool maxScoreWeek, bool maxScoreToday ) ``` For iOS, this method will have the three boolean flags as false. ```cpp void showLeaderboard( const std::string& leaderboard_name ); ``` Request to show the leaderboard information. This will invoke a platform specific UI. For iOS, there’s no different UI for requesting leaderboards and achievements, so this method will invoke the UI with the leaderboards view enabled. ##### Achievements ```cpp void unlockAchievement( const std::string& achievement_name ); ``` Unlock a non incremental achievement. In the case of iOS, it will send a request to Game Center of unlock with 100 progress points. If the achievement type is incorrectly defined in the configuration file (wrong id), or the play services determines it is of the wrong type (Google play) the method will fail silently. Upon successful call, this method will invoke the listener’s method: onAchievementUnlocked( const std::string& achievement_name, bool newlyUnlocked ). ```cpp void incrementAchievement( const std::string& achievement_name, int increment ); ``` Increment an incremental achievement. The method will silently fail if the achievement type is incorrectly defined in the configuration file (wrong or non existent id), or the play services determines it is of the wrong type (Google Play). If the call is successful, this method may invoke two different methods: + `onIncrementalAchievementStep( const std::string& achievement_name, int step )` if the achievement is not unlocked. + `onIncrementalAchievementUnlocked( const std::string& achievement_name, bool newlyUnlocked )` the first time it's been unlocked. ```cpp void showAchievements( ); ``` Request to show the default Achievements view. This view only shows public achievements. t will show specific per platform information, like whether it’s been unlocked, remaining unlocking steps (Google Play only), total experience count, etc. ### SdkboxPlay events This allows you to catch `SdkboxPlay`' events. * Allow your class to extend `sdkbox::SdkboxPlayListener` and override the functions listed: ```cpp #include "PluginSdkboxPlay/PluginSdkboxPlay.h" class MyClass : public sdkbox::SdkboxPlayListener { protected: /** * Call method invoked when the Plugin connection changes its status. * Values are as follows: * + GPS_CONNECTED: successfully connected. * + GPS_DISCONNECTED: successfully disconnected. * + GPS_CONNECTION_ERROR:error with google play services connection. */ void onConnectionStatusChanged( int status ); /** * Callback method invoked when an score has been successfully submitted to a leaderboard. * It notifies back with the leaderboard_name (not id, see the sdkbox_config.json file) and the * subbmited score, as well as whether the score is the daily, weekly, or all time best score. * Since Game center can't determine if submitted score is maximum, it will send the max score flags as false. */ void onScoreSubmitted( const std::string& leaderboard_name, int score, bool maxScoreAllTime, bool maxScoreWeek, bool maxScoreToday ); /** * Callback method invoked when the request call to increment an achievement is succeessful and * that achievement gets unlocked. This happens when the incremental step count reaches its maximum value. * Maximum step count for an incremental achievement is defined in the google play developer console. */ void onIncrementalAchievementUnlocked( const std::string& achievement_name ); /** * Callback method invoked when the request call to increment an achievement is successful. * If possible (Google play only) it notifies back with the current achievement step count. */ void onIncrementalAchievementStep( const std::string& achievement_name, int step ); /** * Call method invoked when the request call to unlock a non-incremental achievement is successful. * If this is the first time the achievement is unlocked, newUnlocked will be true. */ void onAchievementUnlocked( const std::string& achievement_name, bool newlyUnlocked ); }; ``` * Create a __listener__ that handles callbacks: ```cpp sdkbox::PluginSdkboxPlay::setListener( new MyClass() ); ```
sdkbox-staging/en
src/sdkboxplay/v3-cpp/usage.md
Markdown
mit
8,884
var d3 = require('d3'); function true_index(arr, config) { // Series.ix[start, end].true().index; if (!config) { config = {}; } if (!config.length) { config.length = arr.length } config.start = config.start ? config.start : 0; config.end = config.end ? config.end : config.length; var valid = new Array(config.length); var j = 0; for (var i=config.start; i <= config.end; i++) { if (arr[i]) { valid[j] = i; j++; } } valid = valid.slice(0, j); return valid; } function where(arr, mask) { var data = arr.slice(0); for (var i=0; i < data.length; i++) { if (!mask[i]) { data[i] = null; } } return data; } module.exports.true_index = true_index; module.exports.where = where; mask = [true, true, false, false, true, false] series = d3.range(mask.length); res = true_index(mask, {}); res = true_index(mask, {'start':1}); res = where(series, mask);
dalejung/lyrical
lib/util/munging.js
JavaScript
mit
913
# Oro\Bundle\OrganizationBundle\Entity\BusinessUnit ## ACTIONS ### get Retrieve a specific business unit record. {@inheritdoc} ### get_list Retrieve a collection of business unit records. {@inheritdoc} ### create Create a new business unit record. The created record is returned in the response. {@inheritdoc} {@request:json_api} Example: `</api/businessunits>` ```JSON { "data":{ "type":"businessunits", "attributes":{ "name":"Acme, Central", "phone":"798-682-5917", "email":"central@acme.inc", "fax":"547-58-95" }, "relationships":{ "organization":{ "data":{ "type":"organizations", "id":"1" } }, "users":{ "data":[ { "type":"users", "id":"1" }, { "type":"users", "id":"2" } ] }, "owner":{ "data":{ "type":"businessunits", "id":"1" } } } } } ``` {@/request} ### update Edit a specific business unit record. {@inheritdoc} {@request:json_api} Example: `</api/businessunits/4>` ```JSON { "data":{ "type":"businessunits", "id":"4", "attributes":{ "extend_description":"Business units represent a group of users with similar business or administrative tasks/roles.", "phone":"798-682-59-17", "website":"www.www.vom" }, "relationships":{ "users":{ "data":[ { "type":"users", "id":"1" }, { "type":"users", "id":"2" } ] } } } } ``` {@/request} ### delete Delete a specific business unit record {@inheritdoc} ### delete_list Delete a collection of business unit records. The list of records that will be deleted, could be limited by filters. {@inheritdoc} ## FIELDS ### id #### update {@inheritdoc} **The required field** ### name #### create {@inheritdoc} **The required field** #### update {@inheritdoc} **Please note:** *This field is **required** and must remain defined.* ## SUBRESOURCES ### organization #### get_subresource Retrieve the records of the organization which a specific business unit record belongs to. #### get_relationship Retrieve the ID of the organization record which a specific business unit belongs to. #### update_relationship Replace the organization record a specific business unit record belongs to. {@request:json_api} Example: `</api/businessunits/1/relationships/organization>` ```JSON { "data": { "type": "organizations", "id": "1" } } ``` {@/request} ### owner #### get_subresource Retrieve the records of the business unit which is the owner of a specific business unit. #### get_relationship Retrieve the ID of the business unit record which is the owner of a specific business unit record. #### update_relationship Replace the owner of a specific business unit record. {@request:json_api} Example: `</api/businessunits/2/relationships/owner>` ```JSON { "data": { "type": "businessunits", "id": "1" } } ``` {@/request} ### users #### get_subresource Retrieve the records of users who have access to a specific business unit record. #### get_relationship Retrieve the IDs of the users who have access to a specific business unit record. #### add_relationship Set the user records that will have access to a specific business unit record. {@request:json_api} Example: `</api/businessunits/2/relationships/users>` ```JSON { "data": [ { "type": "users", "id": "1" }, { "type": "users", "id": "2" }, { "type": "users", "id": "3" } ] } ``` {@/request} #### update_relationship Replace the user records that have access to a specific business unit record. {@request:json_api} Example: `</api/businessunits/2/relationships/users>` ```JSON { "data": [ { "type": "users", "id": "1" }, { "type": "users", "id": "2" }, { "type": "users", "id": "3" } ] } ``` {@/request} #### delete_relationship Remove user records from a specific business unit record.
Djamy/platform
src/Oro/Bundle/OrganizationBundle/Resources/doc/api/business_unit.md
Markdown
mit
4,478
//------------------------------------------------------------------------------------------------------- // 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 { class BoundFunction : public JavascriptFunction { protected: DEFINE_VTABLE_CTOR(BoundFunction, JavascriptFunction); DEFINE_MARSHAL_OBJECT_TO_SCRIPT_CONTEXT(BoundFunction); private: bool GetPropertyBuiltIns(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext, BOOL* result); bool SetPropertyBuiltIns(PropertyId propertyId, Var value, PropertyOperationFlags flags, PropertyValueInfo* info, BOOL* result); protected: BoundFunction(DynamicType * type); BoundFunction(Arguments args, DynamicType * type); public: static BoundFunction* New(ScriptContext* scriptContext, ArgumentReader args); static Var NewInstance(RecyclableObject* function, CallInfo callInfo, ...); virtual JavascriptString* GetDisplayNameImpl() const override; virtual PropertyQueryFlags GetPropertyReferenceQuery(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override; _Check_return_ _Success_(return) virtual BOOL GetAccessors(PropertyId propertyId, _Outptr_result_maybenull_ Var* getter, _Outptr_result_maybenull_ Var* setter, ScriptContext* requestContext) override; virtual DescriptorFlags GetSetter(PropertyId propertyId, Var *setterValue, PropertyValueInfo* info, ScriptContext* requestContext) override; virtual DescriptorFlags GetSetter(JavascriptString* propertyNameString, Var *setterValue, PropertyValueInfo* info, ScriptContext* requestContext) override; virtual BOOL InitProperty(PropertyId propertyId, Var value, PropertyOperationFlags flags = PropertyOperation_None, PropertyValueInfo* info = NULL) override; virtual BOOL HasInstance(Var instance, ScriptContext* scriptContext, IsInstInlineCache* inlineCache = NULL) override; virtual inline BOOL IsConstructor() const override; // Below functions are used by debugger to identify and emit event handler information virtual bool IsBoundFunction() const { return true; } JavascriptFunction * GetTargetFunction() const; // Below functions are used by heap enumerator uint GetArgsCountForHeapEnum() { return count;} Field(Var)* GetArgsForHeapEnum() { return boundArgs;} RecyclableObject* GetBoundThis(); #if ENABLE_TTD public: virtual void MarkVisitKindSpecificPtrs(TTD::SnapshotExtractor* extractor) override; virtual void ProcessCorePaths() override; virtual TTD::NSSnapObjects::SnapObjectType GetSnapTag_TTD() const override; virtual void ExtractSnapObjectDataInto(TTD::NSSnapObjects::SnapObject* objData, TTD::SlabAllocator& alloc) override; static BoundFunction* InflateBoundFunction( ScriptContext* ctx, RecyclableObject* function, Var bThis, uint32 ct, Field(Var)* args); #endif private: static FunctionInfo functionInfo; Field(RecyclableObject*) targetFunction; Field(Var) boundThis; Field(uint) count; Field(Field(Var)*) boundArgs; }; template <> inline bool VarIsImpl<BoundFunction>(RecyclableObject* obj) { return VarIs<JavascriptFunction>(obj) && UnsafeVarTo<JavascriptFunction>(obj)->IsBoundFunction(); } } // namespace Js
Microsoft/ChakraCore
lib/Runtime/Library/BoundFunction.h
C
mit
3,778
<?php /** * OAuth. * * @copyright Christian Flach (Cmfcmf) * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @author Christian Flach <cmfcmf.flach@gmail.com>. * @link https://www.github.com/cmfcmf/OAuth * @link http://zikula.org * @version Generated by ModuleStudio 0.6.1 (http://modulestudio.de). */ /** * Delete operation. * @param object $entity The treated object. * @param array $params Additional arguments. * * @return bool False on failure or true if everything worked well. * * @throws RuntimeException Thrown if executing the workflow action fails */ function CmfcmfOAuthModule_operation_delete(&$entity, $params) { $dom = ZLanguage::getModuleDomain('CmfcmfOAuthModule'); // initialise the result flag $result = false; // get entity manager $serviceManager = ServiceUtil::getManager(); $entityManager = $serviceManager->getService('doctrine.entitymanager'); // delete entity try { $entityManager->remove($entity); $entityManager->flush(); $result = true; } catch (\Exception $e) { throw new \RuntimeException($e->getMessage()); } // return result of this operation return $result; }
cmfcmf/TestModule
Cmfcmf/OAuthModule/workflows/operations/function.delete.php
PHP
mit
1,236
require 'chefspec' describe 'package::unlock' do platform 'ubuntu' describe 'unlocks a package with an explicit action' do it { is_expected.to unlock_package('explicit_action') } it { is_expected.to_not unlock_package('not_explicit_action') } end describe 'unlocks a package with attributes' do it { is_expected.to unlock_package('with_attributes').with(version: '1.0.0') } it { is_expected.to_not unlock_package('with_attributes').with(version: '1.2.3') } end describe 'unlocks a package when specifying the identity attribute' do it { is_expected.to unlock_package('identity_attribute') } end describe 'unlocks all packages when given an array of names' do it { is_expected.to unlock_package(%w(with array)) } end end
chefspec/chefspec
examples/package/spec/unlock_spec.rb
Ruby
mit
767
package veneur import ( "errors" "fmt" "github.com/hashicorp/consul/api" ) // Consul is a Discoverer that uses Consul to find // healthy instances of a given name. type Consul struct { ConsulHealth *api.Health } // NewConsul creates a new instance of a Consul Discoverer func NewConsul(config *api.Config) (*Consul, error) { consulClient, err := api.NewClient(config) if err != nil { return nil, err } return &Consul{ ConsulHealth: consulClient.Health(), }, nil } // GetDestinationsForService updates the list of destinations based on healthy nodes // found via Consul. It returns destinations in the form "<host>:<port>". func (c *Consul) GetDestinationsForService(serviceName string) ([]string, error) { serviceEntries, _, err := c.ConsulHealth.Service(serviceName, "", true, &api.QueryOptions{}) if err != nil { return nil, err } numHosts := len(serviceEntries) if numHosts < 1 { return nil, errors.New("Received no hosts from Consul") } // Make a slice to hold our returned hosts hosts := make([]string, numHosts) for index, se := range serviceEntries { hosts[index] = fmt.Sprintf("%s:%d", se.Node.Address, se.Service.Port) } return hosts, nil }
gphat/veneur
consul.go
GO
mit
1,189
""" GUI progressbar decorator for iterators. Includes a default (x)range iterator printing to stderr. Usage: >>> from tqdm_gui import tgrange[, tqdm_gui] >>> for i in tgrange(10): #same as: for i in tqdm_gui(xrange(10)) ... ... """ # future division is important to divide integers and get as # a result precise floating numbers (instead of truncated int) from __future__ import division, absolute_import # import compatibility functions and utilities import sys from time import time from ._utils import _range # to inherit from the tqdm class from ._tqdm import tqdm __author__ = {"github.com/": ["casperdcl", "lrq3000"]} __all__ = ['tqdm_gui', 'tgrange'] class tqdm_gui(tqdm): # pragma: no cover """ Experimental GUI version of tqdm! """ @classmethod def write(cls, s, file=None, end="\n"): """ Print a message via tqdm_gui (just an alias for print) """ if file is None: file = sys.stdout # TODO: print text on GUI? file.write(s) file.write(end) def __init__(self, *args, **kwargs): import matplotlib as mpl import matplotlib.pyplot as plt from collections import deque kwargs['gui'] = True super(tqdm_gui, self).__init__(*args, **kwargs) # Initialize the GUI display if self.disable or not kwargs['gui']: return self.fp.write('Warning: GUI is experimental/alpha\n') self.mpl = mpl self.plt = plt self.sp = None # Remember if external environment uses toolbars self.toolbar = self.mpl.rcParams['toolbar'] self.mpl.rcParams['toolbar'] = 'None' self.mininterval = max(self.mininterval, 0.5) self.fig, ax = plt.subplots(figsize=(9, 2.2)) # self.fig.subplots_adjust(bottom=0.2) if self.total: self.xdata = [] self.ydata = [] self.zdata = [] else: self.xdata = deque([]) self.ydata = deque([]) self.zdata = deque([]) self.line1, = ax.plot(self.xdata, self.ydata, color='b') self.line2, = ax.plot(self.xdata, self.zdata, color='k') ax.set_ylim(0, 0.001) if self.total: ax.set_xlim(0, 100) ax.set_xlabel('percent') self.fig.legend((self.line1, self.line2), ('cur', 'est'), loc='center right') # progressbar self.hspan = plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g') else: # ax.set_xlim(-60, 0) ax.set_xlim(0, 60) ax.invert_xaxis() ax.set_xlabel('seconds') ax.legend(('cur', 'est'), loc='lower left') ax.grid() # ax.set_xlabel('seconds') ax.set_ylabel((self.unit if self.unit else 'it') + '/s') if self.unit_scale: plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) ax.yaxis.get_offset_text().set_x(-0.15) # Remember if external environment is interactive self.wasion = plt.isinteractive() plt.ion() self.ax = ax def __iter__(self): # TODO: somehow allow the following: # if not self.gui: # return super(tqdm_gui, self).__iter__() iterable = self.iterable if self.disable: for obj in iterable: yield obj return # ncols = self.ncols mininterval = self.mininterval maxinterval = self.maxinterval miniters = self.miniters dynamic_miniters = self.dynamic_miniters unit = self.unit unit_scale = self.unit_scale ascii = self.ascii start_t = self.start_t last_print_t = self.last_print_t last_print_n = self.last_print_n n = self.n # dynamic_ncols = self.dynamic_ncols smoothing = self.smoothing avg_time = self.avg_time bar_format = self.bar_format plt = self.plt ax = self.ax xdata = self.xdata ydata = self.ydata zdata = self.zdata line1 = self.line1 line2 = self.line2 for obj in iterable: yield obj # Update and print the progressbar. # Note: does not call self.update(1) for speed optimisation. n += 1 delta_it = n - last_print_n # check the counter first (avoid calls to time()) if delta_it >= miniters: cur_t = time() delta_t = cur_t - last_print_t if delta_t >= mininterval: elapsed = cur_t - start_t # EMA (not just overall average) if smoothing and delta_t: avg_time = delta_t / delta_it \ if avg_time is None \ else smoothing * delta_t / delta_it + \ (1 - smoothing) * avg_time # Inline due to multiple calls total = self.total # instantaneous rate y = delta_it / delta_t # overall rate z = n / elapsed # update line data xdata.append(n * 100.0 / total if total else cur_t) ydata.append(y) zdata.append(z) # Discard old values # xmin, xmax = ax.get_xlim() # if (not total) and elapsed > xmin * 1.1: if (not total) and elapsed > 66: xdata.popleft() ydata.popleft() zdata.popleft() ymin, ymax = ax.get_ylim() if y > ymax or z > ymax: ymax = 1.1 * y ax.set_ylim(ymin, ymax) ax.figure.canvas.draw() if total: line1.set_data(xdata, ydata) line2.set_data(xdata, zdata) try: poly_lims = self.hspan.get_xy() except AttributeError: self.hspan = plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g') poly_lims = self.hspan.get_xy() poly_lims[0, 1] = ymin poly_lims[1, 1] = ymax poly_lims[2] = [n / total, ymax] poly_lims[3] = [poly_lims[2, 0], ymin] if len(poly_lims) > 4: poly_lims[4, 1] = ymin self.hspan.set_xy(poly_lims) else: t_ago = [cur_t - i for i in xdata] line1.set_data(t_ago, ydata) line2.set_data(t_ago, zdata) ax.set_title(self.format_meter( n, total, elapsed, 0, self.desc, ascii, unit, unit_scale, 1 / avg_time if avg_time else None, bar_format), fontname="DejaVu Sans Mono", fontsize=11) plt.pause(1e-9) # If no `miniters` was specified, adjust automatically # to the maximum iteration rate seen so far. if dynamic_miniters: if maxinterval and delta_t > maxinterval: # Set miniters to correspond to maxinterval miniters = delta_it * maxinterval / delta_t elif mininterval and delta_t: # EMA-weight miniters to converge # towards the timeframe of mininterval miniters = smoothing * delta_it * mininterval \ / delta_t + (1 - smoothing) * miniters else: miniters = smoothing * delta_it + \ (1 - smoothing) * miniters # Store old values for next call last_print_n = n last_print_t = cur_t # Closing the progress bar. # Update some internal variables for close(). self.last_print_n = last_print_n self.n = n self.close() def update(self, n=1): # if not self.gui: # return super(tqdm_gui, self).close() if self.disable: return if n < 0: n = 1 self.n += n delta_it = self.n - self.last_print_n # should be n? if delta_it >= self.miniters: # We check the counter first, to reduce the overhead of time() cur_t = time() delta_t = cur_t - self.last_print_t if delta_t >= self.mininterval: elapsed = cur_t - self.start_t # EMA (not just overall average) if self.smoothing and delta_t: self.avg_time = delta_t / delta_it \ if self.avg_time is None \ else self.smoothing * delta_t / delta_it + \ (1 - self.smoothing) * self.avg_time # Inline due to multiple calls total = self.total ax = self.ax # instantaneous rate y = delta_it / delta_t # smoothed rate z = self.n / elapsed # update line data self.xdata.append(self.n * 100.0 / total if total else cur_t) self.ydata.append(y) self.zdata.append(z) # Discard old values if (not total) and elapsed > 66: self.xdata.popleft() self.ydata.popleft() self.zdata.popleft() ymin, ymax = ax.get_ylim() if y > ymax or z > ymax: ymax = 1.1 * y ax.set_ylim(ymin, ymax) ax.figure.canvas.draw() if total: self.line1.set_data(self.xdata, self.ydata) self.line2.set_data(self.xdata, self.zdata) try: poly_lims = self.hspan.get_xy() except AttributeError: self.hspan = self.plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g') poly_lims = self.hspan.get_xy() poly_lims[0, 1] = ymin poly_lims[1, 1] = ymax poly_lims[2] = [self.n / total, ymax] poly_lims[3] = [poly_lims[2, 0], ymin] if len(poly_lims) > 4: poly_lims[4, 1] = ymin self.hspan.set_xy(poly_lims) else: t_ago = [cur_t - i for i in self.xdata] self.line1.set_data(t_ago, self.ydata) self.line2.set_data(t_ago, self.zdata) ax.set_title(self.format_meter( self.n, total, elapsed, 0, self.desc, self.ascii, self.unit, self.unit_scale, 1 / self.avg_time if self.avg_time else None, self.bar_format), fontname="DejaVu Sans Mono", fontsize=11) self.plt.pause(1e-9) # If no `miniters` was specified, adjust automatically to the # maximum iteration rate seen so far. # e.g.: After running `tqdm.update(5)`, subsequent # calls to `tqdm.update()` will only cause an update after # at least 5 more iterations. if self.dynamic_miniters: if self.maxinterval and delta_t > self.maxinterval: self.miniters = self.miniters * self.maxinterval \ / delta_t elif self.mininterval and delta_t: self.miniters = self.smoothing * delta_it \ * self.mininterval / delta_t + \ (1 - self.smoothing) * self.miniters else: self.miniters = self.smoothing * delta_it + \ (1 - self.smoothing) * self.miniters # Store old values for next call self.last_print_n = self.n self.last_print_t = cur_t def close(self): # if not self.gui: # return super(tqdm_gui, self).close() if self.disable: return self.disable = True self._instances.remove(self) # Restore toolbars self.mpl.rcParams['toolbar'] = self.toolbar # Return to non-interactive mode if not self.wasion: self.plt.ioff() if not self.leave: self.plt.close(self.fig) def tgrange(*args, **kwargs): """ A shortcut for tqdm_gui(xrange(*args), **kwargs). On Python3+ range is used instead of xrange. """ return tqdm_gui(_range(*args), **kwargs)
dhaase-de/dh-python-dh
dh/thirdparty/tqdm/_tqdm_gui.py
Python
mit
13,510
<?php $res = \AlternativePayments\Request :: get("Payment", "pay_12345aa"); var_dump($res);
AlternativePayments/ap-php-sdk
samples/payment/get.php
PHP
mit
94
--- title: أُمَّة كَبِيرَة وَقَوِيَّة.... date: 28/04/2021 --- لم يقتصر وعد الله لإبراهيم على أنَّ فيه تتبارك جميع قبائل الأرض، إذ أنه وعد أَيْضًا أن يجعل مِنه «أُمَّةً كَبِيرَةً وَقَوِيَّةً» (تكوين ١٨: ١٨؛ انظر تكوين ١٢: ٢؛ تكوين ٤٦: ٣). ويا له مِن وعد لرجل متزوج من امرأة تجاوزت سن الإنجاب. وهكذا، إذ كان إبراهيم بدون نسل وبدون أطفال، وعده الله بالاثنين. ولكن هذا الوعد لم يتم بصورة كاملة أثناء حياة إبراهيم. كما أن إسحاق ويعقوب لم يرياه يتحقق. لقد كَرَّر اللهُ الوعد ليعقوب مضيفًا إليه بعض المعلومات التي توضّح بأنَّ الوعد سيتم في مصر (تكوين ٤٦: ٣)، مع أن يعقوب لم يرَ تحقيقه. ولكن هذا الوعد تمّ أخيرًا. `لماذا أراد الله أن يخرج أُمَّة خاصة مِن نسل إبراهيم؟ هل أراد الله مجرد دولة أخرى مِن أصل عِرقي محدد؟ ما هي الأهداف التي كان على تلك الأمة أن تحققها؟ اقرأ خروج ١٩: ٥، ٦؛ إشعياء ٦٠: ١-٣؛ تثنية ٤: ٦-٨ واكتب جوابك على الأسطر التالية.` يبدو واضحًا من الكِتَاب المُقَدَّس أن الله أراد أن يجذب أمم العالم إلى نفسه من خلال شهادة شعبه إسرائيل الذين كانوا بفضل بَركته يصيرون سعداء وأصحاء ومقدّسين. مثل هذه الأمة كانت ستعلن بمثالها عن البرَكة التي تُصاحب إطاعة إرادة الخالق فتجذب أمم الأرض إلى عبادة الإله الحقيقي (إشعياء ٥٦: ٧). وهكذا ينجذب انتباه البشرية صوب الله وشعبه والمَسيَّا الذي كان سيظهر بينهم بوصفه فادي العالم. «كان على بني إسرائيل أن يحتلوا كُلّ الإقليم الذي عيّنه الله لهم. والأمم التي رفضت أن تعبد الإله الحقيقي وتخدمه كانت ستُطرد من الأرض. ولكن قصد الله كان أنه بواسطة إعلان صفاته عن طريق إسرائيل يُجتذب الناس إليه. وكان يجب أن تُقدّم دعوة الإنجيل لكل العالَم. وبواسطة تعليم الخدمة الكفارية كان المسيح سيُرفع أمام الأمم وكل مَن ينظرون إليه يَحيَون» (روح النبوة، المعلم الأعظم، صفحة ١٨٩). `هل ترى أي تشابه بين ما أراد الله أن يحققه من خلال إسرائيل وما يريد أن يحققه من خلال كنيستنا؟ إذا كان كذلك، فما هو هذا التَّشابُه؟ اقرأ ١بطرس ٢: ٩.`
imasaru/sabbath-school-lessons
src/ar/2021-02/05/05.md
Markdown
mit
3,118
/* Copyright (c) 2009-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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. */ // written by Roman Dementiev // Austen Ott #include <iostream> #include <assert.h> #include <unistd.h> #include "msr.h" #define NUM_CORES 16 int main() { uint32 i = 0; uint32 res; MsrHandle * cpu_msr[NUM_CORES]; for (i = 0; i < NUM_CORES; ++i) { cpu_msr[i] = new MsrHandle(i); assert(cpu_msr >= 0); FixedEventControlRegister ctrl_reg; res = cpu_msr[i]->read(IA32_CR_FIXED_CTR_CTRL, &ctrl_reg.value); assert(res >= 0); ctrl_reg.fields.os0 = 1; ctrl_reg.fields.usr0 = 1; ctrl_reg.fields.any_thread0 = 0; ctrl_reg.fields.enable_pmi0 = 0; ctrl_reg.fields.os1 = 1; ctrl_reg.fields.usr1 = 1; ctrl_reg.fields.any_thread1 = 0; ctrl_reg.fields.enable_pmi1 = 0; ctrl_reg.fields.os2 = 1; ctrl_reg.fields.usr2 = 1; ctrl_reg.fields.any_thread2 = 0; ctrl_reg.fields.enable_pmi2 = 0; res = cpu_msr[i]->write(IA32_CR_FIXED_CTR_CTRL, ctrl_reg.value); assert(res >= 0); // start counting uint64 value = (1ULL << 0) + (1ULL << 1) + (1ULL << 2) + (1ULL << 3) + (1ULL << 32) + (1ULL << 33) + (1ULL << 34); res = cpu_msr[i]->write(IA32_CR_PERF_GLOBAL_CTRL, value); assert(res >= 0); } uint64 counters_before[NUM_CORES][3]; uint64 counters_after[NUM_CORES][3]; for (i = 0; i < NUM_CORES; ++i) { res = cpu_msr[i]->read(INST_RETIRED_ANY_ADDR, &counters_before[i][0]); assert(res >= 0); res = cpu_msr[i]->read(CPU_CLK_UNHALTED_THREAD_ADDR, &counters_before[i][1]); assert(res >= 0); res = cpu_msr[i]->read(CPU_CLK_UNHALTED_REF_ADDR, &counters_before[i][2]); assert(res >= 0); } //sleep for some time ::sleep(1); for (i = 0; i < NUM_CORES; ++i) { res = cpu_msr[i]->read(INST_RETIRED_ANY_ADDR, &counters_after[i][0]); assert(res >= 0); res = cpu_msr[i]->read(CPU_CLK_UNHALTED_THREAD_ADDR, &counters_after[i][1]); assert(res >= 0); res = cpu_msr[i]->read(CPU_CLK_UNHALTED_REF_ADDR, &counters_after[i][2]); assert(res >= 0); } for (i = 0; i < NUM_CORES; ++i) delete cpu_msr[i]; for (i = 0; i < NUM_CORES; ++i) std::cout << "Core " << i << "\t Instructions: " << (counters_after[i][0] - counters_before[i][0]) << "\t Cycles: " << (counters_after[i][1] - counters_before[i][1]) << "\t IPC: " << double(counters_after[i][0] - counters_before[i][0]) / double(counters_after[i][1] - counters_before[i][1]) << std::endl; }
xabarass/fast-fractal-compression
lib/pcm/pcm/msrtest.cpp
C++
mit
4,117
if (process.title !== 'browser') { switch (process.env.KADOH_TRANSPORT) { default: case 'xmpp': //@browserify-ignore module.exports = require('./node-xmpp'); break; case 'udp': //@browserify-ignore module.exports = require('./udp') ; break; } } else { switch (process.env.KADOH_TRANSPORT) { default: case 'xmpp': module.exports = require('./strophe'); break; case 'simudp': module.exports = require('./simudp'); break; } }
jinroh/kadoh
lib/network/transport/index.js
JavaScript
mit
487
EQUALS = 'equals' GT = 'gt' LT = 'lt' IN = 'in' OPERATOR_SEPARATOR = '__' REVERSE_ORDER = '-' ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1, IN: 1} def split_to_field_and_filter_type(filter_name): filter_split = filter_name.split(OPERATOR_SEPARATOR) filter_type = filter_split[-1] if len(filter_split) > 0 else None if filter_type in ALL_OPERATORS: return OPERATOR_SEPARATOR.join(filter_split[:-1]), filter_type else: return filter_name, None def split_to_field_and_order_type(field_name_with_operator): if field_name_with_operator.startswith(REVERSE_ORDER): return field_name_with_operator[1:], REVERSE_ORDER else: return field_name_with_operator, None def transform_to_list(val): if isinstance(val, (list, tuple)): return val else: return [val]
Aplopio/rip
rip/filter_operators.py
Python
mit
831
# == Schema Information # # Table name: snippets # # id :integer not null, primary key # title :string(255) # content :text # author_id :integer not null # project_id :integer not null # created_at :datetime not null # updated_at :datetime not null # file_name :string(255) # expires_at :datetime # type :string(255) # private :boolean class ProjectSnippet < Snippet belongs_to :project belongs_to :author, class_name: "User" validates :project, presence: true # Scopes scope :fresh, -> { order("created_at DESC") } scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } end
betabot7/gitlabhq
app/models/project_snippet.rb
Ruby
mit
797
namespace SimpleInjector.Integration.AspNet { using System; using System.Diagnostics; using Microsoft.AspNet.Mvc.ViewComponents; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; /// <summary> /// View component invoker factory for Simple Injector. /// </summary> public sealed class SimpleInjectorViewComponentInvokerFactory : IViewComponentInvokerFactory { private readonly Container container; private IViewComponentInvoker invoker; /// <summary> /// Initializes a new instance of the <see cref="SimpleInjectorViewComponentInvokerFactory"/> class. /// </summary> /// <param name="container">The container instance.</param> public SimpleInjectorViewComponentInvokerFactory(Container container) { Requires.IsNotNull(container, nameof(container)); this.container = container; } /// <summary>Creates a <see cref="IViewComponentInvoker"/>.</summary> /// <param name="context">The context</param> /// <returns>A <see cref="IViewComponentInvoker"/>.</returns> public IViewComponentInvoker CreateInstance(ViewComponentContext context) { Requires.IsNotNull(context, nameof(context)); if (this.invoker == null) { this.invoker = this.CreateViewComponentInvoker(context); } return this.invoker; } private SimpleInjectorViewComponentInvoker CreateViewComponentInvoker(ViewComponentContext context) { IServiceProvider provider = context.ViewContext.HttpContext.RequestServices; return new SimpleInjectorViewComponentInvoker( provider.GetRequiredService<DiagnosticSource>(), provider.GetRequiredService<ILoggerFactory>().CreateLogger<SimpleInjectorViewComponentInvoker>(), provider.GetRequiredService<IViewComponentActivator>(), this.container); } } }
jamesqo/SimpleInjector
AspNetIntegration/SimpleInjector.Integration.AspNet/SimpleInjectorViewComponentInvokerFactory.cs
C#
mit
2,061
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var MdForum = function MdForum(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm28.4 20q0 0.7-0.5 1.2t-1.3 0.4h-16.6l-6.6 6.8v-23.4q0-0.7 0.4-1.2t1.2-0.4h21.6q0.7 0 1.3 0.4t0.5 1.2v15z m6.6-10q0.7 0 1.2 0.5t0.4 1.1v25l-6.6-6.6h-18.4q-0.7 0-1.1-0.5t-0.5-1.1v-3.4h21.6v-15h3.4z' }) ) ); }; exports.default = MdForum; module.exports = exports['default'];
bengimbel/Solstice-React-Contacts-Project
node_modules/react-icons/lib/md/forum.js
JavaScript
mit
1,212
var cooking = require('cooking'); var path = require('path'); cooking.set({ entry: { index: path.join(__dirname, 'index.js') }, dist: path.join(__dirname, 'lib'), template: false, format: 'umd', moduleName: 'MintIndicator', extractCSS: 'style.css', extends: ['vue', 'saladcss'] }); cooking.add('resolve.alias', { 'main': path.join(__dirname, '../../src'), 'mint-ui': path.join(__dirname, '..') }); cooking.add('externals', { vue: { root: 'Vue', commonjs: 'vue', commonjs2: 'vue', amd: 'vue' } }); module.exports = cooking.resolve();
dajbd/misc-for-node.js
src/vue.js-demo-2/src/components/mint-ui/packages/indicator/cooking.conf.js
JavaScript
mit
582
package life.http; import life.LifeException; import life.Order; import life.db.DbIterator; import life.util.Convert; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONStreamAware; import javax.servlet.http.HttpServletRequest; public final class GetAskOrderIds extends APIServlet.APIRequestHandler { static final GetAskOrderIds instance = new GetAskOrderIds(); private GetAskOrderIds() { super(new APITag[] {APITag.AE}, "asset", "firstIndex", "lastIndex"); } @Override JSONStreamAware processRequest(HttpServletRequest req) throws LifeException { long assetId = ParameterParser.getAsset(req).getId(); int firstIndex = ParameterParser.getFirstIndex(req); int lastIndex = ParameterParser.getLastIndex(req); JSONArray orderIds = new JSONArray(); try (DbIterator<Order.Ask> askOrders = Order.Ask.getSortedOrders(assetId, firstIndex, lastIndex)) { while (askOrders.hasNext()) { orderIds.add(Convert.toUnsignedLong(askOrders.next().getId())); } } JSONObject response = new JSONObject(); response.put("askOrderIds", orderIds); return response; } }
YawLife/LIFE
src/java/life/http/GetAskOrderIds.java
Java
mit
1,242
#ifndef REPEATED_INCLUDE_H #define REPEATED_INCLUDE_H #include "repeated_include.h" int ret_val() //@ requires true; //@ ensures true; { return CONST; } #endif
willempx/verifast
examples/preprocessor/repeated_include2.h
C
mit
163
package collections.list.traverse; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.ArrayList; import java.util.LinkedList; import java.util.Random; import java.util.concurrent.TimeUnit; /** * @author ANosov * Date: 16.10.14 11:58 */ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5) @Measurement(iterations = 5) @Fork(3) @State(Scope.Benchmark) @Threads(1) public class BooleanArrayVsLinkedBenchmark { private static int ITERATION_SIZE = 1_000_000; private ArrayList<Boolean> arrayList; private LinkedList<Boolean> linkedList; private static Random rnd = new Random(); @Setup(Level.Trial) public void setup() { arrayList = new ArrayList<>(ITERATION_SIZE); for (int i = 0; i < ITERATION_SIZE; i++) { arrayList.add(rnd.nextBoolean()); } linkedList = new LinkedList<>(); for (int i = 0; i < ITERATION_SIZE; i++) { linkedList.add(rnd.nextBoolean()); } } @Benchmark @OutputTimeUnit(TimeUnit.MILLISECONDS) public void arrayList(Blackhole bh) { for (Boolean s : arrayList) { bh.consume(s); } } @Benchmark @OutputTimeUnit(TimeUnit.MILLISECONDS) public void linkedList(Blackhole bh) { for (Boolean s : linkedList) { bh.consume(s); } } public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(".*" + BooleanArrayVsLinkedBenchmark.class.getSimpleName() + ".*") .forks(1) .build(); new Runner(opt).run(); } }
fenderstr/my-bench
src/perf/java/collections/list/traverse/BooleanArrayVsLinkedBenchmark.java
Java
mit
1,907
__all__ = ['checker', 'transformer', 'codegen', 'common', 'numsed','numsed_lib','opcoder', 'sedcode', 'snippet_test']
GillesArcas/numsed
numsed/__init__.py
Python
mit
118
--- layout: post title: "Crown of Madness" date: 2015-01-07 tags: [bard, sorcerer, warlock, wizard, level2, enchantment] --- **2nd-Level enchantment** **Casting Time**: 1 action **Range**: 120 feet **Components**: V, S **Duration**: Concentration, up to 1 minute One humanoid of your choice that you can see within range must succeed on a Wisdom saving throw or become charmed by you for the duration. While the target is charmed in this way, a twisted crown of jagged iron appears on its head, and a madness glows in its eyes. The charmed target must use its action before moving on each of its turns to make a melee attack against a creature other than itself that you mentally choose.
Estevo-Aleixo/grimoire
_posts/2015-01-07-crown-of-madness.markdown
Markdown
mit
697
using System.ComponentModel.DataAnnotations; using Abp.AspNetCore.Mvc.Extensions; using Abp.Collections.Extensions; using Abp.Runtime.Validation.Interception; using Microsoft.AspNetCore.Mvc.Filters; namespace Abp.AspNetCore.Mvc.Validation { public class MvcActionInvocationValidator : MethodInvocationValidator { protected ActionExecutingContext ActionContext { get; private set; } private bool _isValidatedBefore; public void Initialize(ActionExecutingContext actionContext) { base.Initialize( actionContext.ActionDescriptor.GetMethodInfo(), GetParameterValues(actionContext) ); ActionContext = actionContext; } protected override void SetDataAnnotationAttributeErrors(object validatingObject) { if (_isValidatedBefore || ActionContext.ModelState.IsValid) { return; } foreach (var state in ActionContext.ModelState) { foreach (var error in state.Value.Errors) { ValidationErrors.Add(new ValidationResult(error.ErrorMessage, new[] { state.Key })); } } _isValidatedBefore = true; } protected virtual object[] GetParameterValues(ActionExecutingContext actionContext) { var methodInfo = actionContext.ActionDescriptor.GetMethodInfo(); var parameters = methodInfo.GetParameters(); var parameterValues = new object[parameters.Length]; for (var i = 0; i < parameters.Length; i++) { parameterValues[i] = actionContext.ActionArguments.GetOrDefault(parameters[i].Name); } return parameterValues; } } }
690486439/aspnetboilerplate
src/Abp.AspNetCore/AspNetCore/Mvc/Validation/MvcActionInvocationValidator.cs
C#
mit
1,850
import { connect } from 'react-redux' import { helloWorld } from '../actions' import Hello from './../components/Hello' const mapStateToProps = (state) => { return { message: state.hello.message } } const mapDispatchToProps = (dispatch) => { return { onClick: () => { dispatch(helloWorld()) } } } const HelloWorld = connect( mapStateToProps, mapDispatchToProps )(Hello) export default HelloWorld
koriym/Koriym.ReduxReactSsr
tests/fake/redux-app/common/containers/HelloWorld.js
JavaScript
mit
430
/* */ define( [ "../core" ], function( jQuery ) { "use strict"; // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml; if ( !data || typeof data !== "string" ) { return null; } // Support: IE 9 - 11 only // IE throws on parseFromString with invalid input. try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); } catch ( e ) { xml = undefined; } if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; return jQuery.parseXML; } );
elingan/riotjs-app-starter
src/jspm_packages/npm/jquery@3.1.1/src/ajax/parseXML.js
JavaScript
mit
566
using System.Diagnostics.CodeAnalysis; namespace EncompassRest.Company.Users.Rights { /// <summary> /// GeneralRights /// </summary> public sealed class GeneralRights : ParentAccessRights { private AccessCorrespondentRights? _accessCorrespondent; private AccessToManageAccountPageRights? _accessToManageAccountPage; private DirtyValue<bool?>? _accessToScenarios; private AccessWholesaleRights? _accessWholesale; /// <summary> /// GeneralRights AccessCorrespondent /// </summary> [AllowNull] public AccessCorrespondentRights AccessCorrespondent { get => GetField(ref _accessCorrespondent); set => SetField(ref _accessCorrespondent, value); } /// <summary> /// GeneralRights AccessToManageAccountPage /// </summary> [AllowNull] public AccessToManageAccountPageRights AccessToManageAccountPage { get => GetField(ref _accessToManageAccountPage); set => SetField(ref _accessToManageAccountPage, value); } /// <summary> /// GeneralRights AccessToScenarios /// </summary> public bool? AccessToScenarios { get => _accessToScenarios; set => SetField(ref _accessToScenarios, value); } /// <summary> /// GeneralRights AccessWholesale /// </summary> [AllowNull] public AccessWholesaleRights AccessWholesale { get => GetField(ref _accessWholesale); set => SetField(ref _accessWholesale, value); } } }
hfcjweinstock/EncompassREST
src/EncompassRest/Company/Users/Rights/GeneralRights.cs
C#
mit
1,500
TOR SUPPORT IN BITCOIN ====================== It is possible to run Bitcoin as a Tor hidden service, and connect to such services. The following directions assume you have a Tor proxy running on port 9050. Many distributions default to having a SOCKS proxy listening on port 9050, but others may not. In particular, the Tor Browser Bundle defaults to listening on a random port. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort) for how to properly configure Tor. 1. Run bitcoin behind a Tor proxy --------------------------------- The first step is running Bitcoin behind a Tor proxy. This will already make all outgoing connections be anonymized, but more is possible. -proxy=ip:port Set the proxy server. If SOCKS5 is selected (default), this proxy server will be used to try to reach .onion addresses as well. -onion=ip:port Set the proxy server to use for tor hidden services. You do not need to set this if it's the same as -proxy. You can use -noonion to explicitly disable access to hidden service. -listen When using -proxy, listening is disabled by default. If you want to run a hidden service (see next section), you'll need to enable it explicitly. -connect=X When behind a Tor proxy, you can specify .onion addresses instead -addnode=X of IP addresses or hostnames in these parameters. It requires -seednode=X SOCKS5. In Tor mode, such addresses can also be exchanged with other P2P nodes. In a typical situation, this suffices to run behind a Tor proxy: ./bitcoin -proxy=127.0.0.1:9050 2. Run a bitcoin hidden server ------------------------------ If you configure your Tor system accordingly, it is possible to make your node also reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent config file): HiddenServiceDir /var/lib/tor/bitcoin-service/ HiddenServicePort 8333 127.0.0.1:8333 HiddenServicePort 18333 127.0.0.1:18333 The directory can be different of course, but (both) port numbers should be equal to your bitcoind's P2P listen port (8333 by default). -externalip=X You can tell bitcoin about its publicly reachable address using this option, and this can be a .onion address. Given the above configuration, you can find your onion address in /var/lib/tor/bitcoin-service/hostname. Onion addresses are given preference for your node to advertize itself with, for connections coming from unroutable addresses (such as 127.0.0.1, where the Tor proxy typically runs). -listen You'll need to enable listening for incoming connections, as this is off by default behind a proxy. -discover When -externalip is specified, no attempt is made to discover local IPv4 or IPv6 addresses. If you want to run a dual stack, reachable from both Tor and IPv4 (or IPv6), you'll need to either pass your other addresses using -externalip, or explicitly enable -discover. Note that both addresses of a dual-stack system may be easily linkable using traffic analysis. In a typical situation, where you're only reachable via Tor, this should suffice: ./bitcoind -proxy=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -listen (obviously, replace the Onion address with your own). It should be noted that you still listen on all devices and another node could establish a clearnet connection, when knowing your address. To mitigate this, additionally bind the address of your Tor proxy: ./bitcoind ... -bind=127.0.0.1 If you don't care too much about hiding your node, and want to be reachable on IPv4 as well, use `discover` instead: ./bitcoind ... -discover and open port 8333 on your firewall (or use -upnp). If you only want to use Tor to reach onion addresses, but not use it as a proxy for normal IPv4/IPv6 communication, use: ./bitcoin -onion=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -discover
wastholm/bitcoin
doc/tor.md
Markdown
mit
4,174
/* Ajude! https://www.urionlinejudge.com.br/judge/pt/problems/view/1367 */ #include <iostream> #include <cstdlib> #include <string> #include <vector> using namespace std; #define PENALIDADE 20 int main(void) { ios::sync_with_stdio(false); int N; while (cin >> N >> ws, N != 0) { int acertos = 0; int total = 0; vector<int> totalPenalidadePorProblema('Z' - 'A' + 1, 0); for (int i = 0; i < N; i++) { char problema; int tempo; string status; cin >> problema >> tempo >> status >> ws; if (status == "correct") { acertos += 1; total += tempo + totalPenalidadePorProblema[problema - 'A']; totalPenalidadePorProblema[problema - 'A'] = 0; } else totalPenalidadePorProblema[problema - 'A'] += PENALIDADE; } cout << acertos << " " << total << '\n'; } return EXIT_SUCCESS; }
olegon/online-judges
uri-online-judge/1367/main.cpp
C++
mit
977
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Thomas Scholtes. # # 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. from __future__ import (division, absolute_import, print_function, unicode_literals) from beets.plugins import BeetsPlugin from beets.dbcore import types from beets.util.confit import ConfigValueError from beets import library class TypesPlugin(BeetsPlugin): @property def item_types(self): return self._types() @property def album_types(self): return self._types() def _types(self): if not self.config.exists(): return {} mytypes = {} for key, value in self.config.items(): if value.get() == 'int': mytypes[key] = types.INTEGER elif value.get() == 'float': mytypes[key] = types.FLOAT elif value.get() == 'bool': mytypes[key] = types.BOOLEAN elif value.get() == 'date': mytypes[key] = library.DateType() else: raise ConfigValueError( u"unknown type '{0}' for the '{1}' field" .format(value, key)) return mytypes
kareemallen/beets
beetsplug/types.py
Python
mit
1,775
using UnityEngine; using System.Collections; using System.Collections.Generic; using System; namespace Lockstep.Data { public delegate int DataItemSorter(DataItem item); public class SortInfo { public SortInfo(string name, DataItemSorter sorter) { this._sortName = name; this._degreeGetter = sorter; } public string _sortName; public DataItemSorter _degreeGetter; public string sortName {get {return _sortName;}} public DataItemSorter degreeGetter {get {return _degreeGetter;}} } }
erebuswolf/LockstepFramework
Database/Scripts/Core/SortInfo.cs
C#
mit
606
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from gaegraph.business_base import NodeSearch, DeleteNode from classificacaodtm_app.commands import ListClassificacaodtmCommand, SaveClassificacaodtmCommand, UpdateClassificacaodtmCommand, \ ClassificacaodtmPublicForm, ClassificacaodtmDetailForm, ClassificacaodtmShortForm def save_classificacaodtm_cmd(**classificacaodtm_properties): """ Command to save Classificacaodtm entity :param classificacaodtm_properties: a dict of properties to save on model :return: a Command that save Classificacaodtm, validating and localizing properties received as strings """ return SaveClassificacaodtmCommand(**classificacaodtm_properties) def update_classificacaodtm_cmd(classificacaodtm_id, **classificacaodtm_properties): """ Command to update Classificacaodtm entity with id equals 'classificacaodtm_id' :param classificacaodtm_properties: a dict of properties to update model :return: a Command that update Classificacaodtm, validating and localizing properties received as strings """ return UpdateClassificacaodtmCommand(classificacaodtm_id, **classificacaodtm_properties) def list_classificacaodtms_cmd(): """ Command to list Classificacaodtm entities ordered by their creation dates :return: a Command proceed the db operations when executed """ return ListClassificacaodtmCommand() def classificacaodtm_detail_form(**kwargs): """ Function to get Classificacaodtm's detail form. :param kwargs: form properties :return: Form """ return ClassificacaodtmDetailForm(**kwargs) def classificacaodtm_short_form(**kwargs): """ Function to get Classificacaodtm's short form. just a subset of classificacaodtm's properties :param kwargs: form properties :return: Form """ return ClassificacaodtmShortForm(**kwargs) def classificacaodtm_public_form(**kwargs): """ Function to get Classificacaodtm'spublic form. just a subset of classificacaodtm's properties :param kwargs: form properties :return: Form """ return ClassificacaodtmPublicForm(**kwargs) def get_classificacaodtm_cmd(classificacaodtm_id): """ Find classificacaodtm by her id :param classificacaodtm_id: the classificacaodtm id :return: Command """ return NodeSearch(classificacaodtm_id) def delete_classificacaodtm_cmd(classificacaodtm_id): """ Construct a command to delete a Classificacaodtm :param classificacaodtm_id: classificacaodtm's id :return: Command """ return DeleteNode(classificacaodtm_id)
andersonsilvade/5semscript
Projeto/backend/apps/classificacaodtm_app/facade.py
Python
mit
2,641
// // Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. // See LICENSE file in the project root for full license information. // #ifndef MCUCONF_H #define MCUCONF_H /* * STM32F7xx drivers configuration. * The following settings override the default settings present in * the various device driver implementation headers. * Note that the settings for each driver only have effect if the whole * driver is enabled in halconf.h. * * IRQ priorities: * 15...0 Lowest...Highest. * * DMA priorities: * 0...3 Lowest...Highest. */ #define STM32F7xx_MCUCONF #define STM32F769_MCUCONF /* * HAL driver system settings. */ #define STM32_NO_INIT FALSE #define STM32_PVD_ENABLE FALSE #define STM32_PLS STM32_PLS_LEV0 #define STM32_BKPRAM_ENABLE TRUE #define STM32_HSI_ENABLED TRUE #define STM32_LSI_ENABLED TRUE #define STM32_HSE_ENABLED TRUE #define STM32_LSE_ENABLED TRUE #define STM32_CLOCK48_REQUIRED TRUE #define STM32_SW STM32_SW_PLL #define STM32_PLLSRC STM32_PLLSRC_HSE #define STM32_PLLM_VALUE 6 #define STM32_PLLN_VALUE 216 #define STM32_PLLP_VALUE 2 #define STM32_PLLQ_VALUE 9 #define STM32_PLLR_VALUE 2 // NOT IN LATEST VERSION, KEEPING JUST INCASE #define STM32_HPRE STM32_HPRE_DIV1 #define STM32_PPRE1 STM32_PPRE1_DIV4 #define STM32_PPRE2 STM32_PPRE2_DIV2 #define STM32_RTCSEL STM32_RTCSEL_LSE #define STM32_RTCPRE_VALUE 25 #define STM32_MCO1SEL STM32_MCO1SEL_HSI #define STM32_MCO1PRE STM32_MCO1PRE_DIV1 #define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK #define STM32_MCO2PRE STM32_MCO2PRE_DIV1 #define STM32_TIMPRE_ENABLE FALSE #define STM32_I2SSRC STM32_I2SSRC_OFF #define STM32_PLLI2SN_VALUE 192 #define STM32_PLLI2SP_VALUE 2 #define STM32_PLLI2SQ_VALUE 2 #define STM32_PLLI2SR_VALUE 2 #define STM32_PLLI2SDIVQ_VALUE 1 #define STM32_PLLSAIN_VALUE 192 #define STM32_PLLSAIP_VALUE 2 #define STM32_PLLSAIQ_VALUE 2 #define STM32_PLLSAIR_VALUE 2 #define STM32_PLLSAIDIVQ_VALUE 1 #define STM32_PLLSAIDIVR_VALUE 2 #define STM32_SAI1SEL STM32_SAI1SEL_OFF #define STM32_SAI2SEL STM32_SAI2SEL_OFF #define STM32_LCDTFT_REQUIRED FALSE #define STM32_USART1SEL STM32_USART1SEL_PCLK2 #define STM32_USART2SEL STM32_USART2SEL_PCLK1 #define STM32_USART3SEL STM32_USART3SEL_PCLK1 #define STM32_UART4SEL STM32_UART4SEL_PCLK1 #define STM32_UART5SEL STM32_UART5SEL_PCLK1 #define STM32_USART6SEL STM32_USART6SEL_PCLK2 #define STM32_UART7SEL STM32_UART7SEL_PCLK1 #define STM32_UART8SEL STM32_UART8SEL_PCLK1 #define STM32_I2C1SEL STM32_I2C1SEL_PCLK1 #define STM32_I2C2SEL STM32_I2C2SEL_PCLK1 #define STM32_I2C3SEL STM32_I2C3SEL_PCLK1 #define STM32_I2C4SEL STM32_I2C4SEL_PCLK1 #define STM32_LPTIM1SEL STM32_LPTIM1SEL_PCLK1 #define STM32_CECSEL STM32_CECSEL_HSIDIV488 #define STM32_CK48MSEL STM32_CK48MSEL_PLL #define STM32_SDMMC1SEL STM32_SDMMC1SEL_PLL48CLK #define STM32_SDMMC2SEL STM32_SDMMC2SEL_PLL48CLK #define STM32_SRAM2_NOCACHE FALSE /* * IRQ system settings. */ #define STM32_IRQ_EXTI0_PRIORITY 6 #define STM32_IRQ_EXTI1_PRIORITY 6 #define STM32_IRQ_EXTI2_PRIORITY 6 #define STM32_IRQ_EXTI3_PRIORITY 6 #define STM32_IRQ_EXTI4_PRIORITY 6 #define STM32_IRQ_EXTI5_9_PRIORITY 6 #define STM32_IRQ_EXTI10_15_PRIORITY 6 #define STM32_IRQ_EXTI16_PRIORITY 6 #define STM32_IRQ_EXTI17_PRIORITY 15 #define STM32_IRQ_EXTI18_PRIORITY 6 #define STM32_IRQ_EXTI19_PRIORITY 6 #define STM32_IRQ_EXTI20_PRIORITY 6 #define STM32_IRQ_EXTI21_PRIORITY 15 #define STM32_IRQ_EXTI22_PRIORITY 15 #define STM32_IRQ_EXTI23_PRIORITY 6 #define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7 #define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7 #define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7 #define STM32_IRQ_TIM1_CC_PRIORITY 7 #define STM32_IRQ_TIM2_PRIORITY 7 #define STM32_IRQ_TIM3_PRIORITY 7 #define STM32_IRQ_TIM4_PRIORITY 7 #define STM32_IRQ_TIM5_PRIORITY 7 #define STM32_IRQ_TIM6_PRIORITY 7 #define STM32_IRQ_TIM7_PRIORITY 7 #define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7 #define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7 #define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7 #define STM32_IRQ_TIM8_CC_PRIORITY 7 #define STM32_IRQ_USART1_PRIORITY 12 #define STM32_IRQ_USART2_PRIORITY 12 #define STM32_IRQ_USART3_PRIORITY 12 #define STM32_IRQ_UART4_PRIORITY 12 #define STM32_IRQ_UART5_PRIORITY 12 #define STM32_IRQ_USART6_PRIORITY 12 #define STM32_IRQ_UART7_PRIORITY 12 #define STM32_IRQ_UART8_PRIORITY 12 /* * ADC driver system settings. */ #define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4 #define STM32_ADC_USE_ADC1 TRUE #define STM32_ADC_USE_ADC2 FALSE #define STM32_ADC_USE_ADC3 TRUE #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) #define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) #define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) #define STM32_ADC_ADC1_DMA_PRIORITY 2 #define STM32_ADC_ADC2_DMA_PRIORITY 2 #define STM32_ADC_ADC3_DMA_PRIORITY 2 #define STM32_ADC_IRQ_PRIORITY 6 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 #define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6 #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6 /* * CAN driver system settings. */ #define STM32_CAN_USE_CAN1 FALSE #define STM32_CAN_USE_CAN2 FALSE #define STM32_CAN_USE_CAN3 FALSE #define STM32_CAN_CAN1_IRQ_PRIORITY 11 #define STM32_CAN_CAN2_IRQ_PRIORITY 11 #define STM32_CAN_CAN3_IRQ_PRIORITY 11 /* * DAC driver system settings. */ #define STM32_DAC_DUAL_MODE FALSE #define STM32_DAC_USE_DAC1_CH1 TRUE #define STM32_DAC_USE_DAC1_CH2 FALSE #define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 #define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) /* * GPT driver system settings. */ #define STM32_GPT_USE_TIM1 FALSE #define STM32_GPT_USE_TIM2 FALSE #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 FALSE #define STM32_GPT_USE_TIM5 FALSE #define STM32_GPT_USE_TIM6 FALSE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM9 FALSE #define STM32_GPT_USE_TIM10 FALSE #define STM32_GPT_USE_TIM11 FALSE #define STM32_GPT_USE_TIM12 FALSE #define STM32_GPT_USE_TIM13 FALSE #define STM32_GPT_USE_TIM14 FALSE #define STM32_GPT_USE_TIM15 FALSE #define STM32_GPT_USE_TIM16 FALSE #define STM32_GPT_USE_TIM17 FALSE /* * I2C driver system settings. */ #define STM32_I2C_USE_I2C1 FALSE #define STM32_I2C_USE_I2C2 TRUE #define STM32_I2C_USE_I2C3 TRUE #define STM32_I2C_USE_I2C4 FALSE #define STM32_I2C_BUSY_TIMEOUT 50 #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_I2C_I2C4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) #define STM32_I2C_I2C4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) #define STM32_I2C_I2C1_IRQ_PRIORITY 5 #define STM32_I2C_I2C2_IRQ_PRIORITY 5 #define STM32_I2C_I2C3_IRQ_PRIORITY 5 #define STM32_I2C_I2C4_IRQ_PRIORITY 5 #define STM32_I2C_I2C1_DMA_PRIORITY 3 #define STM32_I2C_I2C2_DMA_PRIORITY 3 #define STM32_I2C_I2C3_DMA_PRIORITY 3 #define STM32_I2C_I2C4_DMA_PRIORITY 3 #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") /* * ICU driver system settings. */ #define STM32_ICU_USE_TIM1 FALSE #define STM32_ICU_USE_TIM2 FALSE #define STM32_ICU_USE_TIM3 FALSE #define STM32_ICU_USE_TIM4 FALSE #define STM32_ICU_USE_TIM5 FALSE #define STM32_ICU_USE_TIM8 FALSE #define STM32_ICU_USE_TIM9 FALSE #define STM32_ICU_USE_TIM10 FALSE #define STM32_ICU_USE_TIM11 FALSE #define STM32_ICU_USE_TIM12 FALSE #define STM32_ICU_USE_TIM13 FALSE #define STM32_ICU_USE_TIM14 FALSE #define STM32_ICU_USE_TIM15 FALSE #define STM32_ICU_USE_TIM16 FALSE #define STM32_ICU_USE_TIM17 FALSE /* * MAC driver system settings. */ #define STM32_MAC_TRANSMIT_BUFFERS 2 #define STM32_MAC_RECEIVE_BUFFERS 4 #define STM32_MAC_BUFFERS_SIZE 1522 #define STM32_MAC_PHY_TIMEOUT 100 #define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE #define STM32_MAC_ETH1_IRQ_PRIORITY 13 #define STM32_MAC_IP_CHECKSUM_OFFLOAD 3 /* * PWM driver system settings. */ #define STM32_PWM_USE_ADVANCED TRUE #define STM32_PWM_USE_TIM1 TRUE #define STM32_PWM_USE_TIM2 FALSE #define STM32_PWM_USE_TIM3 TRUE #define STM32_PWM_USE_TIM4 TRUE #define STM32_PWM_USE_TIM5 TRUE #define STM32_PWM_USE_TIM8 TRUE #define STM32_PWM_USE_TIM9 TRUE #define STM32_PWM_USE_TIM10 FALSE #define STM32_PWM_USE_TIM11 FALSE #define STM32_PWM_USE_TIM12 FALSE #define STM32_PWM_USE_TIM13 FALSE #define STM32_PWM_USE_TIM14 FALSE #define STM32_PWM_USE_TIM15 FALSE #define STM32_PWM_USE_TIM16 FALSE #define STM32_PWM_USE_TIM17 FALSE /* * RTC driver system settings. */ #define STM32_RTC_PRESA_VALUE 32 #define STM32_RTC_PRESS_VALUE 1024 #define STM32_RTC_CR_INIT 0 #define STM32_RTC_TAMPCR_INIT 0 /* * SDC driver system settings. */ #define STM32_SDC_USE_SDMMC1 TRUE #define STM32_SDC_USE_SDMMC2 FALSE #define STM32_SDC_SDMMC_UNALIGNED_SUPPORT TRUE #define STM32_SDC_SDMMC_WRITE_TIMEOUT 1000 #define STM32_SDC_SDMMC_READ_TIMEOUT 1000 #define STM32_SDC_SDMMC_CLOCK_DELAY 10 #define STM32_SDC_SDMMC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) #define STM32_SDC_SDMMC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) #define STM32_SDC_SDMMC1_DMA_PRIORITY 3 #define STM32_SDC_SDMMC2_DMA_PRIORITY 3 #define STM32_SDC_SDMMC1_IRQ_PRIORITY 9 #define STM32_SDC_SDMMC2_IRQ_PRIORITY 9 /* * SERIAL driver system settings. */ #define STM32_SERIAL_USE_USART1 TRUE #define STM32_SERIAL_USE_USART2 FALSE #define STM32_SERIAL_USE_USART3 FALSE #define STM32_SERIAL_USE_UART4 FALSE #define STM32_SERIAL_USE_UART5 FALSE #define STM32_SERIAL_USE_USART6 FALSE #define STM32_SERIAL_USE_UART7 FALSE #define STM32_SERIAL_USE_UART8 FALSE /* * SIO driver system settings. */ #define STM32_SIO_USE_USART1 FALSE #define STM32_SIO_USE_USART2 FALSE #define STM32_SIO_USE_USART3 FALSE #define STM32_SIO_USE_UART4 FALSE #define STM32_SIO_USE_UART5 FALSE #define STM32_SIO_USE_USART6 FALSE #define STM32_SIO_USE_UART7 FALSE #define STM32_SIO_USE_UART8 FALSE /* * SPI driver system settings. */ #define STM32_SPI_USE_SPI1 TRUE #define STM32_SPI_USE_SPI2 TRUE #define STM32_SPI_USE_SPI3 FALSE #define STM32_SPI_USE_SPI4 FALSE #define STM32_SPI_USE_SPI5 FALSE #define STM32_SPI_USE_SPI6 FALSE #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) #define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) #define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) #define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) #define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) #define STM32_SPI_SPI6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) #define STM32_SPI_SPI6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) #define STM32_SPI_SPI1_DMA_PRIORITY 1 #define STM32_SPI_SPI2_DMA_PRIORITY 1 #define STM32_SPI_SPI3_DMA_PRIORITY 1 #define STM32_SPI_SPI4_DMA_PRIORITY 1 #define STM32_SPI_SPI5_DMA_PRIORITY 1 #define STM32_SPI_SPI6_DMA_PRIORITY 1 #define STM32_SPI_SPI1_IRQ_PRIORITY 10 #define STM32_SPI_SPI2_IRQ_PRIORITY 10 #define STM32_SPI_SPI3_IRQ_PRIORITY 10 #define STM32_SPI_SPI4_IRQ_PRIORITY 10 #define STM32_SPI_SPI5_IRQ_PRIORITY 10 #define STM32_SPI_SPI6_IRQ_PRIORITY 10 #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") /* * ST driver system settings. */ #define STM32_ST_IRQ_PRIORITY 8 #define STM32_ST_USE_TIMER 2 /* * TRNG driver system settings. */ #define STM32_TRNG_USE_RNG1 FALSE /* * UART driver system settings. */ #define STM32_UART_USE_USART1 FALSE #define STM32_UART_USE_USART2 TRUE #define STM32_UART_USE_USART3 TRUE #define STM32_UART_USE_UART4 FALSE #define STM32_UART_USE_UART5 FALSE #define STM32_UART_USE_USART6 TRUE #define STM32_UART_USE_UART7 TRUE #define STM32_UART_USE_UART8 FALSE #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) #define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) #define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #define STM32_UART_UART7_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_UART_UART7_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) #define STM32_UART_UART8_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) #define STM32_UART_UART8_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #define STM32_UART_USART1_DMA_PRIORITY 0 #define STM32_UART_USART2_DMA_PRIORITY 0 #define STM32_UART_USART3_DMA_PRIORITY 0 #define STM32_UART_UART4_DMA_PRIORITY 0 #define STM32_UART_UART5_DMA_PRIORITY 0 #define STM32_UART_USART6_DMA_PRIORITY 0 #define STM32_UART_UART7_DMA_PRIORITY 0 #define STM32_UART_UART8_DMA_PRIORITY 0 #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") /* * USB driver system settings. */ #define STM32_USB_USE_OTG1 TRUE #define STM32_USB_USE_OTG2 FALSE #define STM32_USB_OTG1_IRQ_PRIORITY 14 #define STM32_USB_OTG2_IRQ_PRIORITY 14 #define STM32_USB_OTG1_RX_FIFO_SIZE 512 #define STM32_USB_OTG2_RX_FIFO_SIZE 1024 #define STM32_USB_OTG_THREAD_PRIO LOWPRIO // NOT IN LATEST VERSION, KEEPING JUST INCASE #define STM32_USB_OTG_THREAD_STACK_SIZE 128 // NOT IN LATEST VERSION, KEEPING JUST INCASE #define STM32_USB_OTGFIFO_FILL_BASEPRI 0 // NOT IN LATEST VERSION, KEEPING JUST INCASE /* * WDG driver system settings. */ #define STM32_WDG_USE_IWDG TRUE /* * WSPI driver system settings. */ #define STM32_WSPI_USE_QUADSPI1 FALSE #define STM32_WSPI_QUADSPI1_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #define STM32_WSPI_QUADSPI1_PRESCALER_VALUE 2 // header for nanoFramework overlay drivers #include "mcuconf_nf.h" #include "mcuconf_community.h" #endif /* MCUCONF_H */
nanoframework/nf-interpreter
targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/mcuconf.h
C
mit
15,831
'use strict' exports.register = function(server, options, next){ server.route([ { method: 'GET', path: '/createuser', config: { // Uncomment for security //auth: { // strategy: 'standard', // scope: 'admin' //}, handler: function(request, reply) { return reply('<html><head><title>User Creation</title></head><body>' + '<form method="post" action="/createuser">' + 'New Username:<br><input type="text" name="create_username" ><br>' + 'New Email:<br><input type="text" name="create_email" ><br>' + 'New Password:<br><input type="password" name="create_password"><br/><br/>' + 'Scope:<br><input type="text" name="create_scope"><br/><br/>' + 'Survey:<br><input type="int" name="survey_access_number"><br/><br/>' + '<input type="submit" value="Create User"></form></body></html>') } } }, { method: 'POST', path: '/createuser', config: { // Uncomment for security //auth: { // strategy: 'standard', // scope: 'admin' //}, handler: function(request, reply) { const User = server.plugins['hapi-shelf'].model('Users') const user = new User() .save({ username: request.payload.create_username, email: request.payload.create_email, password: request.payload.create_password, scope: request.payload.create_scope, survey: request.payload.survey_access_number }) .then(function(new_user) { reply.redirect('/allusers') }) .catch() } } }, { method: 'GET', path: '/allusers', config: { handler: function(request, reply) { const User = server.plugins['hapi-shelf'].model('Users') reply(User .fetchAll() ) } } }]) next() } exports.register.attributes = { name: 'newuser' }
Code4HR/okcandidate
api/auth/CreateUser.js
JavaScript
mit
1,776
/*! Pure v0.3.0 Copyright 2013 Yahoo! Inc. All rights reserved. Licensed under the BSD License. https://github.com/yui/pure/blob/master/LICENSE.md */ /*! normalize.css v1.1.2 | MIT License | git.io/normalize Copyright (c) Nicolas Gallagher and Jonathan Neal */ /*! normalize.css v1.1.2 | MIT License | git.io/normalize */ /* ========================================================================== HTML5 display definitions ========================================================================== */ /** * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. */ article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; } /** * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. */ audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } /** * Prevent modern browsers from displaying `audio` without controls. * Remove excess height in iOS 5 devices. */ audio:not([controls]) { display: none; height: 0; } /** * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. * Known issue: no IE 6 support. */ [hidden] { display: none; } /* ========================================================================== Base ========================================================================== */ /** * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using * `em` units. * 2. Prevent iOS text size adjust after orientation change, without disabling * user zoom. */ html { font-size: 100%; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } /** * Address `font-family` inconsistency between `textarea` and other form * elements. */ html, button, input, select, textarea { font-family: sans-serif; } /** * Address margins handled incorrectly in IE 6/7. */ body { margin: 0; } /* ========================================================================== Links ========================================================================== */ /** * Address `outline` inconsistency between Chrome and other browsers. */ a:focus { outline: thin dotted; } /** * Improve readability when focused and also mouse hovered in all browsers. */ a:active, a:hover { outline: 0; } /* ========================================================================== Typography ========================================================================== */ /** * Address font sizes and margins set differently in IE 6/7. * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, * and Chrome. */ h1 { font-size: 2em; margin: 0.67em 0; } h2 { font-size: 1.5em; margin: 0.83em 0; } h3 { font-size: 1.17em; margin: 1em 0; } h4 { font-size: 1em; margin: 1.33em 0; } h5 { font-size: 0.83em; margin: 1.67em 0; } h6 { font-size: 0.67em; margin: 2.33em 0; } /** * Address styling not present in IE 7/8/9, Safari 5, and Chrome. */ abbr[title] { border-bottom: 1px dotted; } /** * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. */ b, strong { font-weight: bold; } blockquote { margin: 1em 40px; } /** * Address styling not present in Safari 5 and Chrome. */ dfn { font-style: italic; } /** * Address differences between Firefox and other browsers. * Known issue: no IE 6/7 normalization. */ hr { -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } /** * Address styling not present in IE 6/7/8/9. */ mark { background: #ff0; color: #000; } /** * Address margins set differently in IE 6/7. */ p, pre { margin: 1em 0; } /** * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. */ code, kbd, pre, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } /** * Improve readability of pre-formatted text in all browsers. */ pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } /** * Address CSS quotes not supported in IE 6/7. */ q { quotes: none; } /** * Address `quotes` property not supported in Safari 4. */ q:before, q:after { content: ''; content: none; } /** * Address inconsistent and variable font size in all browsers. */ small { font-size: 80%; } /** * Prevent `sub` and `sup` affecting `line-height` in all browsers. */ sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } /* ========================================================================== Lists ========================================================================== */ /** * Address margins set differently in IE 6/7. */ dl, menu, ol, ul { margin: 1em 0; } dd { margin: 0 0 0 40px; } /** * Address paddings set differently in IE 6/7. */ menu, ol, ul { padding: 0 0 0 40px; } /** * Correct list images handled incorrectly in IE 7. */ nav ul, nav ol { list-style: none; list-style-image: none; } /* ========================================================================== Embedded content ========================================================================== */ /** * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. * 2. Improve image quality when scaled in IE 7. */ img { border: 0; /* 1 */ -ms-interpolation-mode: bicubic; /* 2 */ } /** * Correct overflow displayed oddly in IE 9. */ svg:not(:root) { overflow: hidden; } /* ========================================================================== Figures ========================================================================== */ /** * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. */ figure { margin: 0; } /* ========================================================================== Forms ========================================================================== */ /** * Correct margin displayed oddly in IE 6/7. */ form { margin: 0; } /** * Define consistent border, margin, and padding. */ fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } /** * 1. Correct color not being inherited in IE 6/7/8/9. * 2. Correct text not wrapping in Firefox 3. * 3. Correct alignment displayed oddly in IE 6/7. */ legend { border: 0; /* 1 */ padding: 0; white-space: normal; /* 2 */ *margin-left: -7px; /* 3 */ } /** * 1. Correct font size not being inherited in all browsers. * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, * and Chrome. * 3. Improve appearance and consistency in all browsers. */ button, input, select, textarea { font-size: 100%; /* 1 */ margin: 0; /* 2 */ vertical-align: baseline; /* 3 */ *vertical-align: middle; /* 3 */ } /** * Address Firefox 3+ setting `line-height` on `input` using `!important` in * the UA stylesheet. */ button, input { line-height: normal; } /** * Address inconsistent `text-transform` inheritance for `button` and `select`. * All other form control elements do not inherit `text-transform` values. * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. * Correct `select` style inheritance in Firefox 4+ and Opera. */ button, select { text-transform: none; } /** * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` * and `video` controls. * 2. Correct inability to style clickable `input` types in iOS. * 3. Improve usability and consistency of cursor style between image-type * `input` and others. * 4. Remove inner spacing in IE 7 without affecting normal text inputs. * Known issue: inner spacing remains in IE 6. */ button, html input[type="button"], /* 1 */ input[type="reset"], input[type="submit"] { -webkit-appearance: button; /* 2 */ cursor: pointer; /* 3 */ *overflow: visible; /* 4 */ } /** * Re-set default cursor for disabled elements. */ button[disabled], html input[disabled] { cursor: default; } /** * 1. Address box sizing set to content-box in IE 8/9. * 2. Remove excess padding in IE 8/9. * 3. Remove excess padding in IE 7. * Known issue: excess padding remains in IE 6. */ input[type="checkbox"], input[type="radio"] { box-sizing: border-box; /* 1 */ padding: 0; /* 2 */ *height: 13px; /* 3 */ *width: 13px; /* 3 */ } /** * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome * (include `-moz` to future-proof). */ input[type="search"] { -webkit-appearance: textfield; /* 1 */ -moz-box-sizing: content-box; -webkit-box-sizing: content-box; /* 2 */ box-sizing: content-box; } /** * Remove inner padding and search cancel button in Safari 5 and Chrome * on OS X. */ input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } /** * Remove inner padding and border in Firefox 3+. */ button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } /** * 1. Remove default vertical scrollbar in IE 6/7/8/9. * 2. Improve readability and alignment in all browsers. */ textarea { overflow: auto; /* 1 */ vertical-align: top; /* 2 */ } /* ========================================================================== Tables ========================================================================== */ /** * Remove most spacing between table cells. */ table { border-collapse: collapse; border-spacing: 0; } .pure-button { /* Structure */ display: inline-block; *display: inline; /*IE 6/7*/ zoom: 1; line-height: normal; white-space: nowrap; vertical-align: baseline; text-align: center; cursor: pointer; -webkit-user-drag: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Firefox: Get rid of the inner focus border */ .pure-button::-moz-focus-inner { padding: 0; border: 0; } /*csslint unqualified-attributes:false, outline-none:false*/ .pure-button { font-size: 100%; *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ padding: 0.5em 1.5em 0.5em; color: #444; /* rgba not supported (IE 8) */ color: rgba(0, 0, 0, 0.80); /* rgba supported */ *color: #444; /* IE 6 & 7 */ border: 1px solid #999; /*IE 6/7/8*/ border: none rgba(0, 0, 0, 0); /*IE9 + everything else*/ background-color: #E6E6E6; text-decoration: none; border-radius: 2px; /* Transitions */ -webkit-transition: 0.1s linear -webkit-box-shadow; -moz-transition: 0.1s linear -moz-box-shadow; -ms-transition: 0.1s linear box-shadow; -o-transition: 0.1s linear box-shadow; transition: 0.1s linear box-shadow; } .pure-button-hover, .pure-button:hover, .pure-button:focus { filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); background-image: -ms-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); } .pure-button:focus { outline: 0; } .pure-button-active, .pure-button:active { box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; } .pure-button[disabled], .pure-button-disabled, .pure-button-disabled:hover, .pure-button-disabled:focus, .pure-button-disabled:active { border: none; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); filter: alpha(opacity=40); -khtml-opacity: 0.40; -moz-opacity: 0.40; opacity: 0.40; cursor: not-allowed; box-shadow: none; } .pure-button-hidden { display: none; } /* Firefox: Get rid of the inner focus border */ .pure-button::-moz-focus-inner{ padding: 0; border: 0; } .pure-button-primary, .pure-button-selected, a.pure-button-primary, a.pure-button-selected { background-color: rgb(0, 120, 231); color: #fff; } .pure-form input[type="text"], .pure-form input[type="password"], .pure-form input[type="email"], .pure-form input[type="url"], .pure-form input[type="date"], .pure-form input[type="month"], .pure-form input[type="time"], .pure-form input[type="datetime"], .pure-form input[type="datetime-local"], .pure-form input[type="week"], .pure-form input[type="number"], .pure-form input[type="search"], .pure-form input[type="tel"], .pure-form input[type="color"], .pure-form select, .pure-form textarea { padding: 0.5em 0.6em; display: inline-block; border: 1px solid #ccc; font-size: 0.8em; box-shadow: inset 0 1px 3px #ddd; border-radius: 4px; -webkit-transition: 0.3s linear border; -moz-transition: 0.3s linear border; -ms-transition: 0.3s linear border; -o-transition: 0.3s linear border; transition: 0.3s linear border; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .pure-form input[type="text"]:focus, .pure-form input[type="password"]:focus, .pure-form input[type="email"]:focus, .pure-form input[type="url"]:focus, .pure-form input[type="date"]:focus, .pure-form input[type="month"]:focus, .pure-form input[type="time"]:focus, .pure-form input[type="datetime"]:focus, .pure-form input[type="datetime-local"]:focus, .pure-form input[type="week"]:focus, .pure-form input[type="number"]:focus, .pure-form input[type="search"]:focus, .pure-form input[type="tel"]:focus, .pure-form input[type="color"]:focus, .pure-form select:focus, .pure-form textarea:focus { outline: 0; outline: thin dotted \9; /* IE6-9 */ border-color: #129FEA; } .pure-form input[type="file"]:focus, .pure-form input[type="radio"]:focus, .pure-form input[type="checkbox"]:focus { outline: thin dotted #333; outline: 1px auto #129FEA; } .pure-form .pure-checkbox, .pure-form .pure-radio { margin: 0.5em 0; display: block; } .pure-form input[type="text"][disabled], .pure-form input[type="password"][disabled], .pure-form input[type="email"][disabled], .pure-form input[type="url"][disabled], .pure-form input[type="date"][disabled], .pure-form input[type="month"][disabled], .pure-form input[type="time"][disabled], .pure-form input[type="datetime"][disabled], .pure-form input[type="datetime-local"][disabled], .pure-form input[type="week"][disabled], .pure-form input[type="number"][disabled], .pure-form input[type="search"][disabled], .pure-form input[type="tel"][disabled], .pure-form input[type="color"][disabled], .pure-form select[disabled], .pure-form textarea[disabled] { cursor: not-allowed; background-color: #eaeded; color: #cad2d3; } .pure-form input[readonly], .pure-form select[readonly], .pure-form textarea[readonly] { background: #eee; /* menu hover bg color */ color: #777; /* menu text color */ border-color: #ccc; } .pure-form input:focus:invalid, .pure-form textarea:focus:invalid, .pure-form select:focus:invalid { color: #b94a48; border: 1px solid #ee5f5b; } .pure-form input:focus:invalid:focus, .pure-form textarea:focus:invalid:focus, .pure-form select:focus:invalid:focus { border-color: #e9322d; } .pure-form input[type="file"]:focus:invalid:focus, .pure-form input[type="radio"]:focus:invalid:focus, .pure-form input[type="checkbox"]:focus:invalid:focus { outline-color: #e9322d; } .pure-form select { border: 1px solid #ccc; background-color: white; } .pure-form select[multiple] { height: auto; } .pure-form label { margin: 0.5em 0 0.2em; font-size: 90%; } .pure-form fieldset { margin: 0; padding: 0.35em 0 0.75em; border: 0; } .pure-form legend { display: block; width: 100%; padding: 0.3em 0; margin-bottom: 0.3em; font-size: 125%; color: #333; border-bottom: 1px solid #e5e5e5; } .pure-form-stacked input[type="text"], .pure-form-stacked input[type="password"], .pure-form-stacked input[type="email"], .pure-form-stacked input[type="url"], .pure-form-stacked input[type="date"], .pure-form-stacked input[type="month"], .pure-form-stacked input[type="time"], .pure-form-stacked input[type="datetime"], .pure-form-stacked input[type="datetime-local"], .pure-form-stacked input[type="week"], .pure-form-stacked input[type="number"], .pure-form-stacked input[type="search"], .pure-form-stacked input[type="tel"], .pure-form-stacked input[type="color"], .pure-form-stacked select, .pure-form-stacked label, .pure-form-stacked textarea { display: block; margin: 0.25em 0; } .pure-form-aligned input, .pure-form-aligned textarea, .pure-form-aligned select, /* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ .pure-form-aligned .pure-help-inline, .pure-form-message-inline { display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; } /* Aligned Forms */ .pure-form-aligned .pure-control-group { margin-bottom: 0.5em; } .pure-form-aligned .pure-control-group label { text-align: right; display: inline-block; vertical-align: middle; width: 10em; margin: 0 1em 0 0; } .pure-form-aligned .pure-controls { margin: 1.5em 0 0 10em; } /* Rounded Inputs */ .pure-form input.pure-input-rounded, .pure-form .pure-input-rounded { border-radius: 2em; padding: 0.5em 1em; } /* Grouped Inputs */ .pure-form .pure-group fieldset { margin-bottom: 10px; } .pure-form .pure-group input { display: block; padding: 10px; margin: 0; border-radius: 0; position: relative; top: -1px; } .pure-form .pure-group input:focus { z-index: 2; } .pure-form .pure-group input:first-child { top: 1px; border-radius: 4px 4px 0 0; } .pure-form .pure-group input:last-child { top: -2px; border-radius: 0 0 4px 4px; } .pure-form .pure-group button { margin: 0.35em 0; } .pure-form .pure-input-1 { width: 100%; } .pure-form .pure-input-2-3 { width: 66%; } .pure-form .pure-input-1-2 { width: 50%; } .pure-form .pure-input-1-3 { width: 33%; } .pure-form .pure-input-1-4 { width: 25%; } /* Inline help for forms */ /* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ .pure-form .pure-help-inline, .pure-form-message-inline { display: inline-block; padding-left: 0.3em; color: #666; vertical-align: middle; font-size: 90%; } /* Block help for forms */ .pure-form-message { display: block; color: #666; font-size: 90%; } @media only screen and (max-width : 480px) { .pure-form button[type="submit"] { margin: 0.7em 0 0; } .pure-form input[type="text"], .pure-form input[type="password"], .pure-form input[type="email"], .pure-form input[type="url"], .pure-form input[type="date"], .pure-form input[type="month"], .pure-form input[type="time"], .pure-form input[type="datetime"], .pure-form input[type="datetime-local"], .pure-form input[type="week"], .pure-form input[type="number"], .pure-form input[type="search"], .pure-form input[type="tel"], .pure-form input[type="color"], .pure-form label { margin-bottom: 0.3em; display: block; } .pure-group input[type="text"], .pure-group input[type="password"], .pure-group input[type="email"], .pure-group input[type="url"], .pure-group input[type="date"], .pure-group input[type="month"], .pure-group input[type="time"], .pure-group input[type="datetime"], .pure-group input[type="datetime-local"], .pure-group input[type="week"], .pure-group input[type="number"], .pure-group input[type="search"], .pure-group input[type="tel"], .pure-group input[type="color"] { margin-bottom: 0; } .pure-form-aligned .pure-control-group label { margin-bottom: 0.3em; text-align: left; display: block; width: 100%; } .pure-form-aligned .pure-controls { margin: 1.5em 0 0 0; } /* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ .pure-form .pure-help-inline, .pure-form-message-inline, .pure-form-message { display: block; font-size: 80%; /* Increased bottom padding to make it group with its related input element. */ padding: 0.2em 0 0.8em; } } /*csslint regex-selectors:false, known-properties:false, duplicate-properties:false*/ .pure-g { letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ *letter-spacing: normal; /* reset IE < 8 */ *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ /* Sets the font stack to fonts known to work properly with the above letter and word spacings. See: https://github.com/yui/pure/issues/41/ The following font stack makes Pure Grids work on all known environments. * FreeSans: Ships with many Linux distros, including Ubuntu * Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and Arial to get picked up by the browser, even though neither is available in Chrome OS. * Droid Sans: Ships with all versions of Android. * Helvetica, Arial, sans-serif: Common font stack on OS X and Windows. */ font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; /* Use flexbox when possible to avoid `letter-spacing` side-effects. NOTE: Firefox (as of 25) does not currently support flex-wrap, so the `-moz-` prefix version is omitted. */ display: -webkit-flex; -webkit-flex-flow: row wrap; /* IE10 uses display: flexbox */ display: -ms-flexbox; -ms-flex-flow: row wrap; } /* Opera as of 12 on Windows needs word-spacing. The ".opera-only" selector is used to prevent actual prefocus styling and is not required in markup. */ .opera-only :-o-prefocus, .pure-g { word-spacing: -0.43em; } .pure-u { display: inline-block; *display: inline; /* IE < 8: fake inline-block */ zoom: 1; letter-spacing: normal; word-spacing: normal; vertical-align: top; text-rendering: auto; } /* Resets the font family back to the OS/browser's default sans-serif font, this the same font stack that Normalize.css sets for the `body`. */ .pure-g [class *= "pure-u"] { font-family: sans-serif; } .pure-u-1, .pure-u-1-2, .pure-u-1-3, .pure-u-2-3, .pure-u-1-4, .pure-u-3-4, .pure-u-1-5, .pure-u-2-5, .pure-u-3-5, .pure-u-4-5, .pure-u-1-6, .pure-u-5-6, .pure-u-1-8, .pure-u-3-8, .pure-u-5-8, .pure-u-7-8, .pure-u-1-12, .pure-u-5-12, .pure-u-7-12, .pure-u-11-12, .pure-u-1-24, .pure-u-5-24, .pure-u-7-24, .pure-u-11-24, .pure-u-13-24, .pure-u-17-24, .pure-u-19-24, .pure-u-23-24 { display: inline-block; *display: inline; /* IE < 8: fake inline-block */ zoom: 1; letter-spacing: normal; word-spacing: normal; vertical-align: top; text-rendering: auto; } .pure-u-1 { width: 100%; } .pure-u-1-2 { width: 50%; *width: 49.969%; } .pure-u-1-3 { width: 33.3333%; *width: 33.3023%; } .pure-u-2-3 { width: 66.6667%; *width: 66.6357%; } .pure-u-1-4 { width: 25%; *width: 24.969%; } .pure-u-3-4 { width: 75%; *width: 74.969%; } .pure-u-1-5 { width: 20%; *width: 19.969%; } .pure-u-2-5 { width: 40%; *width: 39.969%; } .pure-u-3-5 { width: 60%; *width: 59.969%; } .pure-u-4-5 { width: 80%; *width: 79.969%; } .pure-u-1-6 { width: 16.6667%; *width: 16.6357%; } .pure-u-5-6 { width: 83.3333%; *width: 83.3023%; } .pure-u-1-8 { width: 12.5%; *width: 12.469%; } .pure-u-3-8 { width: 37.5%; *width: 37.469%; } .pure-u-5-8 { width: 62.5%; *width: 62.469%; } .pure-u-7-8 { width: 87.5%; *width: 87.469%; } .pure-u-1-12 { width: 8.3333%; *width: 8.3023%; } .pure-u-5-12 { width: 41.6667%; *width: 41.6357%; } .pure-u-7-12 { width: 58.3333%; *width: 58.3023%; } .pure-u-11-12 { width: 91.6667%; *width: 91.6357%; } .pure-u-1-24 { width: 4.1667%; *width: 4.1357%; } .pure-u-5-24 { width: 20.8333%; *width: 20.8023%; } .pure-u-7-24 { width: 29.1667%; *width: 29.1357%; } .pure-u-11-24 { width: 45.8333%; *width: 45.8023%; } .pure-u-13-24 { width: 54.1667%; *width: 54.1357%; } .pure-u-17-24 { width: 70.8333%; *width: 70.8023%; } .pure-u-19-24 { width: 79.1667%; *width: 79.1357%; } .pure-u-23-24 { width: 95.8333%; *width: 95.8023%; } /*csslint regex-selectors:false, known-properties:false, duplicate-properties:false*/ .pure-g-r { letter-spacing: -0.31em; *letter-spacing: normal; *word-spacing: -0.43em; /* Sets the font stack to fonts known to work properly with the above letter and word spacings. See: https://github.com/yui/pure/issues/41/ The following font stack makes Pure Grids work on all known environments. * FreeSans: Ships with many Linux distros, including Ubuntu * Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and Arial to get picked up by the browser, even though neither is available in Chrome OS. * Droid Sans: Ships with all versions of Android. * Helvetica, Arial, sans-serif: Common font stack on OS X and Windows. */ font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; /* Use flexbox when possible to avoid `letter-spacing` side-effects. NOTE: Firefox (as of 25) does not currently support flex-wrap, so the `-moz-` prefix version is omitted. */ display: -webkit-flex; -webkit-flex-flow: row wrap; /* IE10 uses display: flexbox */ display: -ms-flexbox; -ms-flex-flow: row wrap; } /* Opera as of 12 on Windows needs word-spacing. The ".opera-only" selector is used to prevent actual prefocus styling and is not required in markup. */ .opera-only :-o-prefocus, .pure-g-r { word-spacing: -0.43em; } /* Resets the font family back to the OS/browser's default sans-serif font, this the same font stack that Normalize.css sets for the `body`. */ .pure-g-r [class *= "pure-u"] { font-family: sans-serif; } .pure-g-r img { max-width: 100%; height: auto; } @media (min-width: 980px) { .pure-visible-phone { display: none; } .pure-visible-tablet { display: none; } .pure-hidden-desktop { display: none; } } @media (max-width: 480px) { .pure-g-r > .pure-u, .pure-g-r > [class *= "pure-u-"] { width: 100%; } } @media (max-width: 767px) { .pure-g-r > .pure-u, .pure-g-r > [class *= "pure-u-"] { width: 100%; } .pure-hidden-phone { display: none; } .pure-visible-desktop { display: none; } } @media (min-width: 768px) and (max-width: 979px) { .pure-hidden-tablet { display: none; } .pure-visible-desktop { display: none; } } /*csslint adjoining-classes:false, outline-none:false*/ /*TODO: Remove this lint rule override after a refactor of this code.*/ .pure-menu ul { position: absolute; visibility: hidden; } .pure-menu.pure-menu-open { visibility: visible; z-index: 2; width: 100%; } .pure-menu ul { left: -10000px; list-style: none; margin: 0; padding: 0; top: -10000px; z-index: 1; } .pure-menu > ul { position: relative; } .pure-menu-open > ul { left: 0; top: 0; visibility: visible; } .pure-menu-open > ul:focus { outline: 0; } .pure-menu li { position: relative; } .pure-menu a, .pure-menu .pure-menu-heading { display: block; color: inherit; line-height: 1.5em; padding: 5px 20px; text-decoration: none; white-space: nowrap; } .pure-menu.pure-menu-horizontal > .pure-menu-heading { display: inline-block; *display: inline; zoom: 1; margin: 0; vertical-align: middle; } .pure-menu.pure-menu-horizontal > ul { display: inline-block; *display: inline; zoom: 1; vertical-align: middle; height: 2.4em; } .pure-menu li a { padding: 5px 20px; } .pure-menu-can-have-children > .pure-menu-label:after { content: '\25B8'; float: right; /* These specific fonts have the Unicode char we need. */ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', sans-serif; margin-right: -20px; margin-top: -1px; } .pure-menu-can-have-children > .pure-menu-label { padding-right: 30px; } .pure-menu-separator { background-color: #dfdfdf; display: block; height: 1px; font-size: 0; margin: 7px 2px; overflow: hidden; } .pure-menu-hidden { display: none; } /* FIXED MENU */ .pure-menu-fixed { position: fixed; top: 0; left: 0; width: 100%; } /* HORIZONTAL MENU CODE */ /* Initial menus should be inline-block so that they are horizontal */ .pure-menu-horizontal li { display: inline-block; *display: inline; zoom: 1; vertical-align: middle; } /* Submenus should still be display: block; */ .pure-menu-horizontal li li { display: block; } /* Content after should be down arrow */ .pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after { content: "\25BE"; } /*Add extra padding to elements that have the arrow so that the hover looks nice */ .pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label { padding-right: 30px; } /* Adjusting separator for vertical menus */ .pure-menu-horizontal li.pure-menu-separator { height: 50%; width: 1px; margin: 0 7px; } /* Submenus should be horizontal separator again */ .pure-menu-horizontal li li.pure-menu-separator { height: 1px; width: auto; margin: 7px 2px; } /*csslint adjoining-classes:false*/ /*TODO: Remove this lint rule override after a refactor of this code.*/ /* MAIN MENU STYLING */ .pure-menu.pure-menu-open, .pure-menu.pure-menu-horizontal li .pure-menu-children { background: #fff; /* Old browsers */ border: 1px solid #b7b7b7; } /* remove borders for horizontal menus */ .pure-menu.pure-menu-horizontal, .pure-menu.pure-menu-horizontal .pure-menu-heading { border: none; } /* LINK STYLES */ .pure-menu a { border: 1px solid transparent; border-left: none; border-right: none; } .pure-menu a, .pure-menu .pure-menu-can-have-children > li:after { color: #777; } .pure-menu .pure-menu-can-have-children > li:hover:after { color: #fff; } /* Focus style for a dropdown menu-item when the parent has been opened */ .pure-menu .pure-menu-open { background: #dedede; } .pure-menu li a:hover, .pure-menu li a:focus { background: #eee; } /* DISABLED STATES */ .pure-menu li.pure-menu-disabled a:hover, .pure-menu li.pure-menu-disabled a:focus { background: #fff; color: #bfbfbf; } .pure-menu .pure-menu-disabled > a { background-image: none; border-color: transparent; cursor: default; } .pure-menu .pure-menu-disabled > a, .pure-menu .pure-menu-can-have-children.pure-menu-disabled > a:after { color: #bfbfbf; } /* HEADINGS */ .pure-menu .pure-menu-heading { color: #565d64; text-transform: uppercase; font-size: 90%; margin-top: 0.5em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dfdfdf; } /* ACTIVE MENU ITEM */ .pure-menu .pure-menu-selected a { color: #000; } /* FIXED MENU */ .pure-menu.pure-menu-open.pure-menu-fixed { border: none; border-bottom: 1px solid #b7b7b7; } /*csslint box-model:false*/ /*TODO: Remove this lint rule override after a refactor of this code.*/ .pure-paginator { /* `pure-g` Grid styles */ letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ *letter-spacing: normal; /* reset IE < 8 */ *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ /* `pure-paginator` Specific styles */ list-style: none; margin: 0; padding: 0; } .opera-only :-o-prefocus, .pure-paginator { word-spacing: -0.43em; } /* `pure-u` Grid styles */ .pure-paginator li { display: inline-block; *display: inline; /* IE < 8: fake inline-block */ zoom: 1; letter-spacing: normal; word-spacing: normal; vertical-align: top; text-rendering: auto; } .pure-paginator .pure-button { border-radius: 0; padding: 0.8em 1.4em; vertical-align: top; height: 1.1em; } .pure-paginator .pure-button:focus, .pure-paginator .pure-button:active { outline-style: none; } .pure-paginator .prev, .pure-paginator .next { color: #C0C1C3; text-shadow: 0 -1px 0 rgba(0,0,0, 0.45); } .pure-paginator .prev { border-radius: 2px 0 0 2px; } .pure-paginator .next { border-radius: 0 2px 2px 0; } @media (max-width: 480px) { .pure-menu-horizontal { width: 100%; } .pure-menu-children li { display: block; border-bottom: 1px solid black; } } .pure-table { /* Remove spacing between table cells (from Normalize.css) */ border-collapse: collapse; border-spacing: 0; empty-cells: show; border: 1px solid #cbcbcb; } .pure-table caption { color: #000; font: italic 85%/1 arial, sans-serif; padding: 1em 0; text-align: center; } .pure-table td, .pure-table th { border-left: 1px solid #cbcbcb;/* inner column border */ border-width: 0 0 0 1px; font-size: inherit; margin: 0; overflow: visible; /*to make ths where the title is really long work*/ padding: 6px 12px; /* cell padding */ } .pure-table td:first-child, .pure-table th:first-child { border-left-width: 0; } .pure-table thead { background: #e0e0e0; color: #000; text-align: left; vertical-align: bottom; } /* striping: even - #fff (white) odd - #f2f2f2 (light gray) */ .pure-table td { background-color: transparent; } .pure-table-odd td { background-color: #f2f2f2; } /* nth-child selector for modern browsers */ .pure-table-striped tr:nth-child(2n-1) td { background-color: #f2f2f2; } /* BORDERED TABLES */ .pure-table-bordered td { border-bottom: 1px solid #cbcbcb; } .pure-table-bordered tbody > tr:last-child td, .pure-table-horizontal tbody > tr:last-child td { border-bottom-width: 0; } /* HORIZONTAL BORDERED TABLES */ .pure-table-horizontal td, .pure-table-horizontal th { border-width: 0 0 1px 0; border-bottom: 1px solid #cbcbcb; } .pure-table-horizontal tbody > tr:last-child td { border-bottom-width: 0; }
kootenpv/kootenpv.github.io
css/pure.css
CSS
mit
35,593
using GitVersion.Helpers; namespace GitVersion.Core.Tests.Helpers; public class TestFileSystem : IFileSystem { private readonly Dictionary<string, byte[]> fileSystem = new(StringComparerUtils.OsDependentComparer); public void Copy(string from, string to, bool overwrite) { var fromPath = Path.GetFullPath(from); var toPath = Path.GetFullPath(to); if (this.fileSystem.ContainsKey(toPath)) { if (overwrite) this.fileSystem.Remove(toPath); else throw new IOException("File already exists"); } if (!this.fileSystem.TryGetValue(fromPath, out var source)) throw new FileNotFoundException($"The source file '{fromPath}' was not found", from); this.fileSystem.Add(toPath, source); } public void Move(string from, string to) { var fromPath = Path.GetFullPath(from); Copy(from, to, false); this.fileSystem.Remove(fromPath); } public bool Exists(string file) { var path = Path.GetFullPath(file); return this.fileSystem.ContainsKey(path); } public void Delete(string path) { var fullPath = Path.GetFullPath(path); this.fileSystem.Remove(fullPath); } public string ReadAllText(string path) { var fullPath = Path.GetFullPath(path); if (!this.fileSystem.TryGetValue(fullPath, out var content)) throw new FileNotFoundException($"The file '{fullPath}' was not found", fullPath); var encoding = EncodingHelper.DetectEncoding(content) ?? Encoding.UTF8; return encoding.GetString(content); } public void WriteAllText(string? file, string fileContents) { var path = Path.GetFullPath(file ?? throw new ArgumentNullException(nameof(file))); var encoding = this.fileSystem.ContainsKey(path) ? EncodingHelper.DetectEncoding(this.fileSystem[path]) ?? Encoding.UTF8 : Encoding.UTF8; WriteAllText(path, fileContents, encoding); } public void WriteAllText(string? file, string fileContents, Encoding encoding) { var path = Path.GetFullPath(file ?? throw new ArgumentNullException(nameof(file))); this.fileSystem[path] = encoding.GetBytes(fileContents); } public IEnumerable<string> DirectoryEnumerateFiles(string? directory, string searchPattern, SearchOption searchOption) => throw new NotImplementedException(); public Stream OpenWrite(string path) => new TestStream(path, this); public Stream OpenRead(string path) { var fullPath = Path.GetFullPath(path); if (!this.fileSystem.ContainsKey(fullPath)) throw new FileNotFoundException("File not found.", fullPath); var content = this.fileSystem[fullPath]; return new MemoryStream(content); } public void CreateDirectory(string path) { var fullPath = Path.GetFullPath(path); if (this.fileSystem.ContainsKey(fullPath)) { this.fileSystem[fullPath] = Array.Empty<byte>(); } else { this.fileSystem.Add(fullPath, Array.Empty<byte>()); } } public bool DirectoryExists(string path) { var fullPath = Path.GetFullPath(path); return this.fileSystem.ContainsKey(fullPath); } public long GetLastDirectoryWrite(string path) => 1; public bool PathsEqual(string? path, string? otherPath) => string.Equals( Path.GetFullPath(path ?? throw new ArgumentNullException(nameof(path))).TrimEnd('\\').TrimEnd('/'), Path.GetFullPath(otherPath ?? throw new ArgumentNullException(nameof(otherPath))).TrimEnd('\\').TrimEnd('/'), StringComparerUtils.OsDependentComparison); }
asbjornu/GitVersion
src/GitVersion.Core.Tests/Helpers/TestFileSystem.cs
C#
mit
3,779
BASE.require([ "BASE.sqlite.Visitor" ], function () { });
jaredjbarnes/WoodlandCreatures
packages/WebLib.2.0.0.724/content/lib/weblib/lib/BASE/BASE/sqlite/Provider.js
JavaScript
mit
74
// // FLErrors.h // FishLampCore // // Created by Mike Fullerton on 9/3/13. // Copyright (c) 2013 Mike Fullerton. All rights reserved. // #import "FLCoreRequired.h" #import "NSError+FLExtras.h" #import "FLExceptions.h" #import "FLErrorCodes.h" #import "FLErrorException.h" #import "FLCancelError.h" #import "FLErrorDomainInfo.h"
fishlamp-obsolete-ignore-these-repos/FishLampObjc-Core
Classes/Errors/FLErrors.h
C
mit
333
from django.forms import ModelForm,forms from django import forms from appPortas.models import * from django.forms.models import inlineformset_factory class PortaForm(ModelForm): class Meta: model = Porta fields = ('descricao',) class GrupoForm(ModelForm): class Meta: model = Grupo fields = ('descricao',)
Ednilsonpalhares/SCEFA
appPortas/forms.py
Python
mit
350
// This file is part of Indico. // Copyright (C) 2002 - 2019 CERN // // Indico is free software; you can redistribute it and/or // modify it under the terms of the MIT License; see the // LICENSE file for more details. (function(global) { 'use strict'; global.setupLinkingWidget = function setupLinkingWidget(options) { options = $.extend( true, { fieldId: null, }, options ); function updateDropdownState() { var $this = $(this); if ($this.prop('checked')) { $this .closest('.i-radio') .siblings('.i-radio') .find('.i-linking-dropdown select') .prop('disabled', true); $this .siblings('.i-linking-dropdown') .find('select') .prop('disabled', false); } } var field = $('#' + options.fieldId); field .find('.i-linking > .i-linking-dropdown > select > option[value=""]') .prop('disabled', true); field .find('.i-linking.i-radio > input[type="radio"]') .off('change') .on('change', updateDropdownState) .each(updateDropdownState); }; })(window);
mvidalgarcia/indico
indico/web/client/js/jquery/widgets/jinja/linking_widget.js
JavaScript
mit
1,153
#include <SFML/Graphics.hpp> #include <cmath> #include "Arrow.h" #define PI 3.14159265 int main() { //You can turn off antialiasing if your graphics card doesn't support it sf::ContextSettings context; context.antialiasingLevel = 4; sf::RenderWindow window(sf::VideoMode(400,400), "Follow Mouse 1", sf::Style::Titlebar | sf::Style::Close, context); window.setFramerateLimit(60); Arrow arrow = Arrow(50, 100); float angle = 45.0f; float speed = 3.0f; float dx = 0; float dy = 0; float vx = 0; float vy = 0; while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { switch (event.type) { case sf::Event::Closed: window.close(); break; } } dx = event.mouseMove.x - arrow.GetX(); dy = event.mouseMove.y - arrow.GetY(); angle = std::atan2(dy, dx); //Radians vx = std::cos(angle) * speed; vy = std::sin(angle) * speed; arrow.SetRotation(angle * 180 / PI); arrow.Translate(vx, vy); window.clear(sf::Color::White); window.draw(arrow.shape); window.display(); } return 0; }
tiag/C-SFML-html5-animation
ch05-04-follow-mouse-1/src/main.cpp
C++
mit
1,062
/** @ngdoc directive @name umbraco.directives.directive:umbChildSelector @restrict E @scope @description Use this directive to render a ui component for selecting child items to a parent node. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-child-selector selected-children="vm.selectedChildren" available-children="vm.availableChildren" parent-name="vm.name" parent-icon="vm.icon" parent-id="vm.id" on-add="vm.addChild" on-remove="vm.removeChild"> </umb-child-selector> <!-- use overlay to select children from --> <umb-overlay ng-if="vm.overlay.show" model="vm.overlay" position="target" view="vm.overlay.view"> </umb-overlay> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.id = 1; vm.name = "My Parent element"; vm.icon = "icon-document"; vm.selectedChildren = []; vm.availableChildren = [ { id: 1, alias: "item1", name: "Item 1", icon: "icon-document" }, { id: 2, alias: "item2", name: "Item 2", icon: "icon-document" } ]; vm.addChild = addChild; vm.removeChild = removeChild; function addChild($event) { vm.overlay = { view: "itempicker", title: "Choose child", availableItems: vm.availableChildren, selectedItems: vm.selectedChildren, event: $event, show: true, submit: function(model) { // add selected child vm.selectedChildren.push(model.selectedItem); // close overlay vm.overlay.show = false; vm.overlay = null; } }; } function removeChild($index) { vm.selectedChildren.splice($index, 1); } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} selectedChildren (<code>binding</code>): Array of selected children. @param {array} availableChildren (<code>binding</code>: Array of items available for selection. @param {string} parentName (<code>binding</code>): The parent name. @param {string} parentIcon (<code>binding</code>): The parent icon. @param {number} parentId (<code>binding</code>): The parent id. @param {callback} onRemove (<code>binding</code>): Callback when removing an item. <h3>The callback returns:</h3> <ul> <li><code>child</code>: The selected item.</li> <li><code>$index</code>: The selected item index.</li> </ul> @param {callback} onAdd (<code>binding</code>): Callback when adding an item. <h3>The callback returns:</h3> <ul> <li><code>$event</code>: The select event.</li> </ul> @param {callback} onSort (<code>binding</code>): Callback when sorting an item. <h3>The callback returns:</h3> <ul> <li><code>$event</code>: The select event.</li> </ul> **/ (function() { 'use strict'; function ChildSelectorDirective() { function link(scope, el, attr, ctrl) { var eventBindings = []; scope.dialogModel = {}; scope.showDialog = false; scope.removeChild = function(selectedChild, $index) { if(scope.onRemove) { scope.onRemove(selectedChild, $index); } }; scope.addChild = function($event) { if(scope.onAdd) { scope.onAdd($event); } }; function syncParentName() { // update name on available item angular.forEach(scope.availableChildren, function(availableChild){ if(availableChild.id === scope.parentId) { availableChild.name = scope.parentName; } }); // update name on selected child angular.forEach(scope.selectedChildren, function(selectedChild){ if(selectedChild.id === scope.parentId) { selectedChild.name = scope.parentName; } }); } function syncParentIcon() { // update icon on available item angular.forEach(scope.availableChildren, function(availableChild){ if(availableChild.id === scope.parentId) { availableChild.icon = scope.parentIcon; } }); // update icon on selected child angular.forEach(scope.selectedChildren, function(selectedChild){ if(selectedChild.id === scope.parentId) { selectedChild.icon = scope.parentIcon; } }); } eventBindings.push(scope.$watch('parentName', function(newValue, oldValue){ if (newValue === oldValue) { return; } if (oldValue === undefined || newValue === undefined) { return; } syncParentName(); })); eventBindings.push(scope.$watch('parentIcon', function(newValue, oldValue){ if (newValue === oldValue) { return; } if (oldValue === undefined || newValue === undefined) { return; } syncParentIcon(); })); // sortable options for allowed child content types scope.sortableOptions = { axis: "y", cancel: ".unsortable", containment: "parent", distance: 10, opacity: 0.7, tolerance: "pointer", scroll: true, zIndex: 6000, update: function (e, ui) { if(scope.onSort) { scope.onSort(); } } }; // clean up scope.$on('$destroy', function(){ // unbind watchers for(var e in eventBindings) { eventBindings[e](); } }); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-child-selector.html', scope: { selectedChildren: '=', availableChildren: "=", parentName: "=", parentIcon: "=", parentId: "=", onRemove: "=", onAdd: "=", onSort: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbChildSelector', ChildSelectorDirective); })();
dawoe/Umbraco-CMS
src/Umbraco.Web.UI.Client/src/common/directives/components/umbchildselector.directive.js
JavaScript
mit
7,289
#include <iostream> #include <vector> using namespace std; int main() { int n = 50000000; vector<int> p(n + 1); vector<int> prime; for (int i = 2; i < n; ++i) if (p[i] == 0) { for (int j = 2 * i; j < n; j += i) p[j] = 1; prime.push_back(i); } int ans = 0; for (int i = 0; i < prime.size(); ++i) { if (prime[i] * 4 < n) ++ans; if (prime[i] * 16 < n) ++ans; if ((prime[i] - 3) % 4 == 0) ++ans; } cout << ans << endl; }
EdisonAlgorithms/ProjectEuler
vol3/136.cpp
C++
mit
493
'use strict' var fs = require('graceful-fs') var path = require('path') var mkdirpSync = require('mkdirp').sync var rimraf = require('rimraf') var test = require('tap').test var common = require('../common-tap.js') var base = common.pkg var cruft = path.join(base, 'node_modules', 'cruuuft') var pkg = { name: 'example', version: '1.0.0', dependencies: {} } function setup () { mkdirpSync(path.dirname(cruft)) fs.writeFileSync(cruft, 'this is some cruft for sure') fs.writeFileSync(path.join(base, 'package.json'), JSON.stringify(pkg)) } function cleanup () { rimraf.sync(base) } test('setup', function (t) { cleanup() setup() t.done() }) test('cruft', function (t) { common.npm(['ls'], {cwd: base}, function (er, code, stdout, stderr) { t.is(stderr, '', 'no warnings or errors from ls') t.done() }) }) test('cleanup', function (t) { cleanup() t.done() })
enclose-io/compiler
lts/deps/npm/test/tap/cruft-test.js
JavaScript
mit
898
// This code is distributed under MIT license. // Copyright (c) 2014 George Mamaladze // See license.txt or http://opensource.org/licenses/mit-license.php #region usings using System; #endregion namespace Gma.Netmf.Hardware.Lego.PowerFunctions.Communication { /// <summary> /// This class is responsible for translating data packages into /// 38 kHz infrared light pulses. /// </summary> internal static class IrPulseEncoder { private const short MaxEncodedMessageSize = 522; private const short HighIrPulseCount = 6; private const short LowIrPulseCountFor0 = 10; private const short LowIrPulseCountFor1 = 21; private const short LowIrPulseCountForStartStop = 39; public static ushort[] Encode(ushort data) { var buffer = new ushort[MaxEncodedMessageSize]; ushort currentDataMask = 0x8000; short currentPulse = 0; currentPulse = FillStartStop(buffer, currentPulse); while (currentDataMask != 0) { var currentDataBit = (data & currentDataMask) == 0; currentPulse = FillBit(currentDataBit, currentPulse, buffer); currentDataMask >>= 1; } //stop bit short finalPulseCount = Fill(buffer, currentPulse, HighIrPulseCount, 39); var result = Trim(buffer, finalPulseCount); return result; } private static short FillBit(bool currentDataBit, short currentPulse, ushort[] buffer) { var lowPulseCount = currentDataBit ? LowIrPulseCountFor0 : LowIrPulseCountFor1; currentPulse = Fill(buffer, currentPulse, HighIrPulseCount, lowPulseCount); return currentPulse; } private static short FillStartStop(ushort[] buffer, short startIndex) { return Fill(buffer, startIndex, HighIrPulseCount, LowIrPulseCountForStartStop); } private static ushort[] Trim(ushort[] buffer, short finalLength) { var result = new ushort[finalLength]; Array.Copy(buffer, result, finalLength); return result; } private static short Fill(ushort[] buffer, short startIndex, short pulseCount, IrPulse irPulse) { short i; for (i = startIndex; i < startIndex + pulseCount; i++) { buffer[i] = (ushort) irPulse; } return i; } private static short Fill(ushort[] buffer, short startIndex, short highPulseCount, short lowPulseCount) { short currentIndex = startIndex; currentIndex = Fill(buffer, currentIndex, highPulseCount, IrPulse.High); currentIndex = Fill(buffer, currentIndex, lowPulseCount, IrPulse.Low); return currentIndex; } } }
gmamaladze/lego-rc-ms-iot
Lego.PowerFunctions/Communication/IrPulseEncoder.cs
C#
mit
2,904
using System; using System.Collections.Generic; using System.Text; using FlatRedBall.Math.Geometry; using FlatRedBall.Graphics; using System.Drawing; namespace EditorObjects.Hud { public class TextWidthHandles { Line mLeftLine; Line mTopSolidLine; Line mBottomSolidLine; Line mTopSoftLine; Line mBottomSoftLine; Line mRightLine; AxisAlignedRectangle mRightBox; public Text Text { get; set; } public void UpdateVisibility() { if (Text == null) { mLeftLine.Visible = false; mTopSolidLine.Visible = false; mBottomSolidLine.Visible = false; mTopSoftLine.Visible = false; mBottomSoftLine.Visible = false; mRightLine.Visible = false; mRightBox.Visible = false; } else { mLeftLine.Visible = true; mTopSolidLine.Visible = true; mBottomSolidLine.Visible = true; if (float.IsPositiveInfinity(Text.MaxWidth)) { mTopSoftLine.Visible = true; mBottomSoftLine.Visible = true; mRightLine.Visible = false; } else { mTopSoftLine.Visible = false; mBottomSoftLine.Visible = false; mRightLine.Visible = true; } } } public void UpdatePositions() { float scaleX = Text.MaxWidth/2.0f; if (float.IsPositiveInfinity(Text.MaxWidth)) { scaleX = Text.ScaleX; } scaleX *= 1.01f; float horizontalCenter = Text.HorizontalCenter - Text.ScaleX + scaleX; float left = horizontalCenter - scaleX; float right = horizontalCenter + scaleX; mLeftLine.X = left; mLeftLine.Y = Text.VerticalCenter; mLeftLine.RelativePoint1.Y = Text.ScaleY; mLeftLine.RelativePoint2.Y = -Text.ScaleY; mLeftLine.RelativePoint1.X = 0; mLeftLine.RelativePoint2.X = 0; mRightLine.X = right; mRightLine.Y = Text.VerticalCenter; mRightLine.RelativePoint1.Y = Text.ScaleY; mRightLine.RelativePoint2.Y = -Text.ScaleY; mRightLine.RelativePoint1.X = 0; mRightLine.RelativePoint2.X = 0; mTopSolidLine.X = horizontalCenter; mTopSolidLine.Y = Text.VerticalCenter + Text.ScaleY; mTopSolidLine.RelativePoint1.X = -scaleX; mTopSolidLine.RelativePoint2.X = scaleX; mBottomSolidLine.X = horizontalCenter; mBottomSolidLine.Y = Text.VerticalCenter - Text.ScaleY; mBottomSolidLine.RelativePoint1.X = -scaleX; mBottomSolidLine.RelativePoint2.X = scaleX; mTopSoftLine.Y = mTopSolidLine.Y; mTopSoftLine.X = right + 1; mBottomSoftLine.Y = mBottomSolidLine.Y; mBottomSoftLine.X = right + 1; mLeftLine.Z = Text.Z; mRightLine.Z = Text.Z; mTopSolidLine.Z = Text.Z; mBottomSolidLine.Z = Text.Z; mTopSoftLine.Z = Text.Z; mBottomSoftLine.Z = Text.Z; } public TextWidthHandles() { mLeftLine = ShapeManager.AddLine(); mTopSolidLine = ShapeManager.AddLine(); mBottomSolidLine = ShapeManager.AddLine(); mTopSoftLine = ShapeManager.AddLine(); mBottomSoftLine = ShapeManager.AddLine(); mRightLine = ShapeManager.AddLine(); mRightBox = ShapeManager.AddAxisAlignedRectangle(); mLeftLine.Color = Color.Green; mTopSolidLine.Color = Color.Green; mBottomSolidLine.Color = Color.Green; mRightLine.Color = Color.Green; #if FRB_MDX mTopSoftLine.Color = Color.FromArgb( 128, Color.Green); mBottomSoftLine.Color = mTopSoftLine.Color; #else throw new NotImplementedException(); #endif mRightBox.Color = Color.Orange; } public void Update() { UpdateVisibility(); if (Text != null) { UpdatePositions(); } } } }
GorillaOne/FlatRedBall
FRBDK/FRBDK Supporting Projects/EditorObjects/Hud/TextWidthHandles.cs
C#
mit
4,566
/* * Copyright 2011-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.s3.transfer; import com.amazonaws.annotation.NotThreadSafe; import com.amazonaws.annotation.SdkTestInternalApi; import com.amazonaws.client.builder.ExecutorFactory; import com.amazonaws.internal.SdkFunction; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.transfer.internal.TransferManagerUtils; import java.util.concurrent.ExecutorService; /** * Fluent builder for {@link TransferManager}. Use of the builder is preferred over constructors in * the TransferManager class. **/ @NotThreadSafe public final class TransferManagerBuilder { private static final SdkFunction<TransferManagerParams, TransferManager> DEFAULT_TRANSFER_MANAGER_FACTORY = new SdkFunction<TransferManagerParams, TransferManager>() { @Override public TransferManager apply(TransferManagerParams params) { return new TransferManager(params); } }; private final SdkFunction<TransferManagerParams, TransferManager> transferManagerFactory; private AmazonS3 s3Client; private ExecutorFactory executorFactory; private Boolean shutDownThreadPools; private Long minimumUploadPartSize; private Long multipartUploadThreshold; private Long multipartCopyThreshold; private Long multipartCopyPartSize; private Boolean disableParallelDownloads; /** * @return Create new instance of builder with all defaults set. */ public static TransferManagerBuilder standard() { return new TransferManagerBuilder(); } /** * @return Default TransferManager with default configuration. Uses {@link * AmazonS3ClientBuilder} to create a default {@link AmazonS3} client implementation. */ public static TransferManager defaultTransferManager() { return standard().build(); } private TransferManagerBuilder() { this(DEFAULT_TRANSFER_MANAGER_FACTORY); } @SdkTestInternalApi TransferManagerBuilder( SdkFunction<TransferManagerParams, TransferManager> transferManagerFactory) { this.transferManagerFactory = transferManagerFactory; } /** * @return The low level client currently configured in the builder. */ public final AmazonS3 getS3Client() { return s3Client; } /** * Sets the low level client used to make the service calls to Amazon S3. * * @param s3Client Client implementation to use */ public final void setS3Client(AmazonS3 s3Client) { this.s3Client = s3Client; } /** * Sets the low level client used to make the service calls to Amazon S3. * * @param s3Client Client implementation to use * @return This object for method chaining. */ public final TransferManagerBuilder withS3Client(AmazonS3 s3Client) { setS3Client(s3Client); return this; } private AmazonS3 resolveS3Client() { return s3Client == null ? AmazonS3ClientBuilder.defaultClient() : s3Client; } /** * @return The {@link ExecutorFactory} currently configured in the builder. */ public final ExecutorFactory getExecutorFactory() { return executorFactory; } /** * Sets a new {@link ExecutorFactory} for the builder. The factory is invoked for each transfer * manager created through the builder. * * @param executorFactory New executor factory to use. */ public final void setExecutorFactory(ExecutorFactory executorFactory) { this.executorFactory = executorFactory; } /** * Sets a new {@link ExecutorFactory} for the builder. The factory is invoked for each transfer * manager created through the builder. * * @param executorFactory New executor factory to use. * @return This object for method chaining. */ public final TransferManagerBuilder withExecutorFactory(ExecutorFactory executorFactory) { setExecutorFactory(executorFactory); return this; } private ExecutorService resolveExecutorService() { return executorFactory == null ? TransferManagerUtils.createDefaultExecutorService() : executorFactory.newExecutor(); } /** * @return Current configured option on how thread pools should be managed when transfer manager * is shut down. */ public final Boolean isShutDownThreadPools() { return shutDownThreadPools; } /** * By default, when the transfer manager is shut down, the underlying {@link ExecutorService} is * also shut down. For cases where the same thread pool is reused across different workloads you * can set this option to false to disable that behavior. * * @param shutDownThreadPools True to shut down thread pools on transfer manager shutdown, false * otherwise. */ public final void setShutDownThreadPools(Boolean shutDownThreadPools) { this.shutDownThreadPools = shutDownThreadPools; } /** * By default, when the transfer manager is shut down, the underlying {@link ExecutorService} is * also shut down. For cases where the same thread pool is reused across different workloads you * can set this option to false to disable that behavior. * * @param shutDownThreadPools True to shut down thread pools on transfer manager shutdown, false * otherwise. * @return This object for method chaining. */ public final TransferManagerBuilder withShutDownThreadPools(Boolean shutDownThreadPools) { setShutDownThreadPools(shutDownThreadPools); return this; } private Boolean resolveShutDownThreadPools() { return shutDownThreadPools == null ? Boolean.TRUE : shutDownThreadPools; } /** * @return The minimum upload part size currently configured in the builder. */ public final Long getMinimumUploadPartSize() { return minimumUploadPartSize; } /** * Sets the minimum part size for upload parts. Decreasing the minimum part size will cause * multipart uploads to be split into a larger number of smaller parts. Setting this value too * low can have a negative effect on transfer speeds since it will cause extra latency and * network communication for each part. * * @param minimumUploadPartSize New minimum threshold for upload part size */ public final void setMinimumUploadPartSize(Long minimumUploadPartSize) { this.minimumUploadPartSize = minimumUploadPartSize; } /** * Sets the minimum part size for upload parts. Decreasing the minimum part size will cause * multipart uploads to be split into a larger number of smaller parts. Setting this value too * low can have a negative effect on transfer speeds since it will cause extra latency and * network communication for each part. * * @param minimumUploadPartSize New minimum threshold for upload part size * @return This object for method chaining. */ public final TransferManagerBuilder withMinimumUploadPartSize(Long minimumUploadPartSize) { setMinimumUploadPartSize(minimumUploadPartSize); return this; } /** * @return The multipart upload threshold currently configured in the builder. */ public final Long getMultipartUploadThreshold() { return multipartUploadThreshold; } /** * Sets the size threshold, in bytes, for when to use multipart uploads. Uploads over this size * will automatically use a multipart upload strategy, while uploads smaller than this threshold * will use a single connection to upload the whole object. * * <p>Multipart uploads are easier to recover from and also potentially faster than single part * uploads, especially when the upload parts can be uploaded in parallel as with files. Because * there is additional network communication, small uploads are still recommended to use a * single connection for the upload.</p> * * @param multipartUploadThreshold Threshold in which multipart uploads will be performed. */ public final void setMultipartUploadThreshold(Long multipartUploadThreshold) { this.multipartUploadThreshold = multipartUploadThreshold; } /** * Sets the size threshold, in bytes, for when to use multipart uploads. Uploads over this size * will automatically use a multipart upload strategy, while uploads smaller than this threshold * will use a single connection to upload the whole object. * * <p>Multipart uploads are easier to recover from and also potentially faster than single part * uploads, especially when the upload parts can be uploaded in parallel as with files. Because * there is additional network communication, small uploads are still recommended to use a * single connection for the upload.</p> * * @param multipartUploadThreshold Threshold in which multipart uploads will be performed. * @return This object for method chaining. */ public final TransferManagerBuilder withMultipartUploadThreshold( Long multipartUploadThreshold) { setMultipartUploadThreshold(multipartUploadThreshold); return this; } /** * @return The multipart copy threshold currently configured in the builder. */ public final Long getMultipartCopyThreshold() { return multipartCopyThreshold; } /** * Sets the size threshold, in bytes, for when to use multi-part copy. Copy requests for objects * over this size will automatically use a multi-part copy strategy, while copy requests for * objects smaller than this threshold will use a single connection to copy the whole object. * * @param multipartCopyThreshold Threshold in which multipart copies will be performed. */ public final void setMultipartCopyThreshold(Long multipartCopyThreshold) { this.multipartCopyThreshold = multipartCopyThreshold; } /** * Sets the size threshold, in bytes, for when to use multi-part copy. Copy requests for objects * over this size will automatically use a multi-part copy strategy, while copy requests for * objects smaller than this threshold will use a single connection to copy the whole object. * * @param multipartCopyThreshold Threshold in which multipart copies will be performed. * @return This object for method chaining. */ public final TransferManagerBuilder withMultipartCopyThreshold(Long multipartCopyThreshold) { setMultipartCopyThreshold(multipartCopyThreshold); return this; } /** * @return The multipart copy part size currently configured in the builder. */ public final Long getMultipartCopyPartSize() { return multipartCopyPartSize; } /** * Sets the minimum size in bytes of each part when a multi-part copy operation is carried out. * Decreasing the minimum part size will cause a large number of copy part requests being * initiated. * * @param multipartCopyPartSize New minimum threshold for copy part size */ public final void setMultipartCopyPartSize(Long multipartCopyPartSize) { this.multipartCopyPartSize = multipartCopyPartSize; } /** * Sets the minimum size in bytes of each part when a multi-part copy operation is carried out. * Decreasing the minimum part size will cause a large number of copy part requests being * initiated. * * @param multipartCopyPartSize New minimum threshold for copy part size * @return This object for method chaining. */ public final TransferManagerBuilder withMultipartCopyPartSize(Long multipartCopyPartSize) { setMultipartCopyPartSize(multipartCopyPartSize); return this; } /** * Returns if the parallel downloads are disabled or not. By default, the value is set to false. * * <p> * TransferManager automatically detects and downloads a multipart object * in parallel. Setting this option to true will disable parallel downloads. * </p> * <p> * During parallel downloads, each part is downloaded to a temporary file, gets merged * into the final destination file and will be deleted. These temporary files uses disk space temporarily. * Disable parallel downloads if your system do not have enough space to store these files during download. * </p> * <p> * Disabling parallel downloads might reduce performance for large files. * </p> * * @return true if parallel downloads are disabled, otherwise false. */ public Boolean isDisableParallelDownloads() { return disableParallelDownloads; } /** * Sets the option to disable parallel downloads. By default, the value is set to false. * * <p> * TransferManager automatically detects and downloads a multipart object * in parallel. Setting this option to true will disable parallel downloads. * </p> * <p> * During parallel downloads, each part is downloaded to a temporary file, gets merged * into the final destination file and will be deleted. These temporary files uses disk space temporarily. * Disable parallel downloads if your system do not have enough space to store these files during download. * </p> * <p> * Disabling parallel downloads might reduce performance for large files. * </p> * * @param disableParallelDownloads boolean value to disable parallel downloads. */ public void setDisableParallelDownloads(Boolean disableParallelDownloads) { this.disableParallelDownloads = disableParallelDownloads; } /** * Sets the option to disable parallel downloads. By default, the value is set to false. * * <p> * TransferManager automatically detects and downloads a multipart object * in parallel. Setting this option to true will disable parallel downloads. * </p> * <p> * During parallel downloads, each part is downloaded to a temporary file, gets merged * into the final destination file and will be deleted. These temporary files uses disk space temporarily. * Disable parallel downloads if your system do not have enough space to store these files during download. * </p> * <p> * Disabling parallel downloads might reduce performance for large files. * </p> * * @param disableParallelDownloads boolean value to disable parallel downloads. * @return this object for method changing */ public TransferManagerBuilder withDisableParallelDownloads(Boolean disableParallelDownloads) { setDisableParallelDownloads(disableParallelDownloads); return this; } /** * Disables parallel downloads, see {@link #setDisableParallelDownloads(Boolean)} * <p> * Disabling parallel downloads might reduce performance for large files. * </p> * * @return This object for method chaining */ public TransferManagerBuilder disableParallelDownloads() { return withDisableParallelDownloads(Boolean.TRUE); } private TransferManagerConfiguration resolveConfiguration() { TransferManagerConfiguration configuration = new TransferManagerConfiguration(); if (this.minimumUploadPartSize != null) { configuration.setMinimumUploadPartSize(minimumUploadPartSize); } if (this.multipartCopyPartSize != null) { configuration.setMultipartCopyPartSize(multipartCopyPartSize); } if (this.multipartCopyThreshold != null) { configuration.setMultipartCopyThreshold(multipartCopyThreshold); } if (this.multipartUploadThreshold != null) { configuration.setMultipartUploadThreshold(multipartUploadThreshold); } if (this.disableParallelDownloads != null) { configuration.setDisableParallelDownloads(disableParallelDownloads); } return configuration; } TransferManagerParams getParams() { return new TransferManagerParams().withS3Client(resolveS3Client()) .withExecutorService(resolveExecutorService()) .withShutDownThreadPools(resolveShutDownThreadPools()) .withTransferManagerConfiguration(resolveConfiguration()); } /** * Construct a TransferManager with the default ExecutorService. * * @return TransferManager with configured AmazonS3 client. */ public final TransferManager build() { return transferManagerFactory.apply(getParams()); } }
loremipsumdolor/CastFast
src/com/amazonaws/services/s3/transfer/TransferManagerBuilder.java
Java
mit
17,389
var _INCLUDED = false; module.exports = function() { var BandRenderer = require('../../../core/renderers/band_renderer.js'); if (_INCLUDED) { return BandRenderer; } _INCLUDED = true; // cached state object, for quick access during rendering, populated in begin() method: BandRenderer.hasA("state"); BandRenderer.respondsTo("begin", function (context) { var state = { "context" : context, "run" : [], "linecolor" : this.getOptionValue("linecolor"), "line1color" : this.getOptionValue("line1color"), "line2color" : this.getOptionValue("line2color"), "linewidth" : this.getOptionValue("linewidth"), "line1width" : this.getOptionValue("line1width"), "line2width" : this.getOptionValue("line2width"), "fillcolor" : this.getOptionValue("fillcolor"), "fillopacity" : this.getOptionValue("fillopacity") }; this.state(state); }); // This renderer's dataPoint() method works by accumulating // and drawing one "run" of data points at a time. A "run" of // points consists of a consecutive sequence of non-missing // data points which have the same fill color. (The fill // color can change if the data line crosses the fill base // line, if the downfillcolor is different from the // fillcolor.) BandRenderer.respondsTo("dataPoint", function (datap) { var state = this.state(); if (this.isMissing(datap)) { // if this is a missing point, render and reset the current run, if any if (state.run.length > 0) { this.renderRun(); state.run = []; } } else { // otherwise, transform point to pixel coords var p = this.transformPoint(datap); // and add it to the current run state.run.push(p); } }); BandRenderer.respondsTo("end", function () { var state = this.state(); // render the current run, if any if (state.run.length > 0) { this.renderRun(); } }); /* * Private utility function to stroke line segments connecting the points of a run */ var strokeRunLine = function(context, run, whichLine, color, defaultColor, width, defaultWidth) { var i; width = (width >= 0) ? width : defaultWidth; if (width > 0) { color = (color !== null) ? color : defaultColor; context.save(); context.strokeStyle = color.getHexString("#"); context.lineWidth = width; context.beginPath(); context.moveTo(run[0][0], run[0][whichLine]); for (i = 1; i < run.length; ++i) { context.lineTo(run[i][0], run[i][whichLine]); } context.stroke(); context.restore(); } }; // Render the current run of data points. This consists of drawing the fill region // in the band between the two data lines, and connecting the points of each data line // with lines of the appropriate color. BandRenderer.respondsTo("renderRun", function () { var state = this.state(), context = state.context, run = state.run, i; // fill the run context.save(); context.globalAlpha = state.fillopacity; context.fillStyle = state.fillcolor.getHexString("#"); context.beginPath(); // trace to the right along line 1 context.moveTo(run[0][0], run[0][1]); for (i = 1; i < run.length; ++i) { context.lineTo(run[i][0], run[i][1]); } // trace back to the left along line 2 context.lineTo(run[run.length-1][0], run[run.length-1][2]); for (i = run.length-1; i >= 0; --i) { context.lineTo(run[i][0], run[i][2]); } context.fill(); context.restore(); // stroke line1 strokeRunLine(context, run, 1, state.line1color, state.linecolor, state.line1width, state.linewidth); // stroke line2 strokeRunLine(context, run, 2, state.line2color, state.linecolor, state.line2width, state.linewidth); }); BandRenderer.respondsTo("renderLegendIcon", function (context, x, y, icon) { var state = this.state(), iconWidth = icon.width(), iconHeight = icon.height(); context.save(); context.transform(1, 0, 0, 1, x, y); context.save(); // Draw icon background (with opacity) if (iconWidth < 10 || iconHeight < 10) { context.fillStyle = state.fillcolor.toRGBA(); } else { context.fillStyle = "#FFFFFF"; } context.fillRect(0, 0, iconWidth, iconHeight); context.restore(); // Draw icon graphics context.strokeStyle = (state.line2color !== null) ? state.line2color : state.linecolor; context.lineWidth = (state.line2width >= 0) ? state.line2width : state.linewidth; context.fillStyle = state.fillcolor.toRGBA(state.fillopacity); context.beginPath(); context.moveTo(0, 2*iconHeight/8); context.lineTo(0, 6*iconHeight/8); context.lineTo(iconWidth, 7*iconHeight/8); context.lineTo(iconWidth, 3*iconHeight/8); context.lineTo(0, 2*iconHeight/8); context.fill(); context.stroke(); context.restore(); }); return BandRenderer; };
henhouse/js-multigraph
src/graphics/canvas/renderers/band_renderer.js
JavaScript
mit
5,655
/******************************************************************************/ /* Copyright (c) 2013-2022 VectorChief (at github, bitbucket, sourceforge) */ /* Distributed under the MIT software license, see the accompanying */ /* file COPYING or http://www.opensource.org/licenses/mit-license.php */ /******************************************************************************/ #ifndef RT_RTARCH_M32_128X2V1_H #define RT_RTARCH_M32_128X2V1_H #include "rtarch_m64.h" #define RT_SIMD_REGS_256 16 /******************************************************************************/ /********************************* LEGEND *********************************/ /******************************************************************************/ /* * rtarch_m32_128x2v1.h: Implementation of MIPS32 fp32 MSA instruction pairs. * * This file is a part of the unified SIMD assembler framework (rtarch.h) * designed to be compatible with different processor architectures, * while maintaining strictly defined common API. * * Recommended naming scheme for instructions: * * cmdp*_ri - applies [cmd] to [p]acked: [r]egister from [i]mmediate * cmdp*_rr - applies [cmd] to [p]acked: [r]egister from [r]egister * * cmdp*_rm - applies [cmd] to [p]acked: [r]egister from [m]emory * cmdp*_ld - applies [cmd] to [p]acked: as above * * cmdi*_** - applies [cmd] to 32-bit elements SIMD args, packed-128-bit * cmdj*_** - applies [cmd] to 64-bit elements SIMD args, packed-128-bit * cmdl*_** - applies [cmd] to L-size elements SIMD args, packed-128-bit * * cmdc*_** - applies [cmd] to 32-bit elements SIMD args, packed-256-bit * cmdd*_** - applies [cmd] to 64-bit elements SIMD args, packed-256-bit * cmdf*_** - applies [cmd] to L-size elements SIMD args, packed-256-bit * * cmdo*_** - applies [cmd] to 32-bit elements SIMD args, packed-var-len * cmdp*_** - applies [cmd] to L-size elements SIMD args, packed-var-len * cmdq*_** - applies [cmd] to 64-bit elements SIMD args, packed-var-len * * cmdr*_** - applies [cmd] to 32-bit elements ELEM args, scalar-fp-only * cmds*_** - applies [cmd] to L-size elements ELEM args, scalar-fp-only * cmdt*_** - applies [cmd] to 64-bit elements ELEM args, scalar-fp-only * * cmd*x_** - applies [cmd] to SIMD/BASE unsigned integer args, [x] - default * cmd*n_** - applies [cmd] to SIMD/BASE signed integer args, [n] - negatable * cmd*s_** - applies [cmd] to SIMD/ELEM floating point args, [s] - scalable * * The cmdp*_** (rtconf.h) instructions are intended for SPMD programming model * and can be configured to work with 32/64-bit data elements (fp+int). * In this model data paths are fixed-width, BASE and SIMD data elements are * width-compatible, code path divergence is handled via mkj**_** pseudo-ops. * Matching element-sized BASE subset cmdy*_** is defined in rtconf.h as well. * * Note, when using fixed-data-size 128/256-bit SIMD subsets simultaneously * upper 128-bit halves of full 256-bit SIMD registers may end up undefined. * On RISC targets they remain unchanged, while on x86-AVX they are zeroed. * This happens when registers written in 128-bit subset are then used/read * from within 256-bit subset. The same rule applies to mixing with 512-bit * and wider vectors. Use of scalars may leave respective vector registers * undefined, as seen from the perspective of any particular vector subset. * * 256-bit vectors used with wider subsets may not be compatible with regards * to memory loads/stores when mixed in the code. It means that data loaded * with wider vector and stored within 256-bit subset at the same address may * result in changing the initial representation in memory. The same can be * said about mixing vector and scalar subsets. Scalars can be completely * detached on some architectures. Use elm*x_st to store 1st vector element. * 128-bit vectors should be memory-compatible with any wider vector subset. * * Handling of NaNs in the floating point pipeline may not be consistent * across different architectures. Avoid NaNs entering the data flow by using * masking or control flow instructions. Apply special care when dealing with * floating point compare and min/max input/output. The result of floating point * compare instructions can be considered a -QNaN, though it is also interpreted * as integer -1 and is often treated as a mask. Most arithmetic instructions * should propagate QNaNs unchanged, however this behavior hasn't been tested. * * Note, that instruction subsets operating on vectors of different length * may support different number of SIMD registers, therefore mixing them * in the same code needs to be done with register awareness in mind. * For example, AVX-512 supports 32 SIMD registers, while AVX2 only has 16, * as does 256-bit paired subset on ARMv8, while 128-bit and SVE have 32. * These numbers should be consistent across architectures if properly * mapped to SIMD target mask presented in rtzero.h (compatibility layer). * * Interpretation of instruction parameters: * * upper-case params have triplet structure and require W to pass-forward * lower-case params are singular and can be used/passed as such directly * * XD - SIMD register serving as destination only, if present * XG - SIMD register serving as destination and first source * XS - SIMD register serving as second source (first if any) * XT - SIMD register serving as third source (second if any) * * RD - BASE register serving as destination only, if present * RG - BASE register serving as destination and first source * RS - BASE register serving as second source (first if any) * RT - BASE register serving as third source (second if any) * * MD - BASE addressing mode (Oeax, M***, I***) (memory-dest) * MG - BASE addressing mode (Oeax, M***, I***) (memory-dsrc) * MS - BASE addressing mode (Oeax, M***, I***) (memory-src2) * MT - BASE addressing mode (Oeax, M***, I***) (memory-src3) * * DD - displacement value (DP, DF, DG, DH, DV) (memory-dest) * DG - displacement value (DP, DF, DG, DH, DV) (memory-dsrc) * DS - displacement value (DP, DF, DG, DH, DV) (memory-src2) * DT - displacement value (DP, DF, DG, DH, DV) (memory-src3) * * IS - immediate value (is used as a second or first source) * IT - immediate value (is used as a third or second source) */ /******************************************************************************/ /******************************** INTERNAL ********************************/ /******************************************************************************/ #if (defined RT_SIMD_CODE) #if (RT_128X2 != 0) && (RT_SIMD_COMPAT_XMM > 0) #ifndef RT_RTARCH_M64_128X1V1_H #undef RT_128X1 #define RT_128X1 RT_128X2 #include "rtarch_m64_128x1v1.h" #endif /* RT_RTARCH_M64_128X1V1_H */ /******************************************************************************/ /******************************** EXTERNAL ********************************/ /******************************************************************************/ /******************************************************************************/ /********************************** SIMD **********************************/ /******************************************************************************/ /* elm (D = S), store first SIMD element with natural alignment * allows to decouple scalar subset from SIMD where appropriate */ #define elmcx_st(XS, MD, DD) /* 1st elem as in mem with SIMD load/store */ \ elmix_st(W(XS), W(MD), W(DD)) /*************** packed single-precision generic move/logic ***************/ /* mov (D = S) */ #define movcx_rr(XD, XS) \ EMITW(0x78BE0019 | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x78BE0019 | MXM(RYG(XD), RYG(XS), 0x00)) #define movcx_ld(XD, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(REG(XD), MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(REG(XD), REG(XD), 0x00))) \ EMITW(0x78000022 | MFM(RYG(XD), MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(RYG(XD), RYG(XD), 0x00))) #define movcx_st(XS, MD, DD) \ AUW(SIB(MD), EMPTY, EMPTY, MOD(MD), VAL(DD), A2(DD), EMPTY2) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, REG(XS), 0x00))) \ SHF(EMITW(0x78000026 | MFM(TmmM, MOD(MD), VAL(DD), B4(DD), K2(DD)))) \ SHX(EMITW(0x78000026 | MFM(REG(XS), MOD(MD), VAL(DD), B4(DD), K2(DD)))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, RYG(XS), 0x00))) \ SJF(EMITW(0x78000026 | MFM(TmmM, MOD(MD), VYL(DD), B4(DD), K2(DD)))) \ SJX(EMITW(0x78000026 | MFM(RYG(XS), MOD(MD), VYL(DD), B4(DD), K2(DD)))) /* mmv (G = G mask-merge S) where (mask-elem: 0 keeps G, -1 picks S) * uses Xmm0 implicitly as a mask register, destroys Xmm0, 0-masked XS elems */ #define mmvcx_rr(XG, XS) \ EMITW(0x7880001E | MXM(REG(XG), REG(XS), Tmm0)) \ EMITW(0x7880001E | MXM(RYG(XG), RYG(XS), Tmm0+16)) #define mmvcx_ld(XG, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001E | MXM(REG(XG), TmmM, Tmm0)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001E | MXM(RYG(XG), TmmM, Tmm0+16)) #define mmvcx_st(XS, MG, DG) \ AUW(SIB(MG), EMPTY, EMPTY, MOD(MG), VAL(DG), A2(DG), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MG), VAL(DG), B4(DG), K2(DG))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001E | MXM(TmmM, REG(XS), Tmm0)) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78000026 | MFM(TmmM, MOD(MG), VAL(DG), B4(DG), K2(DG))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MG), VYL(DG), B4(DG), K2(DG))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001E | MXM(TmmM, RYG(XS), Tmm0+16)) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78000026 | MFM(TmmM, MOD(MG), VYL(DG), B4(DG), K2(DG))) /* and (G = G & S), (D = S & T) if (#D != #T) */ #define andcx_rr(XG, XS) \ andcx3rr(W(XG), W(XG), W(XS)) #define andcx_ld(XG, MS, DS) \ andcx3ld(W(XG), W(XG), W(MS), W(DS)) #define andcx3rr(XD, XS, XT) \ EMITW(0x7800001E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7800001E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define andcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7800001E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7800001E | MXM(RYG(XD), RYG(XS), TmmM)) /* ann (G = ~G & S), (D = ~S & T) if (#D != #T) */ #define anncx_rr(XG, XS) \ EMITW(0x78C0001E | MXM(REG(XG), REG(XS), TmmZ)) \ EMITW(0x78C0001E | MXM(RYG(XG), RYG(XS), TmmZ)) #define anncx_ld(XG, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001E | MXM(REG(XG), TmmM, TmmZ)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001E | MXM(RYG(XG), TmmM, TmmZ)) #define anncx3rr(XD, XS, XT) \ movcx_rr(W(XD), W(XS)) \ anncx_rr(W(XD), W(XT)) #define anncx3ld(XD, XS, MT, DT) \ movcx_rr(W(XD), W(XS)) \ anncx_ld(W(XD), W(MT), W(DT)) /* orr (G = G | S), (D = S | T) if (#D != #T) */ #define orrcx_rr(XG, XS) \ orrcx3rr(W(XG), W(XG), W(XS)) #define orrcx_ld(XG, MS, DS) \ orrcx3ld(W(XG), W(XG), W(MS), W(DS)) #define orrcx3rr(XD, XS, XT) \ EMITW(0x7820001E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7820001E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define orrcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7820001E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7820001E | MXM(RYG(XD), RYG(XS), TmmM)) /* orn (G = ~G | S), (D = ~S | T) if (#D != #T) */ #define orncx_rr(XG, XS) \ notcx_rx(W(XG)) \ orrcx_rr(W(XG), W(XS)) #define orncx_ld(XG, MS, DS) \ notcx_rx(W(XG)) \ orrcx_ld(W(XG), W(MS), W(DS)) #define orncx3rr(XD, XS, XT) \ notcx_rr(W(XD), W(XS)) \ orrcx_rr(W(XD), W(XT)) #define orncx3ld(XD, XS, MT, DT) \ notcx_rr(W(XD), W(XS)) \ orrcx_ld(W(XD), W(MT), W(DT)) /* xor (G = G ^ S), (D = S ^ T) if (#D != #T) */ #define xorcx_rr(XG, XS) \ xorcx3rr(W(XG), W(XG), W(XS)) #define xorcx_ld(XG, MS, DS) \ xorcx3ld(W(XG), W(XG), W(MS), W(DS)) #define xorcx3rr(XD, XS, XT) \ EMITW(0x7860001E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7860001E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define xorcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7860001E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7860001E | MXM(RYG(XD), RYG(XS), TmmM)) /* not (G = ~G), (D = ~S) */ #define notcx_rx(XG) \ notcx_rr(W(XG), W(XG)) #define notcx_rr(XD, XS) \ EMITW(0x7840001E | MXM(REG(XD), TmmZ, REG(XS))) \ EMITW(0x7840001E | MXM(RYG(XD), TmmZ, RYG(XS))) /************ packed single-precision floating-point arithmetic ***********/ /* neg (G = -G), (D = -S) */ #define negcs_rx(XG) \ negcs_rr(W(XG), W(XG)) #define negcs_rr(XD, XS) \ movix_xm(Mebp, inf_GPC06_32) \ EMITW(0x7860001E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x7860001E | MXM(RYG(XD), RYG(XS), TmmM)) /* #define movix_xm(MS, DS) (defined in 32_128-bit header) */ /* add (G = G + S), (D = S + T) if (#D != #T) */ #define addcs_rr(XG, XS) \ addcs3rr(W(XG), W(XG), W(XS)) #define addcs_ld(XG, MS, DS) \ addcs3ld(W(XG), W(XG), W(MS), W(DS)) #define addcs3rr(XD, XS, XT) \ EMITW(0x7800001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7800001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define addcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7800001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7800001B | MXM(RYG(XD), RYG(XS), TmmM)) /* adp, adh are defined in rtbase.h (first 15-regs only) * under "COMMON SIMD INSTRUCTIONS" section */ /* sub (G = G - S), (D = S - T) if (#D != #T) */ #define subcs_rr(XG, XS) \ subcs3rr(W(XG), W(XG), W(XS)) #define subcs_ld(XG, MS, DS) \ subcs3ld(W(XG), W(XG), W(MS), W(DS)) #define subcs3rr(XD, XS, XT) \ EMITW(0x7840001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7840001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define subcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840001B | MXM(RYG(XD), RYG(XS), TmmM)) /* mul (G = G * S), (D = S * T) if (#D != #T) */ #define mulcs_rr(XG, XS) \ mulcs3rr(W(XG), W(XG), W(XS)) #define mulcs_ld(XG, MS, DS) \ mulcs3ld(W(XG), W(XG), W(MS), W(DS)) #define mulcs3rr(XD, XS, XT) \ EMITW(0x7880001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7880001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define mulcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001B | MXM(RYG(XD), RYG(XS), TmmM)) /* mlp, mlh are defined in rtbase.h * under "COMMON SIMD INSTRUCTIONS" section */ /* div (G = G / S), (D = S / T) if (#D != #T) and on ARMv7 if (#D != #S) */ #define divcs_rr(XG, XS) \ divcs3rr(W(XG), W(XG), W(XS)) #define divcs_ld(XG, MS, DS) \ divcs3ld(W(XG), W(XG), W(MS), W(DS)) #define divcs3rr(XD, XS, XT) \ EMITW(0x78C0001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x78C0001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define divcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001B | MXM(RYG(XD), RYG(XS), TmmM)) /* sqr (D = sqrt S) */ #define sqrcs_rr(XD, XS) \ EMITW(0x7B26001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B26001E | MXM(RYG(XD), RYG(XS), 0x00)) #define sqrcs_ld(XD, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B26001E | MXM(REG(XD), TmmM, 0x00)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B26001E | MXM(RYG(XD), TmmM, 0x00)) /* cbr (D = cbrt S) */ /* cbe, cbs, cbr are defined in rtbase.h * under "COMMON SIMD INSTRUCTIONS" section */ /* rcp (D = 1.0 / S) * accuracy/behavior may vary across supported targets, use accordingly */ #if RT_SIMD_COMPAT_RCP != 1 #define rcecs_rr(XD, XS) \ EMITW(0x7B2A001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B2A001E | MXM(RYG(XD), RYG(XS), 0x00)) #define rcscs_rr(XG, XS) /* destroys XS */ #endif /* RT_SIMD_COMPAT_RCP */ /* rce, rcs, rcp are defined in rtconf.h * under "COMMON SIMD INSTRUCTIONS" section */ /* rsq (D = 1.0 / sqrt S) * accuracy/behavior may vary across supported targets, use accordingly */ #if RT_SIMD_COMPAT_RSQ != 1 #define rsecs_rr(XD, XS) \ EMITW(0x7B28001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B28001E | MXM(RYG(XD), RYG(XS), 0x00)) #define rsscs_rr(XG, XS) /* destroys XS */ #endif /* RT_SIMD_COMPAT_RSQ */ /* rse, rss, rsq are defined in rtconf.h * under "COMMON SIMD INSTRUCTIONS" section */ /* fma (G = G + S * T) if (#G != #S && #G != #T) * NOTE: x87 fpu-fallbacks for fma/fms use round-to-nearest mode by default, * enable RT_SIMD_COMPAT_FMR for current SIMD rounding mode to be honoured */ #if RT_SIMD_COMPAT_FMA <= 1 #define fmacs_rr(XG, XS, XT) \ EMITW(0x7900001B | MXM(REG(XG), REG(XS), REG(XT))) \ EMITW(0x7900001B | MXM(RYG(XG), RYG(XS), RYG(XT))) #define fmacs_ld(XG, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001B | MXM(REG(XG), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001B | MXM(RYG(XG), RYG(XS), TmmM)) #endif /* RT_SIMD_COMPAT_FMA */ /* fms (G = G - S * T) if (#G != #S && #G != #T) * NOTE: due to final negation being outside of rounding on all POWER systems * only symmetric rounding modes (RN, RZ) are compatible across all targets */ #if RT_SIMD_COMPAT_FMS <= 1 #define fmscs_rr(XG, XS, XT) \ EMITW(0x7940001B | MXM(REG(XG), REG(XS), REG(XT))) \ EMITW(0x7940001B | MXM(RYG(XG), RYG(XS), RYG(XT))) #define fmscs_ld(XG, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940001B | MXM(REG(XG), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940001B | MXM(RYG(XG), RYG(XS), TmmM)) #endif /* RT_SIMD_COMPAT_FMS */ /************* packed single-precision floating-point compare *************/ /* min (G = G < S ? G : S), (D = S < T ? S : T) if (#D != #T) */ #define mincs_rr(XG, XS) \ mincs3rr(W(XG), W(XG), W(XS)) #define mincs_ld(XG, MS, DS) \ mincs3ld(W(XG), W(XG), W(MS), W(DS)) #define mincs3rr(XD, XS, XT) \ EMITW(0x7B00001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7B00001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define mincs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B00001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B00001B | MXM(RYG(XD), RYG(XS), TmmM)) /* mnp, mnh are defined in rtbase.h * under "COMMON SIMD INSTRUCTIONS" section */ /* max (G = G > S ? G : S), (D = S > T ? S : T) if (#D != #T) */ #define maxcs_rr(XG, XS) \ maxcs3rr(W(XG), W(XG), W(XS)) #define maxcs_ld(XG, MS, DS) \ maxcs3ld(W(XG), W(XG), W(MS), W(DS)) #define maxcs3rr(XD, XS, XT) \ EMITW(0x7B80001B | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7B80001B | MXM(RYG(XD), RYG(XS), RYG(XT))) #define maxcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B80001B | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B80001B | MXM(RYG(XD), RYG(XS), TmmM)) /* mxp, mxh are defined in rtbase.h * under "COMMON SIMD INSTRUCTIONS" section */ /* ceq (G = G == S ? -1 : 0), (D = S == T ? -1 : 0) if (#D != #T) */ #define ceqcs_rr(XG, XS) \ ceqcs3rr(W(XG), W(XG), W(XS)) #define ceqcs_ld(XG, MS, DS) \ ceqcs3ld(W(XG), W(XG), W(MS), W(DS)) #define ceqcs3rr(XD, XS, XT) \ EMITW(0x7880001A | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7880001A | MXM(RYG(XD), RYG(XS), RYG(XT))) #define ceqcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001A | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7880001A | MXM(RYG(XD), RYG(XS), TmmM)) /* cne (G = G != S ? -1 : 0), (D = S != T ? -1 : 0) if (#D != #T) */ #define cnecs_rr(XG, XS) \ cnecs3rr(W(XG), W(XG), W(XS)) #define cnecs_ld(XG, MS, DS) \ cnecs3ld(W(XG), W(XG), W(MS), W(DS)) #define cnecs3rr(XD, XS, XT) \ EMITW(0x78C0001C | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x78C0001C | MXM(RYG(XD), RYG(XS), RYG(XT))) #define cnecs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001C | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0001C | MXM(RYG(XD), RYG(XS), TmmM)) /* clt (G = G < S ? -1 : 0), (D = S < T ? -1 : 0) if (#D != #T) */ #define cltcs_rr(XG, XS) \ cltcs3rr(W(XG), W(XG), W(XS)) #define cltcs_ld(XG, MS, DS) \ cltcs3ld(W(XG), W(XG), W(MS), W(DS)) #define cltcs3rr(XD, XS, XT) \ EMITW(0x7900001A | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7900001A | MXM(RYG(XD), RYG(XS), RYG(XT))) #define cltcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001A | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001A | MXM(RYG(XD), RYG(XS), TmmM)) /* cle (G = G <= S ? -1 : 0), (D = S <= T ? -1 : 0) if (#D != #T) */ #define clecs_rr(XG, XS) \ clecs3rr(W(XG), W(XG), W(XS)) #define clecs_ld(XG, MS, DS) \ clecs3ld(W(XG), W(XG), W(MS), W(DS)) #define clecs3rr(XD, XS, XT) \ EMITW(0x7980001A | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7980001A | MXM(RYG(XD), RYG(XS), RYG(XT))) #define clecs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7980001A | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7980001A | MXM(RYG(XD), RYG(XS), TmmM)) /* cgt (G = G > S ? -1 : 0), (D = S > T ? -1 : 0) if (#D != #T) */ #define cgtcs_rr(XG, XS) \ cgtcs3rr(W(XG), W(XG), W(XS)) #define cgtcs_ld(XG, MS, DS) \ cgtcs3ld(W(XG), W(XG), W(MS), W(DS)) #define cgtcs3rr(XD, XS, XT) \ EMITW(0x7900001A | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x7900001A | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgtcs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001A | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7900001A | MXM(RYG(XD), TmmM, RYG(XS))) /* cge (G = G >= S ? -1 : 0), (D = S >= T ? -1 : 0) if (#D != #T) */ #define cgecs_rr(XG, XS) \ cgecs3rr(W(XG), W(XG), W(XS)) #define cgecs_ld(XG, MS, DS) \ cgecs3ld(W(XG), W(XG), W(MS), W(DS)) #define cgecs3rr(XD, XS, XT) \ EMITW(0x7980001A | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x7980001A | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgecs3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7980001A | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7980001A | MXM(RYG(XD), TmmM, RYG(XS))) /* mkj (jump to lb) if (S satisfies mask condition) */ #define RT_SIMD_MASK_NONE32_256 MN32_256 /* none satisfy the condition */ #define RT_SIMD_MASK_FULL32_256 MF32_256 /* all satisfy the condition */ /* #define S0(mask) S1(mask) (defined in 32_128-bit header) */ /* #define S1(mask) S##mask (defined in 32_128-bit header) */ #define SMN32_256(xs, lb) /* not portable, do not use outside */ \ EMITW(0x7820001E | MXM(TmmM, xs, xs+16)) \ ASM_BEG ASM_OP2( bz.v, $w31, lb) ASM_END #define SMF32_256(xs, lb) /* not portable, do not use outside */ \ EMITW(0x7800001E | MXM(TmmM, xs, xs+16)) \ ASM_BEG ASM_OP2(bnz.w, $w31, lb) ASM_END #define mkjcx_rx(XS, mask, lb) /* destroys Reax, if S == mask jump lb */ \ AUW(EMPTY, EMPTY, EMPTY, REG(XS), lb, \ S0(RT_SIMD_MASK_##mask##32_256), EMPTY2) /************* packed single-precision floating-point convert *************/ /* cvz (D = fp-to-signed-int S) * rounding mode is encoded directly (can be used in FCTRL blocks) * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rnzcs_rr(XD, XS) /* round towards zero */ \ cvzcs_rr(W(XD), W(XS)) \ cvncn_rr(W(XD), W(XD)) #define rnzcs_ld(XD, MS, DS) /* round towards zero */ \ cvzcs_ld(W(XD), W(MS), W(DS)) \ cvncn_rr(W(XD), W(XD)) #define cvzcs_rr(XD, XS) /* round towards zero */ \ EMITW(0x7B22001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B22001E | MXM(RYG(XD), RYG(XS), 0x00)) #define cvzcs_ld(XD, MS, DS) /* round towards zero */ \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B22001E | MXM(REG(XD), TmmM, 0x00)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B22001E | MXM(RYG(XD), TmmM, 0x00)) /* cvp (D = fp-to-signed-int S) * rounding mode encoded directly (cannot be used in FCTRL blocks) * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rnpcs_rr(XD, XS) /* round towards +inf */ \ FCTRL_ENTER(ROUNDP) \ rndcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(ROUNDP) #define rnpcs_ld(XD, MS, DS) /* round towards +inf */ \ FCTRL_ENTER(ROUNDP) \ rndcs_ld(W(XD), W(MS), W(DS)) \ FCTRL_LEAVE(ROUNDP) #define cvpcs_rr(XD, XS) /* round towards +inf */ \ FCTRL_ENTER(ROUNDP) \ cvtcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(ROUNDP) #define cvpcs_ld(XD, MS, DS) /* round towards +inf */ \ FCTRL_ENTER(ROUNDP) \ cvtcs_ld(W(XD), W(MS), W(DS)) \ FCTRL_LEAVE(ROUNDP) /* cvm (D = fp-to-signed-int S) * rounding mode encoded directly (cannot be used in FCTRL blocks) * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rnmcs_rr(XD, XS) /* round towards -inf */ \ FCTRL_ENTER(ROUNDM) \ rndcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(ROUNDM) #define rnmcs_ld(XD, MS, DS) /* round towards -inf */ \ FCTRL_ENTER(ROUNDM) \ rndcs_ld(W(XD), W(MS), W(DS)) \ FCTRL_LEAVE(ROUNDM) #define cvmcs_rr(XD, XS) /* round towards -inf */ \ FCTRL_ENTER(ROUNDM) \ cvtcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(ROUNDM) #define cvmcs_ld(XD, MS, DS) /* round towards -inf */ \ FCTRL_ENTER(ROUNDM) \ cvtcs_ld(W(XD), W(MS), W(DS)) \ FCTRL_LEAVE(ROUNDM) /* cvn (D = fp-to-signed-int S) * rounding mode encoded directly (cannot be used in FCTRL blocks) * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rnncs_rr(XD, XS) /* round towards near */ \ rndcs_rr(W(XD), W(XS)) #define rnncs_ld(XD, MS, DS) /* round towards near */ \ rndcs_ld(W(XD), W(MS), W(DS)) #define cvncs_rr(XD, XS) /* round towards near */ \ cvtcs_rr(W(XD), W(XS)) #define cvncs_ld(XD, MS, DS) /* round towards near */ \ cvtcs_ld(W(XD), W(MS), W(DS)) /* cvn (D = signed-int-to-fp S) * rounding mode encoded directly (cannot be used in FCTRL blocks) */ #define cvncn_rr(XD, XS) /* round towards near */ \ cvtcn_rr(W(XD), W(XS)) #define cvncn_ld(XD, MS, DS) /* round towards near */ \ cvtcn_ld(W(XD), W(MS), W(DS)) /* cvt (D = fp-to-signed-int S) * rounding mode comes from fp control register (set in FCTRL blocks) * NOTE: ROUNDZ is not supported on pre-VSX POWER systems, use cvz * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rndcs_rr(XD, XS) \ EMITW(0x7B2C001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B2C001E | MXM(RYG(XD), RYG(XS), 0x00)) #define rndcs_ld(XD, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B2C001E | MXM(REG(XD), TmmM, 0x00)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B2C001E | MXM(RYG(XD), TmmM, 0x00)) #define cvtcs_rr(XD, XS) \ EMITW(0x7B38001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B38001E | MXM(RYG(XD), RYG(XS), 0x00)) #define cvtcs_ld(XD, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B38001E | MXM(REG(XD), TmmM, 0x00)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B38001E | MXM(RYG(XD), TmmM, 0x00)) /* cvt (D = signed-int-to-fp S) * rounding mode comes from fp control register (set in FCTRL blocks) * NOTE: only default ROUNDN is supported on pre-VSX POWER systems */ #define cvtcn_rr(XD, XS) \ EMITW(0x7B3C001E | MXM(REG(XD), REG(XS), 0x00)) \ EMITW(0x7B3C001E | MXM(RYG(XD), RYG(XS), 0x00)) #define cvtcn_ld(XD, MS, DS) \ AUW(SIB(MS), EMPTY, EMPTY, MOD(MS), VAL(DS), A2(DS), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VAL(DS), B4(DS), K2(DS))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B3C001E | MXM(REG(XD), TmmM, 0x00)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MS), VYL(DS), B4(DS), K2(DS))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7B3C001E | MXM(RYG(XD), TmmM, 0x00)) /* cvr (D = fp-to-signed-int S) * rounding mode is encoded directly (cannot be used in FCTRL blocks) * NOTE: on targets with full-IEEE SIMD fp-arithmetic the ROUND*_F mode * isn't always taken into account when used within full-IEEE ASM block * NOTE: due to compatibility with legacy targets, fp32 SIMD fp-to-int * round instructions are only accurate within 32-bit signed int range */ #define rnrcs_rr(XD, XS, mode) \ FCTRL_ENTER(mode) \ rndcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(mode) #define cvrcs_rr(XD, XS, mode) \ FCTRL_ENTER(mode) \ cvtcs_rr(W(XD), W(XS)) \ FCTRL_LEAVE(mode) /************ packed single-precision integer arithmetic/shifts ***********/ /* add (G = G + S), (D = S + T) if (#D != #T) */ #define addcx_rr(XG, XS) \ addcx3rr(W(XG), W(XG), W(XS)) #define addcx_ld(XG, MS, DS) \ addcx3ld(W(XG), W(XG), W(MS), W(DS)) #define addcx3rr(XD, XS, XT) \ EMITW(0x7840000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7840000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define addcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000E | MXM(RYG(XD), RYG(XS), TmmM)) /* sub (G = G - S), (D = S - T) if (#D != #T) */ #define subcx_rr(XG, XS) \ subcx3rr(W(XG), W(XG), W(XS)) #define subcx_ld(XG, MS, DS) \ subcx3ld(W(XG), W(XG), W(MS), W(DS)) #define subcx3rr(XD, XS, XT) \ EMITW(0x78C0000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x78C0000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define subcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0000E | MXM(RYG(XD), RYG(XS), TmmM)) /* mul (G = G * S), (D = S * T) if (#D != #T) */ #define mulcx_rr(XG, XS) \ mulcx3rr(W(XG), W(XG), W(XS)) #define mulcx_ld(XG, MS, DS) \ mulcx3ld(W(XG), W(XG), W(MS), W(DS)) #define mulcx3rr(XD, XS, XT) \ EMITW(0x78400012 | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x78400012 | MXM(RYG(XD), RYG(XS), RYG(XT))) #define mulcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78400012 | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78400012 | MXM(RYG(XD), RYG(XS), TmmM)) /* shl (G = G << S), (D = S << T) if (#D != #T) - plain, unsigned * for maximum compatibility: shift count must be modulo elem-size */ #define shlcx_ri(XG, IS) \ shlcx3ri(W(XG), W(XG), W(IS)) #define shlcx_ld(XG, MS, DS) /* loads SIMD, uses first elem, rest zeroed */ \ shlcx3ld(W(XG), W(XG), W(MS), W(DS)) #define shlcx3ri(XD, XS, IT) \ EMITW(0x78400009 | MXM(REG(XD), REG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) \ EMITW(0x78400009 | MXM(RYG(XD), RYG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) #define shlcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A1(DT), EMPTY2) \ EMITW(0x8C000000 | MDM(TMxx, MOD(MT), VAL(DT), B3(DT), P1(DT))) \ EMITW(0x7B02001E | MXM(TmmM, TMxx, 0x00)) \ EMITW(0x7840000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x7840000D | MXM(RYG(XD), RYG(XS), TmmM)) /* shr (G = G >> S), (D = S >> T) if (#D != #T) - plain, unsigned * for maximum compatibility: shift count must be modulo elem-size */ #define shrcx_ri(XG, IS) \ shrcx3ri(W(XG), W(XG), W(IS)) #define shrcx_ld(XG, MS, DS) /* loads SIMD, uses first elem, rest zeroed */ \ shrcx3ld(W(XG), W(XG), W(MS), W(DS)) #define shrcx3ri(XD, XS, IT) \ EMITW(0x79400009 | MXM(REG(XD), REG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) \ EMITW(0x79400009 | MXM(RYG(XD), RYG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) #define shrcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A1(DT), EMPTY2) \ EMITW(0x8C000000 | MDM(TMxx, MOD(MT), VAL(DT), B3(DT), P1(DT))) \ EMITW(0x7B02001E | MXM(TmmM, TMxx, 0x00)) \ EMITW(0x7940000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x7940000D | MXM(RYG(XD), RYG(XS), TmmM)) /* shr (G = G >> S), (D = S >> T) if (#D != #T) - plain, signed * for maximum compatibility: shift count must be modulo elem-size */ #define shrcn_ri(XG, IS) \ shrcn3ri(W(XG), W(XG), W(IS)) #define shrcn_ld(XG, MS, DS) /* loads SIMD, uses first elem, rest zeroed */ \ shrcn3ld(W(XG), W(XG), W(MS), W(DS)) #define shrcn3ri(XD, XS, IT) \ EMITW(0x78C00009 | MXM(REG(XD), REG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) \ EMITW(0x78C00009 | MXM(RYG(XD), RYG(XS), 0x00) | \ (0x1F & VAL(IT)) << 16) #define shrcn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A1(DT), EMPTY2) \ EMITW(0x8C000000 | MDM(TMxx, MOD(MT), VAL(DT), B3(DT), P1(DT))) \ EMITW(0x7B02001E | MXM(TmmM, TMxx, 0x00)) \ EMITW(0x78C0000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78C0000D | MXM(RYG(XD), RYG(XS), TmmM)) /* svl (G = G << S), (D = S << T) if (#D != #T) - variable, unsigned * for maximum compatibility: shift count must be modulo elem-size */ #define svlcx_rr(XG, XS) /* variable shift with per-elem count */ \ svlcx3rr(W(XG), W(XG), W(XS)) #define svlcx_ld(XG, MS, DS) /* variable shift with per-elem count */ \ svlcx3ld(W(XG), W(XG), W(MS), W(DS)) #define svlcx3rr(XD, XS, XT) \ EMITW(0x7840000D | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7840000D | MXM(RYG(XD), RYG(XS), RYG(XT))) #define svlcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000D | MXM(RYG(XD), RYG(XS), TmmM)) /* svr (G = G >> S), (D = S >> T) if (#D != #T) - variable, unsigned * for maximum compatibility: shift count must be modulo elem-size */ #define svrcx_rr(XG, XS) /* variable shift with per-elem count */ \ svrcx3rr(W(XG), W(XG), W(XS)) #define svrcx_ld(XG, MS, DS) /* variable shift with per-elem count */ \ svrcx3ld(W(XG), W(XG), W(MS), W(DS)) #define svrcx3rr(XD, XS, XT) \ EMITW(0x7940000D | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7940000D | MXM(RYG(XD), RYG(XS), RYG(XT))) #define svrcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000D | MXM(RYG(XD), RYG(XS), TmmM)) /* svr (G = G >> S), (D = S >> T) if (#D != #T) - variable, signed * for maximum compatibility: shift count must be modulo elem-size */ #define svrcn_rr(XG, XS) /* variable shift with per-elem count */ \ svrcn3rr(W(XG), W(XG), W(XS)) #define svrcn_ld(XG, MS, DS) /* variable shift with per-elem count */ \ svrcn3ld(W(XG), W(XG), W(MS), W(DS)) #define svrcn3rr(XD, XS, XT) \ EMITW(0x78C0000D | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x78C0000D | MXM(RYG(XD), RYG(XS), RYG(XT))) #define svrcn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0000D | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x78C0000D | MXM(RYG(XD), RYG(XS), TmmM)) /**************** packed single-precision integer compare *****************/ /* min (G = G < S ? G : S), (D = S < T ? S : T) if (#D != #T), unsigned */ #define mincx_rr(XG, XS) \ mincx3rr(W(XG), W(XG), W(XS)) #define mincx_ld(XG, MS, DS) \ mincx3ld(W(XG), W(XG), W(MS), W(DS)) #define mincx3rr(XD, XS, XT) \ EMITW(0x7AC0000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7AC0000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define mincx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000E | MXM(RYG(XD), RYG(XS), TmmM)) /* min (G = G < S ? G : S), (D = S < T ? S : T) if (#D != #T), signed */ #define mincn_rr(XG, XS) \ mincn3rr(W(XG), W(XG), W(XS)) #define mincn_ld(XG, MS, DS) \ mincn3ld(W(XG), W(XG), W(MS), W(DS)) #define mincn3rr(XD, XS, XT) \ EMITW(0x7A40000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7A40000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define mincn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000E | MXM(RYG(XD), RYG(XS), TmmM)) /* max (G = G > S ? G : S), (D = S > T ? S : T) if (#D != #T), unsigned */ #define maxcx_rr(XG, XS) \ maxcx3rr(W(XG), W(XG), W(XS)) #define maxcx_ld(XG, MS, DS) \ maxcx3ld(W(XG), W(XG), W(MS), W(DS)) #define maxcx3rr(XD, XS, XT) \ EMITW(0x79C0000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x79C0000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define maxcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000E | MXM(RYG(XD), RYG(XS), TmmM)) /* max (G = G > S ? G : S), (D = S > T ? S : T) if (#D != #T), signed */ #define maxcn_rr(XG, XS) \ maxcn3rr(W(XG), W(XG), W(XS)) #define maxcn_ld(XG, MS, DS) \ maxcn3ld(W(XG), W(XG), W(MS), W(DS)) #define maxcn3rr(XD, XS, XT) \ EMITW(0x7940000E | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7940000E | MXM(RYG(XD), RYG(XS), RYG(XT))) #define maxcn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000E | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000E | MXM(RYG(XD), RYG(XS), TmmM)) /* ceq (G = G == S ? -1 : 0), (D = S == T ? -1 : 0) if (#D != #T) */ #define ceqcx_rr(XG, XS) \ ceqcx3rr(W(XG), W(XG), W(XS)) #define ceqcx_ld(XG, MS, DS) \ ceqcx3ld(W(XG), W(XG), W(MS), W(DS)) #define ceqcx3rr(XD, XS, XT) \ EMITW(0x7840000F | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7840000F | MXM(RYG(XD), RYG(XS), RYG(XT))) #define ceqcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000F | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7840000F | MXM(RYG(XD), RYG(XS), TmmM)) /* cne (G = G != S ? -1 : 0), (D = S != T ? -1 : 0) if (#D != #T) */ #define cnecx_rr(XG, XS) \ cnecx3rr(W(XG), W(XG), W(XS)) #define cnecx_ld(XG, MS, DS) \ cnecx3ld(W(XG), W(XG), W(MS), W(DS)) #define cnecx3rr(XD, XS, XT) \ ceqcx3rr(W(XD), W(XS), W(XT)) \ notcx_rx(W(XD)) #define cnecx3ld(XD, XS, MT, DT) \ ceqcx3ld(W(XD), W(XS), W(MT), W(DT)) \ notcx_rx(W(XD)) /* clt (G = G < S ? -1 : 0), (D = S < T ? -1 : 0) if (#D != #T), unsigned */ #define cltcx_rr(XG, XS) \ cltcx3rr(W(XG), W(XG), W(XS)) #define cltcx_ld(XG, MS, DS) \ cltcx3ld(W(XG), W(XG), W(MS), W(DS)) #define cltcx3rr(XD, XS, XT) \ EMITW(0x79C0000F | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x79C0000F | MXM(RYG(XD), RYG(XS), RYG(XT))) #define cltcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000F | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000F | MXM(RYG(XD), RYG(XS), TmmM)) /* clt (G = G < S ? -1 : 0), (D = S < T ? -1 : 0) if (#D != #T), signed */ #define cltcn_rr(XG, XS) \ cltcn3rr(W(XG), W(XG), W(XS)) #define cltcn_ld(XG, MS, DS) \ cltcn3ld(W(XG), W(XG), W(MS), W(DS)) #define cltcn3rr(XD, XS, XT) \ EMITW(0x7940000F | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7940000F | MXM(RYG(XD), RYG(XS), RYG(XT))) #define cltcn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000F | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000F | MXM(RYG(XD), RYG(XS), TmmM)) /* cle (G = G <= S ? -1 : 0), (D = S <= T ? -1 : 0) if (#D != #T), unsigned */ #define clecx_rr(XG, XS) \ clecx3rr(W(XG), W(XG), W(XS)) #define clecx_ld(XG, MS, DS) \ clecx3ld(W(XG), W(XG), W(MS), W(DS)) #define clecx3rr(XD, XS, XT) \ EMITW(0x7AC0000F | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7AC0000F | MXM(RYG(XD), RYG(XS), RYG(XT))) #define clecx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000F | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000F | MXM(RYG(XD), RYG(XS), TmmM)) /* cle (G = G <= S ? -1 : 0), (D = S <= T ? -1 : 0) if (#D != #T), signed */ #define clecn_rr(XG, XS) \ clecn3rr(W(XG), W(XG), W(XS)) #define clecn_ld(XG, MS, DS) \ clecn3ld(W(XG), W(XG), W(MS), W(DS)) #define clecn3rr(XD, XS, XT) \ EMITW(0x7A40000F | MXM(REG(XD), REG(XS), REG(XT))) \ EMITW(0x7A40000F | MXM(RYG(XD), RYG(XS), RYG(XT))) #define clecn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000F | MXM(REG(XD), REG(XS), TmmM)) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000F | MXM(RYG(XD), RYG(XS), TmmM)) /* cgt (G = G > S ? -1 : 0), (D = S > T ? -1 : 0) if (#D != #T), unsigned */ #define cgtcx_rr(XG, XS) \ cgtcx3rr(W(XG), W(XG), W(XS)) #define cgtcx_ld(XG, MS, DS) \ cgtcx3ld(W(XG), W(XG), W(MS), W(DS)) #define cgtcx3rr(XD, XS, XT) \ EMITW(0x79C0000F | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x79C0000F | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgtcx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000F | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x79C0000F | MXM(RYG(XD), TmmM, RYG(XS))) /* cgt (G = G > S ? -1 : 0), (D = S > T ? -1 : 0) if (#D != #T), signed */ #define cgtcn_rr(XG, XS) \ cgtcn3rr(W(XG), W(XG), W(XS)) #define cgtcn_ld(XG, MS, DS) \ cgtcn3ld(W(XG), W(XG), W(MS), W(DS)) #define cgtcn3rr(XD, XS, XT) \ EMITW(0x7940000F | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x7940000F | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgtcn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000F | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7940000F | MXM(RYG(XD), TmmM, RYG(XS))) /* cge (G = G >= S ? -1 : 0), (D = S >= T ? -1 : 0) if (#D != #T), unsigned */ #define cgecx_rr(XG, XS) \ cgecx3rr(W(XG), W(XG), W(XS)) #define cgecx_ld(XG, MS, DS) \ cgecx3ld(W(XG), W(XG), W(MS), W(DS)) #define cgecx3rr(XD, XS, XT) \ EMITW(0x7AC0000F | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x7AC0000F | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgecx3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000F | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7AC0000F | MXM(RYG(XD), TmmM, RYG(XS))) /* cge (G = G >= S ? -1 : 0), (D = S >= T ? -1 : 0) if (#D != #T), signed */ #define cgecn_rr(XG, XS) \ cgecn3rr(W(XG), W(XG), W(XS)) #define cgecn_ld(XG, MS, DS) \ cgecn3ld(W(XG), W(XG), W(MS), W(DS)) #define cgecn3rr(XD, XS, XT) \ EMITW(0x7A40000F | MXM(REG(XD), REG(XT), REG(XS))) \ EMITW(0x7A40000F | MXM(RYG(XD), RYG(XT), RYG(XS))) #define cgecn3ld(XD, XS, MT, DT) \ AUW(SIB(MT), EMPTY, EMPTY, MOD(MT), VAL(DT), A2(DT), EMPTY2) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VAL(DT), B4(DT), K2(DT))) \ SHF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000F | MXM(REG(XD), TmmM, REG(XS))) \ EMITW(0x78000022 | MFM(TmmM, MOD(MT), VYL(DT), B4(DT), K2(DT))) \ SJF(EMITW(0x7AB10002 | MXM(TmmM, TmmM, 0x00))) \ EMITW(0x7A40000F | MXM(RYG(XD), TmmM, RYG(XS))) /******************************************************************************/ /******************************** INTERNAL ********************************/ /******************************************************************************/ /* sregs */ #undef sregs_sa #define sregs_sa() /* save all SIMD regs, destroys Reax */ \ movxx_ld(Reax, Mebp, inf_REGS) \ movcx_st(Xmm0, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm1, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm2, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm3, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm4, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm5, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm6, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm7, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm8, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(Xmm9, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(XmmA, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(XmmB, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(XmmC, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(XmmD, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_st(XmmE, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ EMITW(0x78000027 | MXM(TmmZ, Teax, 0x00)) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_128*4)) \ EMITW(0x78000027 | MXM(TmmM, Teax, 0x00)) #undef sregs_la #define sregs_la() /* load all SIMD regs, destroys Reax */ \ movxx_ld(Reax, Mebp, inf_REGS) \ movcx_ld(Xmm0, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm1, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm2, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm3, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm4, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm5, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm6, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm7, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm8, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(Xmm9, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(XmmA, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(XmmB, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(XmmC, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(XmmD, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ movcx_ld(XmmE, Oeax, PLAIN) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_256*4)) \ EMITW(0x78000023 | MXM(TmmZ, Teax, 0x00)) \ addxx_ri(Reax, IB(RT_SIMD_WIDTH32_128*4)) \ EMITW(0x78000023 | MXM(TmmM, Teax, 0x00)) #endif /* RT_128X2 */ #endif /* RT_SIMD_CODE */ #endif /* RT_RTARCH_M32_128X2V1_H */ /******************************************************************************/ /******************************************************************************/ /******************************************************************************/
VectorChief/QuadRay-engine
core/config/rtarch_m32_128x2v1.h
C
mit
79,043
 namespace Unplugged.Segy { public class SegyOptions : ISegyOptions { public bool? IsEbcdic { get; set; } //public bool? IsLittleEndian { get; set; } public int TextHeaderColumnCount { get; set; } public int TextHeaderRowCount { get; set; } public bool TextHeaderInsertNewLines { get; set; } //public int BinaryHeaderLength { get; set; } //public int BinaryHeaderLocationForSampleFormat { get; set; } //public int TraceHeaderLength { get; set; } //public int TraceHeaderLocationForInlineNumber { get; set; } //public int TraceHeaderLocationForCrosslineNumber { get; set; } //public int TraceHeaderLocationForSampleCount { get; set; } public SegyOptions() { IsEbcdic = true; //IsLittleEndian = false; TextHeaderColumnCount = 80; TextHeaderRowCount = 40; TextHeaderInsertNewLines = true; //BinaryHeaderLength = 400; //BinaryHeaderLocationForSampleFormat = 25; //TraceHeaderLength = 240; //TraceHeaderLocationForSampleCount = 115; //TraceHeaderLocationForInlineNumber = 189; //TraceHeaderLocationForCrosslineNumber = 193; } } }
hohogpb/UnpluggedSegy
Unplugged.Segy/SegyOptions.cs
C#
mit
1,288
"""Support for interface with a Gree climate systems.""" from __future__ import annotations from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DISPATCHERS, DOMAIN from .entity import GreeEntity async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up the Gree HVAC device from a config entry.""" @callback def init_device(coordinator): """Register the device.""" async_add_entities( [ GreePanelLightSwitchEntity(coordinator), GreeQuietModeSwitchEntity(coordinator), GreeFreshAirSwitchEntity(coordinator), GreeXFanSwitchEntity(coordinator), ] ) for coordinator in hass.data[DOMAIN][COORDINATORS]: init_device(coordinator) hass.data[DOMAIN][DISPATCHERS].append( async_dispatcher_connect(hass, DISPATCH_DEVICE_DISCOVERED, init_device) ) class GreePanelLightSwitchEntity(GreeEntity, SwitchEntity): """Representation of the front panel light on the device.""" def __init__(self, coordinator): """Initialize the Gree device.""" super().__init__(coordinator, "Panel Light") @property def icon(self) -> str | None: """Return the icon for the device.""" return "mdi:lightbulb" @property def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return SwitchDeviceClass.SWITCH @property def is_on(self) -> bool: """Return if the light is turned on.""" return self.coordinator.device.light async def async_turn_on(self, **kwargs): """Turn the entity on.""" self.coordinator.device.light = True await self.coordinator.push_state_update() self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Turn the entity off.""" self.coordinator.device.light = False await self.coordinator.push_state_update() self.async_write_ha_state() class GreeQuietModeSwitchEntity(GreeEntity, SwitchEntity): """Representation of the quiet mode state of the device.""" def __init__(self, coordinator): """Initialize the Gree device.""" super().__init__(coordinator, "Quiet") @property def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return SwitchDeviceClass.SWITCH @property def is_on(self) -> bool: """Return if the state is turned on.""" return self.coordinator.device.quiet async def async_turn_on(self, **kwargs): """Turn the entity on.""" self.coordinator.device.quiet = True await self.coordinator.push_state_update() self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Turn the entity off.""" self.coordinator.device.quiet = False await self.coordinator.push_state_update() self.async_write_ha_state() class GreeFreshAirSwitchEntity(GreeEntity, SwitchEntity): """Representation of the fresh air mode state of the device.""" def __init__(self, coordinator): """Initialize the Gree device.""" super().__init__(coordinator, "Fresh Air") @property def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return SwitchDeviceClass.SWITCH @property def is_on(self) -> bool: """Return if the state is turned on.""" return self.coordinator.device.fresh_air async def async_turn_on(self, **kwargs): """Turn the entity on.""" self.coordinator.device.fresh_air = True await self.coordinator.push_state_update() self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Turn the entity off.""" self.coordinator.device.fresh_air = False await self.coordinator.push_state_update() self.async_write_ha_state() class GreeXFanSwitchEntity(GreeEntity, SwitchEntity): """Representation of the extra fan mode state of the device.""" def __init__(self, coordinator): """Initialize the Gree device.""" super().__init__(coordinator, "XFan") @property def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return SwitchDeviceClass.SWITCH @property def is_on(self) -> bool: """Return if the state is turned on.""" return self.coordinator.device.xfan async def async_turn_on(self, **kwargs): """Turn the entity on.""" self.coordinator.device.xfan = True await self.coordinator.push_state_update() self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Turn the entity off.""" self.coordinator.device.xfan = False await self.coordinator.push_state_update() self.async_write_ha_state()
rohitranjan1991/home-assistant
homeassistant/components/gree/switch.py
Python
mit
5,377
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import Welcome from '../../src/js/components/Welcome'; describe('Welcome Component', () => { var welcomeComponent; beforeEach(() => { welcomeComponent = shallow(<Welcome />); }); it('renders Mikey Welcomes You! in a h1 tag', () => { expect(welcomeComponent.find('h1').text()).to.equal('Mikey Welcomes You!'); }); it('renders Use the latest web development technologies. in a h2 tag', () => { expect(welcomeComponent.find('h2').text()).to.equal('Use the latest web development technologies.'); }); });
Mikeysax/mikey
project_template/tests/components/Welcome.test.js
JavaScript
mit
626
<?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_Gdata * @subpackage Exif * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** * @namespace */ namespace Zend\GData\EXIF\Extension; /** * Represents the exif:distance element used by the Gdata Exif extensions. * * @uses \Zend\GData\EXIF * @uses \Zend\GData\Extension * @category Zend * @package Zend_Gdata * @subpackage Exif * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Distance extends \Zend\GData\Extension { protected $_rootNamespace = 'exif'; protected $_rootElement = 'distance'; /** * Constructs a new Zend_Gdata_Exif_Extension_Distance object. * * @param string $text (optional) The value to use for this element. */ public function __construct($text = null) { $this->registerAllNamespaces(\Zend\GData\EXIF::$namespaces); parent::__construct(); $this->setText($text); } }
triggertoo/whatsup
src/vendor/zend/library/Zend/GData/EXIF/Extension/Distance.php
PHP
mit
1,631
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import "NSObject.h" #import "DVTInvalidation.h" @class DVTStackBacktrace, IDEActivityLogSection, IDELogStore, IDESourceControlExtension, IDESourceControlOperation, IDESourceControlRepository, IDESourceControlTree, IDESourceControlWorkingCopyConfiguration, NSArray, NSDictionary, NSString; @interface IDESourceControlRequest : NSObject <DVTInvalidation> { IDESourceControlTree *_sourceTree; IDESourceControlWorkingCopyConfiguration *_wcc; IDESourceControlRepository *_remote; int _type; NSString *_startingRevision; NSString *_endingRevision; NSString *_destination; NSArray *_files; NSDictionary *_options; IDEActivityLogSection *_log; IDEActivityLogSection *_logSection; NSString *_shortTitle; NSString *_longTitle; NSString *_workspaceName; IDELogStore *_logStore; IDESourceControlExtension *_sourceControlExtension; NSString *_message; IDESourceControlOperation *_operation; BOOL _stopAllActivityWhenCanceled; BOOL _shouldGenerateLog; BOOL _cancelable; id _progressBlock; } + (void)initialize; - (void).cxx_destruct; - (void)cancelOperation; @property BOOL cancelable; // @synthesize cancelable=_cancelable; @property(readonly, copy) NSString *description; @property(copy) NSString *destination; // @synthesize destination=_destination; @property(copy) NSString *endingRevision; // @synthesize endingRevision=_endingRevision; @property(copy) NSArray *files; // @synthesize files=_files; - (id)initWithType:(int)arg1 sourceTree:(id)arg2; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 destination:(id)arg3 files:(id)arg4 options:(id)arg5; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 destination:(id)arg3 startingRevision:(id)arg4 endingRevision:(id)arg5 files:(id)arg6 options:(id)arg7; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 files:(id)arg3; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 files:(id)arg3 options:(id)arg4; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 message:(id)arg3 files:(id)arg4 options:(id)arg5; - (id)initWithType:(int)arg1 sourceTree:(id)arg2 startingRevision:(id)arg3 endingRevision:(id)arg4 files:(id)arg5 options:(id)arg6; - (id)initWithType:(int)arg1 startingRevision:(id)arg2 destination:(id)arg3 options:(id)arg4; - (id)initWithType:(int)arg1 workingCopyConfiguration:(id)arg2 destination:(id)arg3 files:(id)arg4 options:(id)arg5; - (BOOL)isRequestBlacklistedFromLogging; @property(retain) IDEActivityLogSection *log; // @synthesize log=_log; @property(retain) IDEActivityLogSection *logSection; // @synthesize logSection=_logSection; @property(readonly) IDELogStore *logStore; // @synthesize logStore=_logStore; @property(readonly, copy) NSString *longTitle; // @synthesize longTitle=_longTitle; @property(copy) NSString *message; // @synthesize message=_message; @property IDESourceControlOperation *operation; // @synthesize operation=_operation; @property(copy) NSDictionary *options; // @synthesize options=_options; - (void)primitiveInvalidate; @property(copy) id progressBlock; // @synthesize progressBlock=_progressBlock; @property(retain) IDESourceControlRepository *remote; // @synthesize remote=_remote; @property(readonly) IDESourceControlRepository *repositoryToAuthenticate; @property BOOL shouldGenerateLog; // @synthesize shouldGenerateLog=_shouldGenerateLog; - (void)setShouldGenerateLog:(BOOL)arg1 logStore:(id)arg2 shortTitle:(id)arg3 longTitle:(id)arg4; - (void)setShouldGenerateLog:(BOOL)arg1 logStore:(id)arg2 workspaceName:(id)arg3; @property(retain) IDESourceControlExtension *sourceControlExtension; // @synthesize sourceControlExtension=_sourceControlExtension; @property(retain) IDESourceControlTree *sourceTree; // @synthesize sourceTree=_sourceTree; @property(copy) NSString *startingRevision; // @synthesize startingRevision=_startingRevision; @property BOOL stopAllActivityWhenCanceled; // @synthesize stopAllActivityWhenCanceled=_stopAllActivityWhenCanceled; @property int type; // @synthesize type=_type; @property(retain) IDESourceControlWorkingCopyConfiguration *wcc; // @synthesize wcc=_wcc; @property(readonly, copy) NSString *shortTitle; // @synthesize shortTitle=_shortTitle; @property(readonly, copy) NSString *workspaceName; // @synthesize workspaceName=_workspaceName; // Remaining properties @property(retain) DVTStackBacktrace *creationBacktrace; @property(readonly, copy) NSString *debugDescription; @property(readonly) unsigned long long hash; @property(readonly) DVTStackBacktrace *invalidationBacktrace; @property(readonly) Class superclass; @property(readonly, nonatomic, getter=isValid) BOOL valid; @end
orta/AxeMode
XcodeHeaders/IDEFoundation/IDESourceControlRequest.h
C
mit
4,744
# Part 3: Build a CRUD App ## Summary In Part 3 of the assessment, we'll demonstrate our proficiency in building web-stack applications: user authentication, associations, validations, controllers, views, etc. Even a little bit of CSS. ### Site Overview We'll be building a simplified version of a blind auction site. In a blind auction, bidders do not see how much other bidders have bid. The required functionality of the site will be described in more detail in the *Releases* section, but here's a basic overview. #### All Users - Browse available items #### Unregistered Users** - Register a new account #### Registered Users - Sign in - Sign out - List new items - Place bids on items - Have a profile showing their listing and bidding activity ### Completing the App Complete as much of this CRUD app as possible in the time allowed. If time is running out and it looks like the app will not be completed, continue to work through the releases in order and complete as much as possible. Be sure to ask questions, if you find yourself stuck. ## Releases ### Pre-release: Setup We'll need to make sure that everything is set up before we begin working on the application. From the command line, navigate to the `part-3` directory of the phase 2 assessment. Once there, run ... 0. `$ bundle` 0. `$ bundle exec rake db:create` ### Release 0: User Registration Users will need to register for a new account. Create a link on the home page that will take them to a page where they can enter their desired username and password. There are a two constraints to this feature: 1. The username must be unique 1. The password must be at least 6 characters long If both constraints are met, the user should be considered logged in and redirected to the home page where all references to "Register" are removed. If either constraint is not met, the user should see the registration form and the associated error messages. ### Release 1: Login/Logout #### Login _Given:_ * There is a previously registered user * User is not currently logged in: 1. On the home page, create a link to login. 1. When a user clicks on this link they should be taken to a page with a form to enter their credentials. 1. If the credentials match, the user should be taken back to the homepage and the login link should be replaced with a logout link. 1. If the credentials do not match, the user should see the login form and an error message stating the credentials were not valid. #### Logout Given there is a previously registered user and they are currently logged in: 1. On the home page, create a link to logout. 1. When the user clicks on the logout link they should be taken to the home page and the links "Register" and "Login" should both be visible. ### Release 2: CRUD'ing a Resorouce The user's profile page is where users are able to manage their listed items. We'll start off by giving them the ability to add an item and then work through the remaining CRUD actions. #### Creating Items _Given:_ * The registered user is signed in: 1. On the home page create a link to the user's profile page. 1. When the user clicks on the profile link they should be taken to their profile page. 1. Create a link on this page to add an item to the auction site. The item should include things like a name and/or title, description, when the user would like the auction to start and when it should stop. *Note*: When creating and or editing an item, you'll need to create forms that allow you to enter dates. The HTML5 datetime input type is tricky to use with ActiveRecord. Consider using something like `<input type="text" name="my-date">` in the markup. When filling in the field, use the `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS` format (e.g. 2015-04-01 14:30:00). After submitting an item, the user should be back on their profile page. #### Reading Items _Given:_ * The registered user is signed in * There exist previously-created items 1. Create a section on the profile page to display all the items. This section should _not_ include the long form description of the item. #### Updating Items _Given:_ * The registered user is signed in * There exist previously-created items; some owned by the logged-in user, others not 1. On the profile page, create an edit link associated to each of the items the user has created. This link should only be visible if the user logged in is the user that created the item. 1. When the user clicks the edit link associated to the item, they should be taken to a page to edit that item's details. After submitting this information the user should be taken back to their profile page and see the item's updates should be reflected on the page. #### Deleting Items _Given_ * The registered user is signed in * There exist previously-created items; some owned by the logged-in user, others not 1. On the profile page, create a delete link associated to each of the items the user has created. Just like in the update section, this link should only be visible if the user logged in is the user that created the item. 1. When the user clicks the delete link, the user profile page should reload and the item should no longer be visible. ### Release 3: Bidding Up until now, the home page has largely just contained links to allow the user to register or login, or if they were logged in, to logout. Now that users have the ability to create items for others to bid on, let's start filling in the homepage. #### Viewing Active Items _Given_ * The registered user is signed in * There exist previously-created items; some owned by the logged-in user, others not * There exist items which are active Create a section on the home page to list the items that are currently available and active. To clarify, active means the items have start date on or before today and the end date is on or after today. #### Creating a Bid _Given_ * The registered user is signed in * There exist previously-created items; some owned by the logged-in user, others not * There exist items which are active 1. Make the name or title of the listed items in the home page a link. When the user clicks on a link for an item, they should be on a page that is displaying the details of the item. This will include the long form description and add a section on the page to display the current number of bidders. 1. Add a form to the item detail page that will allow the user to enter a bid amount. The submit button for the form should say "Place Bid". 1. When the user submits the bidding form, the page should reload. Where the form was located, there should be the text "Thank you for your bid. Good luck!" and the number of bidders section should be incremented by 1. #### Login or Register to Bid _Given:_ * The current user is not logged in * The user is on the item details page for a previously-created item In place of the bidding form, a user should see the text "To place a bid please login or register." Both login and register should be links taking the user to their respective pages. ### Release 4: Bid on Items on the Profile Page Now that we can bid on items, let's make it easy to keep track of the things we have bid on. #### Bid on Items _Given:_ * The registered user is logged in * Registered user has previously placed bids on several items * User is currently on their profile page Create a section to display the items the user has bid on. #### Won Items _Given:_ * The registered user is logged in * The registered user placed the highest bid on several items that are no longer active * The registered user is currently on their profile page Create a section to display the items they have won. This is items that are no longer active (end date is before today) and the bid placed on the item is the highest of all the bidders. ## Conclusion Part-3 wraps up the assessment. If you haven't already done so, commit your changes. Please wait until the end of the assessment period to submit your solution.
nvanderlaan/fraudfinder
README.md
Markdown
mit
8,043
<?php namespace Proxies\__CG__\Blogger\BlogBundle\Entity; /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ class Blog extends \Blogger\BlogBundle\Entity\Blog implements \Doctrine\ORM\Proxy\Proxy { /** * @var \Closure the callback responsible for loading properties in the proxy object. This callback is called with * three parameters, being respectively the proxy object to be initialized, the method that triggered the * initialization process and an array of ordered parameters that were passed to that method. * * @see \Doctrine\Common\Persistence\Proxy::__setInitializer */ public $__initializer__; /** * @var \Closure the callback responsible of loading properties that need to be copied in the cloned object * * @see \Doctrine\Common\Persistence\Proxy::__setCloner */ public $__cloner__; /** * @var boolean flag indicating if this object was already initialized * * @see \Doctrine\Common\Persistence\Proxy::__isInitialized */ public $__isInitialized__ = false; /** * @var array properties to be lazy loaded, with keys being the property * names and values being their default values * * @see \Doctrine\Common\Persistence\Proxy::__getLazyProperties */ public static $lazyPropertiesDefaults = array(); /** * @param \Closure $initializer * @param \Closure $cloner */ public function __construct($initializer = null, $cloner = null) { $this->__initializer__ = $initializer; $this->__cloner__ = $cloner; } /** * * @return array */ public function __sleep() { if ($this->__isInitialized__) { return array('__isInitialized__', 'id', 'title', 'author', 'blog', 'image', 'tags', 'comments', 'created', 'updated', 'slug'); } return array('__isInitialized__', 'id', 'title', 'author', 'blog', 'image', 'tags', 'comments', 'created', 'updated', 'slug'); } /** * */ public function __wakeup() { if ( ! $this->__isInitialized__) { $this->__initializer__ = function (Blog $proxy) { $proxy->__setInitializer(null); $proxy->__setCloner(null); $existingProperties = get_object_vars($proxy); foreach ($proxy->__getLazyProperties() as $property => $defaultValue) { if ( ! array_key_exists($property, $existingProperties)) { $proxy->$property = $defaultValue; } } }; } } /** * */ public function __clone() { $this->__cloner__ && $this->__cloner__->__invoke($this, '__clone', array()); } /** * Forces initialization of the proxy */ public function __load() { $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', array()); } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic */ public function __isInitialized() { return $this->__isInitialized__; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic */ public function __setInitialized($initialized) { $this->__isInitialized__ = $initialized; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic */ public function __setInitializer(\Closure $initializer = null) { $this->__initializer__ = $initializer; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic */ public function __getInitializer() { return $this->__initializer__; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic */ public function __setCloner(\Closure $cloner = null) { $this->__cloner__ = $cloner; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific cloning logic */ public function __getCloner() { return $this->__cloner__; } /** * {@inheritDoc} * @internal generated method: use only when explicitly handling proxy specific loading logic * @static */ public function __getLazyProperties() { return self::$lazyPropertiesDefaults; } /** * {@inheritDoc} */ public function setUpdatedValue() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUpdatedValue', array()); return parent::setUpdatedValue(); } /** * {@inheritDoc} */ public function getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); } /** * {@inheritDoc} */ public function setTitle($title) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setTitle', array($title)); return parent::setTitle($title); } /** * {@inheritDoc} */ public function getTitle() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getTitle', array()); return parent::getTitle(); } /** * {@inheritDoc} */ public function setAuthor($author) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setAuthor', array($author)); return parent::setAuthor($author); } /** * {@inheritDoc} */ public function getAuthor() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAuthor', array()); return parent::getAuthor(); } /** * {@inheritDoc} */ public function setBlog($blog) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setBlog', array($blog)); return parent::setBlog($blog); } /** * {@inheritDoc} */ public function getBlog($length = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getBlog', array($length)); return parent::getBlog($length); } /** * {@inheritDoc} */ public function setImage($image) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setImage', array($image)); return parent::setImage($image); } /** * {@inheritDoc} */ public function getImage() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getImage', array()); return parent::getImage(); } /** * {@inheritDoc} */ public function setTags($tags) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setTags', array($tags)); return parent::setTags($tags); } /** * {@inheritDoc} */ public function getTags() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getTags', array()); return parent::getTags(); } /** * {@inheritDoc} */ public function setCreated($created) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setCreated', array($created)); return parent::setCreated($created); } /** * {@inheritDoc} */ public function getCreated() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCreated', array()); return parent::getCreated(); } /** * {@inheritDoc} */ public function setUpdated($updated) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUpdated', array($updated)); return parent::setUpdated($updated); } /** * {@inheritDoc} */ public function getUpdated() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getUpdated', array()); return parent::getUpdated(); } /** * {@inheritDoc} */ public function addComment(\Blogger\BlogBundle\Entity\Comment $comments) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'addComment', array($comments)); return parent::addComment($comments); } /** * {@inheritDoc} */ public function removeComment(\Blogger\BlogBundle\Entity\Comment $comments) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'removeComment', array($comments)); return parent::removeComment($comments); } /** * {@inheritDoc} */ public function getComments() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getComments', array()); return parent::getComments(); } /** * {@inheritDoc} */ public function __toString() { $this->__initializer__ && $this->__initializer__->__invoke($this, '__toString', array()); return parent::__toString(); } /** * {@inheritDoc} */ public function slugify($text) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'slugify', array($text)); return parent::slugify($text); } /** * {@inheritDoc} */ public function setSlug($slug) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSlug', array($slug)); return parent::setSlug($slug); } /** * {@inheritDoc} */ public function getSlug() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSlug', array()); return parent::getSlug(); } }
jatpatel1/Symblog
app/cache/prod/doctrine/orm/Proxies/__CG__BloggerBlogBundleEntityBlog.php
PHP
mit
10,113
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace School { public class Course { private IList<Student> students; public Course() { this.students = new List<Student>(); } public IList<Student> Students { get { return this.students; } } public void AddStudentToCourse(Student student) { if (Students.Count > 30) { throw new ArgumentOutOfRangeException("In the course cannot have more than 30 students"); } this.Students.Add(student); } public void RemoveStudentFromCourse(Student student) { this.Students.Remove(student); } } }
todor-enikov/TelerikAcademy
Unit-testing with C# - 2016/01. Unit Testing/School/School/Course.cs
C#
mit
866
export default { 'ACT': 'Australian Capital Territory', 'NSW': 'New South Wales', 'NT' : 'Northern Territory', 'QLD': 'Queensland', 'SA' : 'South Australia', 'TAS': 'Tasmania', 'VIC': 'Victoria', 'WA' : 'Western Australia' }
AbleTech/addressfinder-shopify
src/address_form_config/user_registration_state_mappings.js
JavaScript
mit
240
if( typeof module !== 'undefined' ) require( 'wFiles' ) var _ = wTools; /* filesCopy HardDrive -> Extract */ var hub = _.FileProvider.Hub(); var simpleStructure = _.FileProvider.Extract ({ filesTree : Object.create( null ) }); hub.providerRegister( simpleStructure ); var hdUrl = _.fileProvider.urlFromLocal( _.normalize( __dirname ) ); var ssUrl = simpleStructure.urlFromLocal( '/dir/copy/to' ); hub.filesCopy ({ dst : ssUrl, src : hdUrl, preserveTime : 0 }); var tree = _.entity.exportString( simpleStructure.filesTree, { levels : 4 } ); console.log( tree );
Wandalen/wFiles
sample/Hub.filesCopy.js
JavaScript
mit
577
/** http://www.w3.org/TR/2011/REC-SVG11-20110816/text.html#InterfaceSVGTextPositioningElement interface SVGTextPositioningElement : SVGTextContentElement { readonly attribute SVGAnimatedLengthList x; readonly attribute SVGAnimatedLengthList y; readonly attribute SVGAnimatedLengthList dx; readonly attribute SVGAnimatedLengthList dy; readonly attribute SVGAnimatedNumberList rotate; */ #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) #import <UIKit/UIKit.h> #else #import <Cocoa/Cocoa.h> #endif #import "SVGTextContentElement.h" #import "SVGLength.h" @interface SVGTextPositioningElement : SVGTextContentElement @property(nonatomic,strong,readonly) SVGLength* /* FIXME: should be SVGAnimatedLengthList */ x; @property(nonatomic,strong,readonly) SVGLength* /* FIXME: should be SVGAnimatedLengthList */ y; @property(nonatomic,strong,readonly) SVGLength* /* FIXME: should be SVGAnimatedLengthList */ dx; @property(nonatomic,strong,readonly) SVGLength* /* FIXME: should be SVGAnimatedLengthList */ dy; @property(nonatomic,strong,readonly) SVGLength* /* FIXME: should be SVGAnimatedLengthList */ rotate; @end
MaddTheSane/SVGKit
Source/DOM classes/SVG-DOM/SVGTextPositioningElement.h
C
mit
1,115
<?php namespace Anytv\DashboardBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class OfferType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { //$builder->add('name') $builder->add('description') //->add('advertiser') //->add('offerUrl') //->add('previewUrl') //->add('status', 'choice', array('choices' => array('active' => 'active', 'paused' => 'paused', 'pending' => 'pending', 'expired' => 'expired', 'deleted' => 'deleted'))) //->add('expirationDate') ->add('isFeatured', 'choice', array('choices' => array(0 => 'no', 1 => 'yes'))) ->add('save', 'submit'); } public function getName() { return 'offer'; } public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Anytv\DashboardBundle\Entity\Offer', )); } }
gcnonato/anytv-sf2
src/Anytv/DashboardBundle/Form/Type/OfferType.php
PHP
mit
1,129
version https://git-lfs.github.com/spec/v1 oid sha256:e330e85aabf65a6116144dfe2e726f649a1cdfd88a33e6ce4e3a39f40ebadfbb size 153184
yogeshsaroya/new-cdnjs
ajax/libs/highmaps/1.0.2/highcharts.js
JavaScript
mit
131
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Router | ninejs</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> <script src="../assets/js/modernizr.js"></script> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">ninejs</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="../modules/_client_router_.html">&quot;client/router&quot;</a> </li> <li> <a href="_client_router_.router.html">Router</a> </li> </ul> <h1>Class Router</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a> <ul class="tsd-hierarchy"> <li> <span class="target">Router</span> </li> </ul> </li> </ul> </section> <section class="tsd-panel"> <h3>Implements</h3> <ul class="tsd-hierarchy"> <li><a href="../interfaces/_client_router_.routerbase.html" class="tsd-signature-type">RouterBase</a></li> </ul> </section> <section class="tsd-panel tsd-kind-class tsd-parent-kind-external-module"> <h3 class="tsd-before-signature">Indexable</h3> <div class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">[</span>name: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></div> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="_client_router_.router.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#_njsconstructors" class="tsd-kind-icon">$njs<wbr>Constructors</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#_njswatch" class="tsd-kind-icon">$njs<wbr>Watch</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_client_router_.router.html#hashhandler" class="tsd-kind-icon">hash<wbr>Handler</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_client_router_.router.html#initaction" class="tsd-kind-icon">init<wbr>Action</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_client_router_.router.html#loadaction" class="tsd-kind-icon">load<wbr>Action</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_client_router_.router.html#routes" class="tsd-kind-icon">routes</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#addroute" class="tsd-kind-icon">add<wbr>Route</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#destroy" class="tsd-kind-icon">destroy</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#dispatchroute" class="tsd-kind-icon">dispatch<wbr>Route</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#emit" class="tsd-kind-icon">emit</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#get" class="tsd-kind-icon">get</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#go" class="tsd-kind-icon">go</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#mixinproperties" class="tsd-kind-icon">mixin<wbr>Properties</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#mixinrecursive" class="tsd-kind-icon">mixin<wbr>Recursive</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#on" class="tsd-kind-icon">on</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#register" class="tsd-kind-icon">register</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#removeroute" class="tsd-kind-icon">remove<wbr>Route</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#set" class="tsd-kind-icon">set</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_client_router_.router.html#startup" class="tsd-kind-icon">startup</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_client_router_.router.html#watch" class="tsd-kind-icon">watch</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"><a href="_client_router_.router.html#getobject" class="tsd-kind-icon">get<wbr>Object</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"><a href="_client_router_.router.html#mixin" class="tsd-kind-icon">mixin</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <li class="tsd-signature tsd-kind-icon">new <wbr>Router<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_client_router_.router.html" class="tsd-signature-type">Router</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Overwrites <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#constructor">constructor</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L217">client/router.ts:217</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <a href="_client_router_.router.html" class="tsd-signature-type">Router</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> <a name="_njsconstructors" class="tsd-anchor"></a> <h3>$njs<wbr>Constructors</h3> <div class="tsd-signature tsd-kind-icon">$njs<wbr>Constructors<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">[]</span></div> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#_njsconstructors">$njsConstructors</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L206">core/ext/Properties.ts:206</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>args: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> <a name="_njswatch" class="tsd-anchor"></a> <h3>$njs<wbr>Watch</h3> <div class="tsd-signature tsd-kind-icon">$njs<wbr>Watch<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#_njswatch">$njsWatch</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L203">core/ext/Properties.ts:203</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-index-signature"> <h5><span class="tsd-signature-symbol">[</span>name: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">[]</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter"> <h5>action<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-variable tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, oldValue<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, newValue<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>oldValue: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>newValue: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> <li class="tsd-parameter"> <h5>remove<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-variable tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="hashhandler" class="tsd-anchor"></a> <h3>hash<wbr>Handler</h3> <div class="tsd-signature tsd-kind-icon">hash<wbr>Handler<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L190">client/router.ts:190</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter"> <h5>remove<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-variable tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="initaction" class="tsd-anchor"></a> <h3>init<wbr>Action</h3> <div class="tsd-signature tsd-kind-icon">init<wbr>Action<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">function</span></div> <aside class="tsd-sources"> <p>Implementation of <a href="../interfaces/_client_router_.routerbase.html">RouterBase</a>.<a href="../interfaces/_client_router_.routerbase.html#initaction">initAction</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L90">client/router.ts:90</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>evt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>evt: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="loadaction" class="tsd-anchor"></a> <h3>load<wbr>Action</h3> <div class="tsd-signature tsd-kind-icon">load<wbr>Action<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">function</span></div> <aside class="tsd-sources"> <p>Implementation of <a href="../interfaces/_client_router_.routerbase.html">RouterBase</a>.<a href="../interfaces/_client_router_.routerbase.html#loadaction">loadAction</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L91">client/router.ts:91</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, evt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>args: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>evt: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="routes" class="tsd-anchor"></a> <h3>routes</h3> <div class="tsd-signature tsd-kind-icon">routes<span class="tsd-signature-symbol">:</span> <a href="_client_router_.route.html" class="tsd-signature-type">Route</a><span class="tsd-signature-symbol">[]</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L191">client/router.ts:191</a></li> </ul> </aside> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="addroute" class="tsd-anchor"></a> <h3>add<wbr>Route</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">add<wbr>Route<span class="tsd-signature-symbol">(</span>route<span class="tsd-signature-symbol">: </span><a href="_client_router_.route.html" class="tsd-signature-type">Route</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_client_router_.route.html" class="tsd-signature-type">Route</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L120">client/router.ts:120</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>route: <a href="_client_router_.route.html" class="tsd-signature-type">Route</a></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="_client_router_.route.html" class="tsd-signature-type">Route</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="destroy" class="tsd-anchor"></a> <h3>destroy</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">destroy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L131">client/router.ts:131</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="dispatchroute" class="tsd-anchor"></a> <h3>dispatch<wbr>Route</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">dispatch<wbr>Route<span class="tsd-signature-symbol">(</span>evt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L135">client/router.ts:135</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>evt: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="emit" class="tsd-anchor"></a> <h3>emit</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">emit<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>arglist<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L95">client/router.ts:95</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>arglist: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="get" class="tsd-anchor"></a> <h3>get</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">get<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#get">get</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L138">core/ext/Properties.ts:138</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">string</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="go" class="tsd-anchor"></a> <h3>go</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">go<span class="tsd-signature-symbol">(</span>route<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, replace<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L103">client/router.ts:103</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>route: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> replace: <span class="tsd-signature-type">boolean</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="mixinproperties" class="tsd-anchor"></a> <h3>mixin<wbr>Properties</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">mixin<wbr>Properties<span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#mixinproperties">mixinProperties</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L195">core/ext/Properties.ts:195</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>target: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="mixinrecursive" class="tsd-anchor"></a> <h3>mixin<wbr>Recursive</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">mixin<wbr>Recursive<span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#mixinrecursive">mixinRecursive</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L199">core/ext/Properties.ts:199</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>target: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="on" class="tsd-anchor"></a> <h3>on</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L92">client/router.ts:92</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>type: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>listener: <span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>e<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> e: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="register" class="tsd-anchor"></a> <h3>register</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">register<span class="tsd-signature-symbol">(</span>route<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, action<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">function</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_client_router_.route.html" class="tsd-signature-type">Route</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L98">client/router.ts:98</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>route: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> action: <span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>evt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>evt: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="_client_router_.route.html" class="tsd-signature-type">Route</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="removeroute" class="tsd-anchor"></a> <h3>remove<wbr>Route</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">remove<wbr>Route<span class="tsd-signature-symbol">(</span>route<span class="tsd-signature-symbol">: </span><a href="_client_router_.route.html" class="tsd-signature-type">Route</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L124">client/router.ts:124</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>route: <a href="_client_router_.route.html" class="tsd-signature-type">Route</a></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="set" class="tsd-anchor"></a> <h3>set</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">set<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, <span class="tsd-signature-symbol">...</span>values<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#set">set</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L149">core/ext/Properties.ts:149</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>values: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="startup" class="tsd-anchor"></a> <h3>startup</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">startup<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/client/router.ts#L192">client/router.ts:192</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="watch" class="tsd-anchor"></a> <h3>watch</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">watch<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, action<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_core_ext_properties_.watchhandle.html" class="tsd-signature-type">WatchHandle</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#watch">watch</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L185">core/ext/Properties.ts:185</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>action: <span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, oldValue<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, newValue<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>oldValue: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>newValue: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="../interfaces/_core_ext_properties_.watchhandle.html" class="tsd-signature-type">WatchHandle</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a name="getobject" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Object</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <li class="tsd-signature tsd-kind-icon">get<wbr>Object<span class="tsd-signature-symbol">(</span>obj<span class="tsd-signature-symbol">: </span><a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#getobject">getObject</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L242">core/ext/Properties.ts:242</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>obj: <a href="_core_ext_properties_.default.html" class="tsd-signature-type">default</a></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a name="mixin" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> mixin</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <li class="tsd-signature tsd-kind-icon">mixin<span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">(Anonymous function)</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="_core_ext_properties_.default.html">default</a>.<a href="_core_ext_properties_.default.html#mixin">mixin</a></p> <ul> <li>Defined in <a href="https://github.com/ninejs/ninejs/blob/master/core/ext/Properties.ts#L233">core/ext/Properties.ts:233</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>target: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">(Anonymous function)</span></h4> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="../globals.html"><em>Globals</em></a> </li> <li class="current tsd-kind-external-module"> <a href="../modules/_client_router_.html">"client/router"</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> <li class=" tsd-kind-class tsd-parent-kind-external-module"> <a href="_client_router_.route.html" class="tsd-kind-icon">Route</a> </li> </ul> <ul class="current"> <li class="current tsd-kind-class tsd-parent-kind-external-module"> <a href="_client_router_.router.html" class="tsd-kind-icon">Router</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a href="_client_router_.router.html#constructor" class="tsd-kind-icon">constructor</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#_njsconstructors" class="tsd-kind-icon">$njs<wbr>Constructors</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#_njswatch" class="tsd-kind-icon">$njs<wbr>Watch</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class"> <a href="_client_router_.router.html#hashhandler" class="tsd-kind-icon">hash<wbr>Handler</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class"> <a href="_client_router_.router.html#initaction" class="tsd-kind-icon">init<wbr>Action</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class"> <a href="_client_router_.router.html#loadaction" class="tsd-kind-icon">load<wbr>Action</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class"> <a href="_client_router_.router.html#routes" class="tsd-kind-icon">routes</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#addroute" class="tsd-kind-icon">add<wbr>Route</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#destroy" class="tsd-kind-icon">destroy</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#dispatchroute" class="tsd-kind-icon">dispatch<wbr>Route</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#emit" class="tsd-kind-icon">emit</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#get" class="tsd-kind-icon">get</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#go" class="tsd-kind-icon">go</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#mixinproperties" class="tsd-kind-icon">mixin<wbr>Properties</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#mixinrecursive" class="tsd-kind-icon">mixin<wbr>Recursive</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#on" class="tsd-kind-icon">on</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#register" class="tsd-kind-icon">register</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#removeroute" class="tsd-kind-icon">remove<wbr>Route</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#set" class="tsd-kind-icon">set</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="_client_router_.router.html#startup" class="tsd-kind-icon">startup</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a href="_client_router_.router.html#watch" class="tsd-kind-icon">watch</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a href="_client_router_.router.html#getobject" class="tsd-kind-icon">get<wbr>Object</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a href="_client_router_.router.html#mixin" class="tsd-kind-icon">mixin</a> </li> </ul> </li> </ul> <ul class="after-current"> <li class=" tsd-kind-interface tsd-parent-kind-external-module"> <a href="../interfaces/_client_router_.routeoptions.html" class="tsd-kind-icon">Route<wbr>Options</a> </li> <li class=" tsd-kind-interface tsd-parent-kind-external-module"> <a href="../interfaces/_client_router_.routerbase.html" class="tsd-kind-icon">Router<wbr>Base</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#activeroutedefer" class="tsd-kind-icon">active<wbr>Route<wbr>Defer</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#globmatch" class="tsd-kind-icon">glob<wbr>Match</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#globreplacement" class="tsd-kind-icon">glob<wbr>Replacement</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#idmatch" class="tsd-kind-icon">id<wbr>Match</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#idreplacement" class="tsd-kind-icon">id<wbr>Replacement</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#router-1" class="tsd-kind-icon">router</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#window" class="tsd-kind-icon">window</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#addroute" class="tsd-kind-icon">add<wbr>Route</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#cleanroute" class="tsd-kind-icon">clean<wbr>Route</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#convertroutetoregexp" class="tsd-kind-icon">convert<wbr>Route<wbr>ToReg<wbr>Exp</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#emit" class="tsd-kind-icon">emit</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#getparameternames" class="tsd-kind-icon">get<wbr>Parameter<wbr>Names</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#getroute" class="tsd-kind-icon">get<wbr>Route</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#go" class="tsd-kind-icon">go</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#itemsremove" class="tsd-kind-icon">items<wbr>Remove</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#nullf" class="tsd-kind-icon">nullf</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#on" class="tsd-kind-icon">on</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#preparearguments" class="tsd-kind-icon">prepare<wbr>Arguments</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#register" class="tsd-kind-icon">register</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#removeroute" class="tsd-kind-icon">remove<wbr>Route</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported"> <a href="../modules/_client_router_.html#setroute" class="tsd-kind-icon">set<wbr>Route</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module"> <a href="../modules/_client_router_.html#startup" class="tsd-kind-icon">startup</a> </li> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li> <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li> <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li> <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li> <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li> <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li> <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li> <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li> <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li> <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li> <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li> <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="http://typedoc.io" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="../assets/js/main.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script> </body> </html>
novosit/ninejs
docs/classes/_client_router_.router.html
HTML
mit
60,862
CREATE TABLE user_pwd ( name CHAR(30) NOT NULL, pass CHAR(32) NOT NULL, PRIMARY KEY (name) )
mchakon/afc
restricted/user_pwd.sql
SQL
mit
110
package com.freetymekiyan.algorithms.other; import org.junit.Assert; import org.junit.Test; /** * Suppose you are a salesman who travel around for business. Given n cities, for city i you can do business Ci times. * If you cannot go to the same city the next day. Find the maximum days you can do business. * <p> * Example 1: * Input: [7, 3, 2] * Output: 11 * <p> * Example 2: * Input: [1000, 1, 1, 1] * Output: 7 */ public class MaxSales { public int maxSalesTime(int[] c) { if (c == null || c.length == 0) { return 0; } if (c.length == 1) { return c[0] > 0 ? 1 : 0; } int n = c.length; int max = 0; int index = -1; while (true) { int curMax = Integer.MIN_VALUE; int curIdx = -1; for (int j = 0; j < n; j++) { if (index != -1 && j == index) { continue; } if (c[j] > curMax) { curMax = c[j]; curIdx = j; } } index = curIdx; if (c[index]-- == 0) { break; } max++; } return max; } @Test public void testExamples() { MaxSales m = new MaxSales(); int[] c = {1000, 1, 1, 1}; Assert.assertEquals(7, m.maxSalesTime(c)); c = new int[]{7, 3, 2}; Assert.assertEquals(11, m.maxSalesTime(c)); c = new int[]{7, 3, 2, 1}; Assert.assertEquals(13, m.maxSalesTime(c)); } }
FreeTymeKiyan/LeetCode-Sol-Res
src/main/java/com/freetymekiyan/algorithms/other/MaxSales.java
Java
mit
1,587
from django.db import models from django.contrib.auth.models import User from django.utils.html import escape from django.db.models import Q from datetime import date from datetime import datetime from MessagesApp.models import Thread from BlockPages.models import BlockPage, BlockEvent, EventComment from SpecialInfoApp.models import Interest, HasInterest, School, HasSchool, LivingLoc, HasLivingLoc, Workplace, HasWorkplace from PostsApp.models import Comment import helper_functions import settings # Create your models here. class UserProfile(models.Model): #Required field user = models.ForeignKey(User, unique=True) #Extra info #Enumerated data for columns that can only have a finite set of choices RELATIONSHIP_STATUSES = ( (u'S', u'Single'), (u'M', u'Married'), ) GENDER_CHOICES = ( (u'M', u'Male'), (u'F', u'Female'), (u'B', u'Both'), (u'U', u'Unspecified'), ) PRIVACY_CHOICES = ( (u'p', u'Private'), (u'P', u'Public'), ) #Define extra fields that will form the user profile relationship_status = models.CharField(max_length=2, choices=RELATIONSHIP_STATUSES, default=u'S') profile_pic = models.ForeignKey('userInfo.ImageHolder', null=True) birthday = models.DateField(null=True, blank=True) about_me = models.TextField(null=True) gender = models.CharField(max_length=2, choices=GENDER_CHOICES, default=u'U') interested_in = models.CharField(max_length=2, choices=GENDER_CHOICES, default=u'U') activity_privacy = models.CharField(max_length=2, choices=PRIVACY_CHOICES, default=u'P') latitude = models.FloatField(null=True) longitude = models.FloatField(null=True) current_block = models.ForeignKey(BlockPage,null=True) joined = models.DateTimeField(auto_now_add=True) last_login = models.DateTimeField(auto_now_add=True) threads = models.ManyToManyField(Thread, through='MessagesApp.ThreadMembership') events = models.ManyToManyField('BlockPages.BlockEvent') #Special info m2m's interests = models.ManyToManyField(Interest, through=HasInterest) living_locs = models.ManyToManyField(LivingLoc, through=HasLivingLoc) workplaces = models.ManyToManyField(Workplace, through=HasWorkplace) schools = models.ManyToManyField(School, through=HasSchool) ########################################## #Methods used to quickly get data about user in various formats def getName(self): """Returns string containing user's first and last name""" return self.user.first_name + ' ' + self.user.last_name def getInfo(self, user_2=None): """Returns dictionary object with basic info about this user""" if user_2 == None: relationship = 'No relation.' elif user_2 == self.id: relationship = 'This is you' else: relationship = self.getRelationshipTo(User.objects.get(pk=user_2).get_profile()).get_relationship_type_display() if self.profile_pic == None: profile_pic = 'default_profile.jpg' else: profile_pic = self.profile_pic.handle return { 'name' : self.getName(), 'email' : self.user.email, 'gender' : self.get_gender_display(), 'similarity' : 0 if user_2 == None else self.getSimilarityTo(user_2), 'user_id' : self.user.id, 'username' : self.user.username, 'profile_pic' : profile_pic, 'thumbnail' : 'Thumbnails/' + profile_pic, 'relationship' : relationship } def getProfile(self, user_2=None): """Returns dictionary object containing detailed info about user suitable for the viewProfile view""" info = self.getInfo(user_2) info.update({ 'relationship_status' : self.get_relationship_status_display(), 'birthday' : 'Unspecified' if self.birthday == None else self.birthday.strftime("%m/%d/%Y"), 'interested_in' : self.get_interested_in_display(), 'about_me' : self.about_me, 'first_name' : self.user.first_name, 'last_name' : self.user.last_name }) return info def editProfile(self, request_dict): """Modifies info about self and self.user based on entered data in request_dict""" #For each field capable of being edited, make a try-except block try: new_rel_status = request_dict['relationship'] #Validate input given RELATIONSHIP_STATUSES choices for rel in self.RELATIONSHIP_STATUSES: if new_rel_status == rel[0]: self.relationship_status = rel[0] self.save() elif new_rel_status == rel[1]: self.relationship_status = rel[0] self.save() except KeyError: pass #First name try: self.user.first_name = escape(request_dict['first_name']) self.user.save() except KeyError: pass #Last name try: self.user.last_name = escape(request_dict['last_name']) self.user.save() except KeyError: pass #Gender try: new_gender = request_dict['gender'] #Validate input given GENDER_CHOICES choices for gen in self.GENDER_CHOICES: if new_gender == gen[0]: self.gender = gen[0] self.save() elif new_gender == gen[1]: self.gender = gen[0] self.save() except KeyError: pass #Interested in try: new_interested_in = request_dict['interested_in'] #Validate input given GENDER_CHOICES choices for gen in self.GENDER_CHOICES: if new_interested_in == gen[0]: self.interested_in = gen[0] self.save() elif new_interested_in == gen[1]: self.interested_in = gen[0] self.save() except KeyError: pass #Birthday try: birthday = request_dict['birthday'] #Validate input try: self.birthday = date(birthday['year'], birthday['month'], birthday['day']) self.save() except ValueError: #Invalid date pass except KeyError: pass #About me try: self.about_me = escape(request_dict['about_me']) self.save() except KeyError: pass #Not really sure how this method would fail return { 'success' : 1 } ########################################## #Methods relating to a user's friends def getFriends(self): """ Returns list of this user's friends """ try: return [e.user_2 for e in Relationship.objects.filter(user_1=self).filter(relationship_type__exact=u'F')] + [e.user_1 for e in Relationship.objects.filter(user_2=self).filter(relationship_type__exact=u'F')] except AttributeError: return [] def getFriendRequests(self, trash=None): """Expects: nothing Returns: dictionary containing list of requesting friends' info, or error message""" try: return { 'requests' : [e.user_2.get_profile().getInfo(self.id) for e in Relationship.objects.filter(user_1=self).filter(relationship_type__exact=u'P')].extend([e.user_1.get_profile().getInfo(self.id) for e in Relationship.objects.filter(user_2=self).filter(relationship_type__exact=u'P')]), 'success' : 1 } except AttributeError: return { 'success' : 0, 'error' : 'Error getting friend requests.' } def getFriendDetails(self, user_2=None): """Returns list/array of dictionary objects for each friend w/ extra details""" return [friend.get_profile().getInfo(user_2) for friend in self.getFriends()] def requestFriend(self, request_dict): """Creates new Relationship object with u'f' to specified user""" try: friend = User.objects.get(pk=request_dict['user']) except User.DoesNotExist: return { 'success' : 0, 'error' : 'User does not exist.' } except KeyError: return { 'success' : 0, 'error' : 'No user specified' } #Check to make sure there is no Relationship object already if self.getRelationshipTo(friend) != None: return { 'success' : 0, 'error' : 'You already have a relationship to this person.' } #Create relationship object Relationship(user_1=self.user, user_2=friend).save() return { 'success' : 1 } def getRelationshipTo(self, friend): """Returns verbose type of relationship between self and friend""" try: rel = Relationship.objects.get(Q(user_1=self.user, user_2=friend) | Q(user_2=self.user, user_1=friend)) except Relationship.DoesNotExist: return None return rel def confirmFriend(self, request_dict): """Modifies the Relationship object between self and specified user""" try: friend = User.objects.get(pk=request_dict['user']) except User.DoesNotExist: return { 'success' : 0, 'error' : 'User does not exist.' } except KeyError: return { 'success' : 0, 'error' : 'No user specified' } #Make sure a request exists try: request = Relationship.objects.get(user_1=friend, user_2=self.user, relationship_type__exact=u'P') except Relationship.DoesNotExist: #No request exists return { 'success' : 0, 'error' : 'No friend request exists.' } #Modify relationship type request.relationship_type = u'F' request.save() return { 'success' : 1 } def rejectFriendRequest(self, request_dict): """Removes Relationship object between self and specified user""" try: friend = User.objects.get(pk=request_dict['user']) except User.DoesNotExist: return { 'success' : 0, 'error' : 'User does not exist.' } except KeyError: return { 'success' : 0, 'error' : 'No user specified' } #Make sure a request exists try: request = Relationship.objects.get(user_1=friend, user_2=self.user, relationship_type__exact=u'P') except Relationship.DoesNotExist: #No request exists return { 'success' : 0, 'error' : 'No friend request exists.' } #Remove relationship object request.delete() return { 'success' : 1 } def removeFriend(self, request_dict): """Removes Relationship object between self and specified user""" try: friend = User.objects.get(pk=request_dict['user']) except User.DoesNotExist: return { 'success' : 0, 'error' : 'User does not exist.' } except KeyError: return { 'success' : 0, 'error' : 'No user specified' } #Make sure a request exists relationship = self.getRelationshipTo(friend) if relationship == None: return { 'success' : 0, 'error' : 'You are not friends with this user.' } #Remove relationship object relationship.delete() return { 'success' : 1 } ########################################## #Methods related to creating posts/comments def createPost(self, request_dict): """ Creates a new post object to specified user """ try: recipient = User.objects.get(pk=request_dict['recipient']).get_profile() except UserProfile.DoesNotExist: return { 'success' : 0, 'error' : 'User does not exist.' } except KeyError: #Assume they are posting a status recipient = self try: text = request_dict['text'] if text == '': raise KeyError except KeyError: return { 'success' : 0, 'error' : 'Not enough data specified.' } if recipient == self: #Add tag for user's current block Post(author=self, text=text, recipient=recipient, block=self.current_block).save() else: #Create new Post and save it Post(author=self, text=text, recipient=recipient).save() return { 'success' : 1 } def createPostComment(self, request_dict): """ Creates a comment on a post """ return self.createComment(request_dict, 'posts') def createComment(self, request_dict, type): """ Creates a new comment object for the specified post """ try: text = request_dict['text'] if text == '': raise KeyError if type == 'posts': post = Post.objects.get(pk=request_dict['post_id']) #Create new comment and save it Comment(post=post, author=self, text=text).save() else: event = BlockEvent.objects.get(pk=request_dict['event_id']) EventComment(event=event, author=self, text=text).save() except Post.DoesNotExist: return { 'success' : 0, 'error' : 'Post does not exist' } except BlockEvent.DoesNotExist: return { 'success' : 0, 'error' : 'Event does not exist' } except KeyError: return { 'success' : 0, 'error' : 'Not enough data specified' } return { 'success' : 1 } ########################################## #Methods related to posting/creating events/commenting on current block page def createBlockEvent(self, request_dict): """ Note: no longer in use Creates an event in the user's current block """ try: title = request_dict['title'] description = request_dict['description'] duration = request_dict['duration'] location = request_dict['location'] except KeyError: return { 'success' : 0, 'error' : 'Not enough data given' } if title == '' or description == '' or duration == '' or location == '': return { 'success' : 0, 'error' : 'Not enough data given' } #Create new block event BlockEvent(block_page=self.current_block, author=self, duration=duration, event_title=title, description=description, location=location).save() return { 'success' : 1 } def createEventComment(self, request_dict): """ Create comment on an event """ return self.createComment(request_dict, 'event') def attendingEvent(self, request_dict): """ Adds event in request_dict to user's events m2m field """ #Get event in question try: event_id = request_dict['event_id'] event = BlockEvent.objects.get(pk=event_id) except KeyError: return { 'success' : 0, 'error' : 'Not enough data given' } except BlockEvent.DoesNotExist: return { 'success' : 0, 'error' : 'Event does not exist' } #Add event to this user's events field self.events.add(event) self.save() return { 'success' : 1 } def getBlockActivity(self, offset=0, num_results=10): """ Gets info and feed for block user is in right now """ if self.current_block == None: return { 'success' : 0, 'error' : 'No value for block' } return self.current_block.getActivity(user=self, offset=offset, num_results=num_results) def updateCurrentBlock(self, request_dict): """ Updates the user's current block given the (latitude, longitude) pair given in request_dict """ response = None try: latitude = request_dict['latitude'] longitude = request_dict['longitude'] except KeyError: return { 'success' : 0, 'error' : 'No latitude/longitude given.' } if not response: #Calculate x and y coordinates for block (x_coord, y_coord) = helper_functions.computeXY(latitude, longitude) #Get block for these coordinates if it exists, otherwise create it changed = 1 try: block = BlockPage.objects.get(x_coordinate=x_coord, y_coordinate=y_coord) if block == self.current_block: changed = 0 except BlockPage.DoesNotExist: block = BlockPage(x_coordinate=x_coord, y_coordinate=y_coord) block.save() #Set user's current block to this self.current_block = block #Also update their last_login value self.last_login = datetime.now() self.save() return { 'success' : 1, 'changed' : changed } ########################################## #Methods related to messages def sendNewMessage(self, request_dict): """Creates a new thread with specified users, subject, and initial message""" try: sub = escape(request_dict['subject']) message = escape(request_dict['message']) recipients = request_dict['recipients'] except KeyError: #Deal with error here return { 'success' : 0, 'error' : 'Not enough data specified.' } #Create new thread new_thread = Thread(subject=sub) new_thread.save() #Add recipients (and self) to this thread ThreadMembership(user=self, thread=new_thread, has_been_read=True).save() for recipient in recipients: ThreadMembership(user=User.objects.get(username=recipient).get_profile(), thread=new_thread).save() #Create initial message Message(thread=new_thread, user=self, text=message).save() return { 'success' : 1 } def createReply(self, request_dict): """Creates a new message as part of the specified thread, then returns success/error dictionary""" try: thread = Thread.objects.get(pk=request_dict['thread_id']) message = escape(request_dict['message']) except Thread.DoesNotExist: return { 'success' : 0, 'error' : 'Thread does not exist.' } except KeyError: return { 'success' : 0, 'error' : 'Not enough data specified.' } #Create new message for thread Message(thread=thread, user=self, text=message).save() #Set all other memberships in this thread to unread for thread_mem in ThreadMembership.objects.filter(thread=thread): if thread_mem.user != self: thread_mem.has_been_read = False thread_mem.save() return { 'success' : 1 } def getThreads(self, request_dict): """ Returns list of dictionary objects containing info about most recent threads """ threads = [ thread.getThreadInfo(self) for thread in self.threads.all() ] return { 'success' : 1, 'threads' : sorted(threads, key=lambda thread: helper_functions.inverse_my_strftime(thread['last_message']['timestamp']), reverse=True)} def numUnreadMessages(self, request_dict): """Returns dictionary object containing num_unread integer""" return { 'success' : 1, 'number_unread' : len(ThreadMembership.objects.filter(user=self, has_been_read=False)) } ########################################## #Methods related to activity feeds def getActivity(self, requesting_user, offset=0, max_num=10): """ Returns list of dictionary objects containing most recent actions by this user requesting_user contains the logged in user (or none if no one is logged in) request_dict holds some optional info such as the max number of entries to return, and index offset """ #Declare list to hold all of the activity dictionary objects all_activity = [] #Get posts to this user or from this user all_activity.extend([ post.getDetail() for post in Post.objects.filter(Q(author=self) | Q(recipient=self)).order_by('-time_posted')[offset:max_num+offset] ]) #Get new friendships #all_activity.extend([ relationship.getDetail() for relationship in Relationship.objects.filter(Q(user_1=self) | Q(user_2=self)).filter(relationship_type__exact=u'F').order_by('-timestamp')[offset:max_num+offset] ]) #Get changes in extra info #all_activity.extend([ has_interest.getDetail() for has_interest in HasInterest.objects.filter(user=self).order_by('-time_added')[offset:max_num+offset] ]) #all_activity.extend([ has_school.getDetail() for has_school in HasSchool.objects.filter(user=self).order_by('-time_added')[offset:max_num+offset] ]) #all_activity.extend([ has_living_loc.getDetail() for has_living_loc in HasLivingLoc.objects.filter(user=self).order_by('-time_added')[offset:max_num+offset] ]) #all_activity.extend([ has_workplace.getDetail() for has_workplace in HasWorkplace.objects.filter(user=self).order_by('-time_added')[offset:max_num+offset] ]) #Sort all_activity by timestamp, descending #Limit all_activity from index_offset to max_num return sorted(all_activity, key=lambda item: helper_functions.inverse_my_strftime(item['timestamp']), reverse=True) def getUserActivity(self, requesting_user, offset=0, max_num=150): """Returns dictionary containing activity for specified user""" return { 'success' : 1, 'info' : self.getInfo(), 'activity' : self.getActivity(requesting_user, offset) } def getFriendFeed(self, offset=0, max_num=15): """Returns list composed of the user activity feeds of this user's friends""" #Get all the activity for the user's friends friend_feed = [] for friend in self.getFriends(): friend_feed.extend(friend.get_profile().getActivity(self, offset)) #Sort it and limit it to from offset to max_num friend_feed = sorted(friend_feed, key=lambda item: helper_functions.inverse_my_strftime(item['timestamp']), reverse=True)[offset:max_num+offset] return { 'success' : 1, 'activity' : friend_feed } ########################################## #Methods related to determining similarity between users #TODO def getSimilarityTo(self, user_id): """ Returns integer (on scale of 0 to 100) representing the user's similarity to the other user """ if user_id == self.id: return 100 #Get other user try: user = User.objects.get(pk=user_id) except User.DoesNotExist: return 0 #Note: intersection_score = len(intersect(set1, set2))/(len(set1)+len(set2) - len(intersect(set1, set2))) which is in [0,1] #Get intersection of friends friends1 = set(self.getFriends()) friends2 = set(user.get_profile().getFriends()) intersect_size = len(friends1 & friends2) friends_score = intersect_size/(len(friends1)+len(friends2)-intersect_size) #Get intersection of extra info's #Take into account metadata for extra info's #Stopgap return int(friends_score * 100) ########################################## #184 lines #Methods related to extra info retrieval, adding, and removal def getInterests(self): """Returns list of the interests for this user""" return [ info.getDetail() for info in HasInterest.objects.filter(user=self) ] def getSchools(self): """Returns list of the schools for this user""" return [ info.getDetail() for info in HasSchool.objects.filter(user=self) ] def getLivingLocs(self): """Returns list of the living locations for this user""" return [ info.getDetail() for info in HasLivingLoc.objects.filter(user=self) ] def getWorkplaces(self): """Returns list of the workplaces for this user""" return [ info.getDetail() for info in HasWorkplace.objects.filter(user=self) ] def addInterest(self, request_dict): """Adds interest for this user, creating new Interest object if necessary""" try: interest_title = escape(request_dict['interest']) except KeyError: return { 'success' : 0, 'error' : 'No interest given.' } #Check if interest exists already try: interest = Interest.objects.get(title=interest_title) except Interest.DoesNotExist: #Make new interest object interest = Interest.objects.create(title=interest_title) #Check if user already has this interest if interest in self.interests.all(): return { 'success' : 0, 'error' : 'You already have this interest.' } #Add this interest to this user HasInterest.objects.create(user=self, interest=interest) return { 'success' : 1 } def addSchool(self, request_dict): """Adds school for this user, creating new School object if necessary""" try: school_title = escape(request_dict['school']) started = escape(request_dict['started']) if 'started' in request_dict else None ended = escape(request_dict['ended']) if 'ended' in request_dict else None studied = escape(request_dict['studied']) if 'studied' in request_dict else '' except KeyError: return { 'success' : 0, 'error' : 'No school given.' } #Check if school object exists already try: school = School.objects.get(title=school_title) except School.DoesNotExist: #Make new school object school = School.objects.create(title=school_title) #Check if user already has this school if school in self.schools.all(): #Check if the other info for this school is the same has_school = HasSchool.objects.get(school=school, user=self) if (has_school.date_started == started and has_school.date_ended == ended and studied == has_school.studied): return { 'success' : 0, 'error' : 'You have already added this school.' } #Add this school to this user HasSchool.objects.create(user=self, school=school, studied=studied, date_started=started, date_ended=ended) return { 'success' : 1 } def addLivingLoc(self, request_dict): """Adds living location for this user, creating new LivingLoc object if necessary""" try: living_loc_title = escape(request_dict['living_loc']) started = escape(request_dict['started']) if 'started' in request_dict else None ended = escape(request_dict['ended']) if 'ended' in request_dict else None except KeyError: return { 'success' : 0, 'error' : 'No living location given.' } #Check if living_loc object exists already try: living_loc = LivingLoc.objects.get(title=living_loc_title) except LivingLoc.DoesNotExist: #Make new LivingLoc object living_loc = LivingLoc.objects.create(title=living_loc_title) #Check if user already has this living location if living_loc in self.living_locs.all(): #Check if the other info for this living location is the same has_living_loc = HasLivingLoc.objects.get(living_loc=living_loc, user=self) if (has_living_loc.date_started == started and has_living_loc.date_ended == ended): return { 'success' : 0, 'error' : 'You have already added this living location.' } #Add this living_loc to this user HasLivingLoc.objects.create(user=self, living_loc=living_loc, date_started=started, date_ended=ended) return { 'success' : 1 } def addWorkplace(self, request_dict): """Adds workplace for this user, creating new Workplace object if necessary""" try: workplace_title = escape(request_dict['workplace']) started = escape(request_dict['started']) if 'started' in request_dict else None ended = escape(request_dict['ended']) if 'ended' in request_dict else None job = escape(request_dict['job']) if 'job' in request_dict else '' except KeyError: return { 'success' : 0, 'error' : 'No workplace given.' } #Check if workplace object exists already try: workplace = Workplace.objects.get(title=workplace_title) except Workplace.DoesNotExist: #Make new Workplace object workplace = Workplace.objects.create(title=workplace_title) #Check if user already has this workplace if workplace in self.workplaces.all(): #Check if the other info for this workplace is the same has_workplace = HasWorkplace.objects.get(workplace=workplace, user=self) if (has_workplace.date_started == started and has_workplace.date_ended == ended and has_workplace.job == job): return { 'success' : 0, 'error' : 'You have already added this workplace.' } #Add this workplace to this user HasWorkplace.objects.create(user=self, workplace=workplace, job=job, date_started=started, date_ended=ended) return { 'success' : 1 } def removeInterest(self, request_dict): """Removes user's interest by the HasInterest id""" try: has_id = request_dict['interest'] except KeyError: return { 'success' : 0, 'error' : 'No interest given.' } #Make sure user actually has the info try: has_info = HasInterest.objects.get(pk=has_id) except HasInterest.DoesNotExist: return { 'success' : 0, 'error' : 'You do not have this interest.' } #Remove the info has_info.delete() return { 'success' : 1 } def removeSchool(self, request_dict): """Removes user's school by the HasSchool id""" try: has_id = request_dict['school'] except KeyError: return { 'success' : 0, 'error' : 'No school given.' } #Make sure user actually has the info try: has_info = HasSchool.objects.get(pk=has_id) except HasSchool.DoesNotExist: return { 'success' : 0, 'error' : 'You have not added this school.' } #Remove the info has_info.delete() return { 'success' : 1 } def removeLivingLoc(self, request_dict): """Removes user's living location by the HasLivingLoc id""" try: has_id = request_dict['living_loc'] except KeyError: return { 'success' : 0, 'error' : 'No living location given.' } #Make sure user actually has the info try: has_info = HasLivingLoc.objects.get(pk=has_id) except HasLivingLoc.DoesNotExist: return { 'success' : 0, 'error' : 'You have not added this living location.' } #Remove the info has_info.delete() return { 'success' : 1 } def removeWorkplace(self, request_dict): """Removes user's workplace by the HasWorkplace id""" try: has_id = request_dict['workplace'] except KeyError: return { 'success' : 0, 'error' : 'No workplace given.' } #Make sure user actually has the info try: has_info = HasWorkplace.objects.get(pk=has_id) except HasWorkplace.DoesNotExist: return { 'success' : 0, 'error' : 'You have not added this workplace.' } #Remove the info has_info.delete() return { 'success' : 1 } ########################################## #Methods related to notifications def getNotifications(self): """Returns all entries from Notifications table for this user sorted by timestamp""" notification_list = [] for notification in self.notification_set.all(): if notification.data_type == u'P': #Post notification_list.append(Post.objects.get(pk=notification.object_id).getDetail().update({'type':notification.get_data_type_display()})) elif notification.data_type == u'M': #Message notification_list.append(Message.objects.get(pk=notification.object_id).getDetail().update({'type':notification.get_data_type_display()})) elif notification.data_type == u'C': #Comment notification_list.append(Comment.objects.get(pk=notification.object_id).getDetail().update({'type':notification.get_data_type_display()})) elif notification.data_type == u'F': #Friend request notification_list.append(Relationship.objects.get(pk=notification.object_id).getDetail().update({'type':notification.get_data_type_display()})) def pushNotification(self, data_type, object_id): """Adds notification for this user""" Notification(user=self, data_type=data_type, object_id=object_id).save() class Relationship(models.Model): """ Represents a relationship between two users, including type """ RELATIONSHIP_TYPES = ( (u'P', u'Pending Friend'), (u'F', u'Friend'), ) user_1 = models.ForeignKey(User, related_name='+') user_2 = models.ForeignKey(User, related_name='+') relationship_type = models.CharField(max_length=2, choices=RELATIONSHIP_TYPES, default=u'P') timestamp = models.DateTimeField(auto_now_add=True) def getDetail(self): """Returns dictionary object containing basic info""" return { 'id' : self.id, 'user_1' : self.user_1.get_profile().getInfo(), 'user_2' : self.user_2.get_profile().getInfo(), 'relationship_type' : self.get_relationship_type_display(), 'type' : 'relationship', 'timestamp' : helper_functions.my_strftime(self.timestamp) } class Notification(models.Model): """ Represents a notification for this user """ NOTIFICATION_TYPES = ( (u'P', u'Post'), (u'M', u'Message'), (u'C', u'Comment'), (u'F', u'Friend Request'), ) #TODO convert this to using generic foreign keys user = models.ForeignKey(UserProfile) data_type = models.CharField(max_length=2, choices=NOTIFICATION_TYPES) object_id = models.IntegerField() #Hold's the id of the notification time_created = models.DateTimeField(auto_now_add=True) class ImageHolder(models.Model): """ Manages an image, including resizing for the thumbnail and holding the path to the thumbnail and the fullsize image """ file = models.ImageField(upload_to=settings.IMAGE_UPLOAD_PATH, null=True) thumbnail = models.ImageField(upload_to=settings.THUMBNAIL_UPLOAD_PATH, null=True) creator = models.ForeignKey(UserProfile) handle = models.CharField(max_length=100, null=True) caption = models.TextField(null=True) timestamp = models.DateTimeField(auto_now_add=True) #Import at end of file in order to avoid circular imports from MessagesApp.models import Thread, Message, ThreadMembership from PostsApp.models import Post
rishabhsixfeet/Dock-
userInfo/models.py
Python
mit
35,677
<?xml version="1.0" encoding="utf-8"?> <!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" xml:lang="en" lang="en"> <head> <title>named_base.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../../../../../../../../../../../../../../css/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../../../../css/main.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../../../../css/github.css" type="text/css" media="screen" /> <script src="../../../../../../../../../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="banner"> <span>Ruby on Rails 4.1.8</span><br /> <h1> named_base.rb </h1> <ul class="files"> <li> ../../../../usr/local/share/gems/gems/railties-4.1.8/lib/rails/generators/named_base.rb </li> <li>Last modified: 2014-11-25 22:17:28 +0530</li> </ul> </div> <div id="bodyContent"> <div id="content"> <!-- File only: requires --> <div class="sectiontitle">Required Files</div> <ul> <li>active_support/core_ext/module/introspection</li> <li>rails/generators/base</li> <li>rails/generators/generated_attribute</li> </ul> <!-- Namespace --> <div class="sectiontitle">Namespace</div> <ul> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../../../classes/ActiveRecord.html">ActiveRecord</a> </li> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../../../classes/Rails.html">Rails</a> </li> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../../../classes/Rails/Generators.html">Rails::Generators</a> </li> <li> <span class="type">CLASS</span> <a href="../../../../../../../../../../../../../../classes/Rails/Generators/NamedBase.html">Rails::Generators::NamedBase</a> </li> </ul> <!-- Methods --> </div> </div> </body> </html>
mojo1643/Dalal_v2
doc/api/files/__/__/__/__/usr/local/share/gems/gems/railties-4_1_8/lib/rails/generators/named_base_rb.html
HTML
mit
2,986
<?php /****************************************************************************** * An implementation of dicto (scg.unibe.ch/dicto) in and for PHP. * * Copyright (c) 2016 Richard Klees <richard.klees@rwth-aachen.de> * * This software is licensed under GPLv3. You should have received * a copy of the licence along with the code. */ namespace Lechimp\Dicto\App; /** * Get the current state of the sourcecode by using git. */ class SourceStatusGit implements SourceStatus { /** * @var string */ protected $path; /** * @param string $path */ public function __construct($path) { assert('is_string($path)'); $this->path = $path; } /** * @inheritdoc */ public function commit_hash() { $escaped_path = escapeshellarg($this->path); $command = "git -C $escaped_path rev-parse HEAD"; exec($command, $output, $returned); if ($returned !== 0) { throw new \RuntimeException(implode("\n", $output)); } return $output[0]; } }
lechimp-p/dicto.php
src/App/SourceStatusGit.php
PHP
mit
1,078
/** * report business validation library */ var async = require('async'); module.exports = function(services, logger) { var me = this; me.validate = function(object, callback) { var errors = []; me.done = function() { var bVal = {valid: !(errors.length), errors: errors}; callback(bVal); }; me.validateObject(object, errors, me.done); }; /** * Default messages to include with validation errors. */ me.messages = { alpha_report_id: "Alpha Report id is invalid", target_event_id: "Target Event id is invalid", profile_id: "Profile id is invalid", assertions: "Assertions are invalid" }; me.validateObject = function(object, errors, done) { var value = object.alpha_report_id; me.alphaReportExists(value, errors, function (err, found) { var property = 'alpha_report_id'; if (value !== undefined){ if (!found) { me.error(property, value, errors, "Alpha Report does not exist."); logger.debug("alphaReportExists " + value + " does not exist."); } } value = object.target_event_id; me.targetEventExists(value, errors, function(err, found) { var property = 'target_event_id'; if (value !== undefined) { if (!found){ me.error(property, value, errors, "Target Event does not exist."); logger.debug("targetEventExists " + value + " does not exist."); } } value = object.profile_id; me.profileExists(value, errors, function(err, found) { var property = 'profile_id'; if (value !== undefined) { if (!found) { me.error(property, value, errors, "Profile does not exist."); logger.debug("profileExists " + value + " does not exist"); } } value = object.assertions; me.assertionsExist(value, errors, function(err, found) { var property = 'assertions'; if (value !== undefined) { if (!found) { me.error(property, value, errors, "Assertions do not exist."); logger.info("assertionsExist " + value + " do not exist"); } } done(); }); }); }); }); }; //alpha report exists me.alphaReportExists = function(value, errors, callback) { services.alphaReportService.get(value, function(err, docs) { if (err) { me.error('alpha_report_id', value, errors, 'Error reading alpha_report_id ' + err); logger.error("Error getting alphaReport by id ", err); callback(err, false); } else if (0 !== docs.length) { logger.info("Alpha Report found for alphaReportExists" + JSON.stringify(docs)); callback(err, true); } else { logger.info("Alpha Report not found " + value); callback(err, false); } }); }; me.targetEventExists = function(value, errors, callback) { if(typeof(value) === 'undefined' || !value) { callback(null, true); } else { services.targetEventService.get(value, function(err, docs){ if (err) { me.error('target_event_id', value, errors, 'Error reading target_event_id ' + err); me.logger.error("Error getting targetEvent by id ", err); callback(err, false); } else if (0 !== docs.length) { me.logger.info("Target Event found for targetEventIsValid" + JSON.stringify(docs)); callback(err, true); } else { me.logger.info("Target Event not found " + value); callback(err, false); } }); } }; me.profileExists = function(value, errors, callback) { if(typeof(value) === 'undefined' || !value) { callback(null, true); } else { services.profileService.get(value, function(err, docs) { if (err) { me.error('profile_id', value, errors, 'Error reading profile ' + err); logger.error("Error getting profile by id ", err); callback(err, false); } else if (0 !== docs.length) { logger.info("Profile found for profile" + JSON.stringify(docs)); callback(err, true); } else { logger.info("Profile string not found " + value); callback(err, false); } }); } }; me.assertionsExist = function(value, errors, callback) { if (typeof(value) === 'undefined' || value.length === 0) { callback(null, true); } else { async.each(value, function(assertion, eachCallback) { services.assertionService.get(assertion, function(err, assertionDoc) { if (err) { me.error('assertions', value, errors, 'Error reading assertion ' + err); logger.error("Error getting assertion by id ", err); eachCallback(err); } else if (0 !== assertionDoc.length) { logger.info("Assertion found for assertionsAreValid" + JSON.stringify(assertionDoc)); eachCallback(err); } else { logger.info("Assertion not found " + value); eachCallback(err); } }); }, function (err) { if (err) { callback(err, false); } else { callback(err, true); } }); } }; me.error = function(property, actual, errors, msg) { var lookup = { property : property }; var message = msg || me.messages[property] || "no default message"; message = message.replace(/%\{([a-z]+)\}/ig, function(_, match) { var msg = lookup[match.toLowerCase()] || ""; return msg; }); errors.push({ property : property, actual : actual, message : message }); }; };
NextCenturyCorporation/healthcare-demo
models/report/bvalidator.js
JavaScript
mit
5,236
# urbanjs-tools [![Build Status](https://travis-ci.org/urbanjs/urbanjs-tools.svg?branch=master)](https://travis-ci.org/urbanjs/urbanjs-tools) ### Quick start Initialize the necessary tasks and presets in your gulpfile.js: ``` const tools = require('urbanjs-tools'); tools.initialize(gulp, { babel: true, checkDependencies: true, checkFileNames: true, conventionalChangelog: true, eslint: true, jsdoc: true, mocha: true, nsp: true, retire: true, tslint: true, webpack: true }); ``` **And that's it, you're good to go.** You can run any of the gulp tasks above (e.g. ```gulp eslint```) or you can use these [presets](https://github.com/urbanjs/urbanjs-tools/wiki/3---Usage#available-presets): - `gulp test`: runs tests (```mocha```) - `gulp analyse`: analyzes the code base (```check-dependencies```, ```check-file-names```, ```eslint```, ```nsp```, ```retire```, ```tslint```) - `gulp pre-commit`: analyzes the code base and runs tests (```analyse```, ```test```) - `gulp doc`: generates the documentation (```jsdoc```) - `gulp dist`: runs the configured transpiler/bundler (```babel```, ```webpack```) - `gulp changelog`: generates the documentation (```conventional-changelog```) - `gulp pre-release`: analyzes the code base, runs tests, generates documentation, and transpiles/bundles (```pre-commit```, ```doc```, ```dist```, ```changelog```) Additionally you can use these modifiers: - `:fix` (`eslint`, `tslint`) - `:watch` (`babel`, `webpack`, `mocha`) e.g. `gulp eslint:fix` or `gulp babel:watch` ## Documentation Check out - the [wiki](https://github.com/urbanjs/urbanjs-tools/wiki) for guides, examples and details - [api documentation](https://github.com/urbanjs/urbanjs-tools/blob/master/packages/urbanjs-tools/README.md) - README.md files of packages ## Contribution Highly appreciated any ideas how to make it more powerful.
urbanjs/urbanjs-tools
README.md
Markdown
mit
1,869
# Geometry which displays points at given (x, y) positions. immutable PointGeometry <: Gadfly.GeometryElement tag::Symbol function PointGeometry(; tag::Symbol=empty_tag) new(tag) end end const point = PointGeometry function element_aesthetics(::PointGeometry) [:x, :y, :size, :color] end # Generate a form for a point geometry. # # Args: # geom: point geometry. # theme: the plot's theme. # aes: aesthetics. # # Returns: # A compose Form. # function render(geom::PointGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) Gadfly.assert_aesthetics_defined("Geom.point", aes, :x, :y) Gadfly.assert_aesthetics_equal_length("Geom.point", aes, element_aesthetics(geom)...) default_aes = Gadfly.Aesthetics() default_aes.color = PooledDataArray(RGBA{Float32}[theme.default_color]) default_aes.size = Measure[theme.default_point_size] aes = inherit(aes, default_aes) lw_hover_scale = 10 lw_ratio = theme.line_width / aes.size[1] aes_x, aes_y = concretize(aes.x, aes.y) ctx = compose!( context(), circle(aes.x, aes.y, aes.size, geom.tag), fill(aes.color), linewidth(theme.highlight_width)) if aes.color_key_continuous != nothing && aes.color_key_continuous compose!(ctx, stroke(map(theme.continuous_highlight_color, aes.color))) else compose!(ctx, stroke(map(theme.discrete_highlight_color, aes.color)), svgclass([svg_color_class_from_label(escape_id(aes.color_label([c])[1])) for c in aes.color])) end return compose!(context(order=4), svgclass("geometry"), ctx) end
tbreloff/Gadfly.jl
src/geom/point.jl
Julia
mit
1,710
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ #include <list> #include "webrtc/base/constructormagic.h" #include "webrtc/modules/interface/module_common_types.h" #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" #include "webrtc/typedefs.h" namespace webrtc { enum RateControlRegion; bool AdaptiveThresholdExperimentIsEnabled(); class OveruseDetector { public: explicit OveruseDetector(const OverUseDetectorOptions& options); virtual ~OveruseDetector(); // Update the detection state based on the estimated inter-arrival time delta // offset. |timestamp_delta| is the delta between the last timestamp which the // estimated offset is based on and the last timestamp on which the last // offset was based on, representing the time between detector updates. // |num_of_deltas| is the number of deltas the offset estimate is based on. // Returns the state after the detection update. BandwidthUsage Detect(double offset, double timestamp_delta, int num_of_deltas, int64_t now_ms); // Returns the current detector state. BandwidthUsage State() const; private: void UpdateThreshold(double modified_offset, int64_t now_ms); void InitializeExperiment(); const bool in_experiment_; double k_up_; double k_down_; double overusing_time_threshold_; // Must be first member variable. Cannot be const because we need to be // copyable. webrtc::OverUseDetectorOptions options_; double threshold_; int64_t last_update_ms_; double prev_offset_; double time_over_using_; int overuse_counter_; BandwidthUsage hypothesis_; RTC_DISALLOW_COPY_AND_ASSIGN(OveruseDetector); }; } // namespace webrtc #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
Teamxrtc/webrtc-streaming-node
third_party/webrtc/src/webrtc/modules/remote_bitrate_estimator/overuse_detector.h
C
mit
2,313
<div class="header-proposition"> <div class="content"> <a href="#proposition-links" class="js-header-toggle menu">Menu</a> <nav id="proposition-menu"> <a href="/" id="proposition-name">Report the sale of a vehicle</a> <!-- <ul id="proposition-links"> <li><a href="url-to-page-1" class="active">Navigation item #1</a></li> <li><a href="url-to-page-2">Navigation item #2</a></li> </ul> --> </nav> </div> </div>
timpaul/vehicle_management_prototype
app/views/includes/propositional_navigation.html
HTML
mit
471
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'fakeredis' require "fakeredis/rspec" def fakeredis? true end
zegal-cn/fakeredis
spec/spec_helper.rb
Ruby
mit
199
require "counterman/hash_operations" # Public: Counterman core classs # class Counterman # Public: The timespan class. All the time span classes inherit from this one # class TimeSpan include HashOperations attr_reader :key DATE_FORMAT = "%s-%02d-%02d" TIME_FORMAT = "%02d:%02d" # Public: Initializes the base TimeSpan class # # event_name - The event to be tracked # date - A given Time object # def initialize(event_name, date) @key = build_key(event_name, time_format(date)) end private # Private: The redis key that's going to be used # # event_name - The event to be tracked # date - A given Time object # def build_key(event_name, date) [Counterman::PREFIX, event_name, date.join("-")].join("_") end end end
clearbit/counterman
lib/counterman/time_span.rb
Ruby
mit
836
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Refractored.Xam.Settings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Refractored.Xam.Settings")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.2")] [assembly: AssemblyFileVersion("1.5.2")]
labdogg1003/Xamarin.Plugins
Settings/Refractored.Xam.Settings.Android/Properties/AssemblyInfo.cs
C#
mit
1,084
#### Integrations ##### AlienVault Reputation Feed - Improved error handling for proxy and SSL errors.
demisto/content
Packs/FeedAlienVault/ReleaseNotes/1_0_10.md
Markdown
mit
104
package com.mycompany.test; import java.util.ArrayList; import java.lang.*; import static java.awt.Color; import static java.lang.Math.*; public class ClassTest extends GenericClassTest implements com.mycompany.test.InterfaceTest, java.lang.Runnable { // Visibility private int _privateField; protected int _protectedField; public int _publicField; int _packageField; // Array Types String[] StringArray; int[][] int2DimentionalArray; // Multiple Variables int a, b, c, d; // Field Modifiers static final transient volatile int _field; // Field Initializer int _fieldInt = 10; String _fieldString = "String Literal"; char _fieldChar = 'c'; boolean _fieldBoolean = true; InterfaceTest _fieldNull = null; // Refer to inner interface // Method public void test(int arg1, final String arg2) throws IllegalAccess, java.lang.Exception {} static final synchronized native strictfp void test2() {} abstract int test3() {} // Annotated Method @Deprecated @SuppressWarnings({ "unchecked", "deprecation" }) @MethodInfo(author = "Pankaj", comments = "Main method", date = "Nov 17 2012", revision = 10) void annotatedMethod() {} // Inner Class static class InnerClass { } // Inner Interface (same name with outer-scope InterfaceTest interface) static interface InterfaceTest { } }
keyrose/staruml-golang
unittest-files/parse/ClassTest.java
Java
mit
1,412