text
stringlengths 2
6.14k
|
|---|
import { test } from 'ember-qunit';
import moduleFor from 'open-event-frontend/tests/helpers/unit-helper';
moduleFor('controller:public/cfs/new-speaker', 'Unit | Controller | public/cfs/new speaker', []);
test('it exists', function(assert) {
let controller = this.subject();
assert.ok(controller);
});
|
// (C) Copyright 2015 Martin Dougiamas
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License 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.
angular.module('mm.core')
/**
* Directive to open a link in external browser.
*
* @module mm.core
* @ngdoc directive
* @name mmBrowser
*
* @param {Boolean} [captureLink=false] If the link needs to be captured by the app.
*/
.directive('mmBrowser', function($mmUtil, $mmContentLinksHelper) {
/**
* Convenience function to open file or url in the browser.
*
* @param {String} href HREF to be opened
*/
function openInBrowser(href) {
if (href.indexOf('cdvfile://') === 0 || href.indexOf('file://') === 0) {
// We have a local file.
$mmUtil.openFile(href).catch(function(error) {
$mmUtil.showErrorModal(error);
});
} else {
// It's an external link, we will open with browser.
$mmUtil.openInBrowser(href);
}
}
return {
restrict: 'A',
priority: 100,
link: function(scope, element, attrs) {
element.on('click', function(event) {
var href = element[0].getAttribute('href');
if (href) {
event.preventDefault();
event.stopPropagation();
if (attrs.captureLink && attrs.captureLink !== 'false') {
$mmContentLinksHelper.handleLink(href).then(function(treated) {
if (!treated) {
openInBrowser(href);
}
});
} else {
openInBrowser(href);
}
}
});
}
};
});
|
import Marked from 'marked'
import hljs from 'highlight.js'
const renderer = new Marked.Renderer()
export const toc = []
renderer.heading = function(text, level) {
var slug = text.toLowerCase().replace(/\s+/g, '-')
toc.push({
level: level,
slug: slug,
title: text
})
return `<h${level}><a href='#${slug}' id='${slug}' class='anchor'></a><a href='#${slug}'>${text}</a></h${level}>`
}
Marked.setOptions({
highlight: function(code, lang) {
if (hljs.getLanguage(lang)) {
return hljs.highlight(lang, code).value
} else {
return hljs.highlightAuto(code).value
}
},
renderer
})
export const marked = text => {
var tok = Marked.lexer(text)
text = Marked.parser(tok).replace(/<pre>/ig, '<pre class="hljs">')
return text
}
|
/*global module: false, require: false, console: false */
'use strict';
var React = require('react');
var PureRenderMixin = require('./PureRenderMixin');
var DataTable = require('react-data-components-bd2k').DataTable;
require('react-data-components-bd2k/css/table-twbs.css');
function buildHeader(onClick, title) {
return (
<span>
{title}
<span onClick={ev => {ev.stopPropagation(); onClick(title); }}
className='help glyphicon glyphicon-question-sign superscript'/>
</span>
);
}
var columns = [
{title: 'Gene', prop: 'Gene symbol'},
{title: ' HGVS ', prop: 'HGVS'},
{title: 'Pathogenicity', prop: 'Clinical significance'},
{title: 'Allele origin', prop: 'Allele origin'},
{title: 'CVA', prop: 'ClinVarAccession'}
];
var VariantTable = React.createClass({
mixins: [PureRenderMixin],
getData: function () {
return this.refs.table.state.data;
},
render: function () {
var {data, onHeaderClick, onRowClick, ...opts} = this.props;
return (
<DataTable
ref='table'
{...opts}
buildRowOptions={r => ({title: 'click for details', onClick: () => onRowClick(r.id)})}
buildHeader={title => buildHeader(onHeaderClick, title)}
columns={columns}
initialData={data}
initialPageLength={10}
initialSortBy={{ title: 'Gene', prop: 'Gene', order: 'descending' }}
pageLengthOptions={[ 10, 50, 100 ]}
keys={['id']}
/>
);
}
});
module.exports = VariantTable;
|
var libCssList = [
"bootstrap/dist/css/bootstrap.css",
"bootstrap/dist/css/bootstrap-theme.css"
];
var basePath = "lib/";
for (var fileIndex = 0; fileIndex < libCssList.length; fileIndex++) {
libCssList[fileIndex] = basePath + libCssList[fileIndex];
}
module.exports = libCssList;
|
/* @flow */
import { PropTypes } from 'react';
export function notImplemented(props: Object, propName: string, componentName: string): ?Error {
if (props[propName]) {
return new Error(`<${componentName}> "${propName}" is not implemented.`);
}
return null;
}
export function falsy(props: Object, propName: string, componentName: string): ?Error {
if (props[propName]) {
return new Error(`<${componentName}> should not have a "${propName}" prop.`);
}
return null;
}
export const component = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);
|
var baseAt = require('../internal/baseAt'),
baseFlatten = require('../internal/baseFlatten'),
restParam = require('../function/restParam');
/**
* Creates an array of elements corresponding to the given keys, or indexes,
* of `collection`. Keys may be specified as individual arguments or as arrays
* of keys.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {...(number|number[]|string|string[])} [props] The property names
* or indexes of elements to pick, specified individually or in arrays.
* @returns {Array} Returns the new array of picked elements.
* @example
*
* _.at(['a', 'b', 'c'], [0, 2]);
* // => ['a', 'c']
*
* _.at(['barney', 'fred', 'pebbles'], 0, 2);
* // => ['barney', 'pebbles']
*/
var at = restParam(function (collection, props) {
return baseAt(collection, baseFlatten(props));
});
module.exports = at;
|
// module export
if (typeof define === "function" && define.amd) {
// AMD
define("bridge", [], function () { return Bridge; });
} else if (typeof module !== "undefined" && module.exports) {
// Node
module.exports = Bridge;
}
|
/**
* Configure app in a block instead of hard-coding values inside the scripts.
*/
var config = {
//domain: 'http://localhost:63342/FeatureScapeApps',
domain: '/featurescapeapps',
quipUrl: '/camicroscope/osdCamicroscope.php',
//reserve4Url: 'http://reserve4.informatics.stonybrook.edu/dev1/osdCamicroscope.php',
imgcoll: 'images',
quot: "%22",
iiifServer: location.hostname,
iiifPrefix: 'fcgi-bin/iipsrv.fcgi?iiif=',
default_execution_id: 'tahsin-test-1',
default_db: 'quip',
default_subject_id: 'TCGA-05-4396',
default_case_id: 'TCGA-05-4396-01Z-00-DX1'
};
|
/**
* Select2 Italian translation
*/
(function ($) {
"use strict";
$.extend($.fn.select2.defaults, {
formatNoMatches: function () { return "Nessuna corrispondenza trovata"; },
formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); },
formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; },
formatSelectionTooBig: function (limit) { return "Puoi selezionare solo " + limit + " element" + (limit == 1 ? "o" : "i"); },
formatLoadMore: function (pageNumber) { return "Caricamento in corso..."; },
formatSearching: function () { return "Ricerca..."; }
});
})(jQuery);
|
/**
* @license
* Copyright 2015 Google Inc. 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
CLASS({
package: 'foam.apps.builder.wizard',
name: 'NewOrExistingModelWizard',
extends: 'foam.apps.builder.wizard.NewOrExistingWizard',
requires: [
'foam.apps.builder.wizard.ModelWizard',
'foam.apps.builder.wizard.ModelPreviewWizard',
],
imports: [
'modelDAO',
],
exports: [
'editView',
'innerEditView',
],
properties: [
{
name: 'data',
postSet: function(old,nu) {
if ( nu.baseModelId ) this.baseModel = nu.baseModelId;
}
},
{
type: 'Model',
name: 'baseModel',
help: 'The list is filtered to only include models that extend baseModel.',
postSet: function() {
if ( this.modelDAO ) {
this.existingDAO = this.modelDAO.where(EQ(Model.EXTENDS, this.baseModel.id));
}
}
},
{
name: 'modelDAO',
postSet: function(old,nu) {
if ( this.baseModel ) {
this.existingDAO = this.modelDAO.where(EQ(Model.EXTENDS, this.baseModel.id));
}
},
},
{
name: 'newViewFactory',
label: 'Create a new Data Model',
defaultValue: { factory_: 'foam.apps.builder.wizard.ModelWizard' },
},
{
name: 'existingViewFactory',
label: 'Copy an existing Data Model',
defaultValue: null,
},
{
name: 'nextViewFactory',
lazyFactory: function() { return this.newViewFactory; },
},
{
name: 'selection',
},
{
name: 'existingDAO',
view: {
factory_: 'foam.ui.md.DAOListView',
rowView: 'foam.apps.builder.datamodels.ModelCitationView',
}
},
{
model_: 'foam.apps.builder.wizard.WizardViewFactoryProperty',
name: 'editView',
defaultValue: { factory_: 'foam.apps.builder.wizard.ModelPreviewWizard' },
},
{
model_: 'foam.apps.builder.wizard.WizardViewFactoryProperty',
name: 'innerEditView',
defaultValue: function() {},
},
],
methods: [
function onNext() {
this.SUPER();
if ( this.selection && this.nextViewFactory === this.existingViewFactory ) {
this.data.getDataConfig().model = this.selection;
}
}
],
});
|
/*
* Copyright (c) 2015-2016 Fraunhofer FOKUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
define([
"../core"
], function( jQuery ) {
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
// Support: IE9
try {
tmp = new DOMParser();
xml = tmp.parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
};
return jQuery.parseXML;
});
|
// Based on https://github.com/chrisvfritz/vue-enterprise-boilerplate/blob/master/src/components/_globals.js
// Globally register all base components for convenience, because they
// will be used very frequently. Components are registered using the
// PascalCased version of their file name.
import Vue from 'vue';
import upperFirst from 'lodash/upperFirst';
import camelCase from 'lodash/camelCase';
// https://webpack.js.org/guides/dependency-management/#require-context
const requireComponent = require.context(
// Look for files in the current directory
'./shared/components',
// Do not look in subdirectories
false,
// Only include "_base-" prefixed .vue files
/\.vue$/,
);
// For each matching file name...
requireComponent.keys().forEach((fileName) => {
// Get the component config
const componentConfig = requireComponent(fileName);
// Get the PascalCase version of the component name
const componentName = upperFirst(
camelCase(
fileName
// Remove the "./_" from the beginning
.replace(/^\.\/_/, '')
// Remove the file extension from the end
.replace(/\.\w+$/, ''),
),
);
// Globally register the component
Vue.component(componentName, componentConfig.default || componentConfig);
});
|
//
// Touches the DOM.
// This file listens to events from the language selector and changes the
// DOM to have the language requested.
// Uses globals from chal-header.html.
//
// Selecting the current locale
var selector = document.getElementById('lang-select')
// add change listener
selector.addEventListener('change', function (event) {
// Go to page in the locale specified
var location = window.location
var url = location.href.replace(/built\/([a-z]{2}-[A-Z]{2})/, 'built/' + selector.value)
location.href = url
})
|
'use strict';
// utility for field
require('./globals');
var consts = require('./consts'),
c = consts.shorthand,
time = require('./compiler/time'),
util = require('./util'),
schema = require('./schema/schema');
var vlfield = module.exports = {};
/**
* @param field
* @param opt
* opt.nofn -- exclude bin, aggregate, timeUnit
* opt.data - include 'data.'
* opt.fn - replace fn with custom function prefix
* opt.prefn - prepend fn with custom function prefix
* @return {[type]} [description]
*/
vlfield.fieldRef = function(field, opt) {
opt = opt || {};
var f = (opt.data ? 'data.' : '') + (opt.prefn || ''),
nofn = opt.nofn || opt.fn,
name = field.name;
if (vlfield.isCount(field)) {
return f + 'count';
} else if (!nofn && field.bin) {
return f + 'bin_' + name;
} else if (!nofn && field.aggregate) {
return f + field.aggregate + '_' + name;
} else if (!nofn && field.timeUnit) {
return f + field.timeUnit + '_' + name;
} else if (opt.fn) {
return f + opt.fn + '_' + name;
} else {
return f + name;
}
};
vlfield.shorthand = function(f) {
var c = consts.shorthand;
return (f.aggregate ? f.aggregate + c.func : '') +
(f.timeUnit ? f.timeUnit + c.func : '') +
(f.bin ? 'bin' + c.func : '') +
(f.name || '') + c.type + f.type;
};
vlfield.shorthands = function(fields, delim) {
delim = delim || c.delim;
return fields.map(vlfield.shorthand).join(delim);
};
vlfield.fromShorthand = function(shorthand) {
var split = shorthand.split(c.type), i;
var o = {
name: split[0].trim(),
type: split[1].trim()
};
// check aggregate type
for (i in schema.aggregate.enum) {
var a = schema.aggregate.enum[i];
if (o.name.indexOf(a + '_') === 0) {
o.name = o.name.substr(a.length + 1);
if (a == 'count' && o.name.length === 0) o.name = '*';
o.aggregate = a;
break;
}
}
// check time timeUnit
for (i in schema.timefns) {
var tu = schema.timefns[i];
if (o.name && o.name.indexOf(tu + '_') === 0) {
o.name = o.name.substr(o.length + 1);
o.timeUnit = tu;
break;
}
}
// check bin
if (o.name && o.name.indexOf('bin_') === 0) {
o.name = o.name.substr(4);
o.bin = true;
}
return o;
};
var typeOrder = {
N: 0,
O: 1,
G: 2,
T: 3,
Q: 4
};
vlfield.order = {};
vlfield.order.type = function(field) {
if (field.aggregate==='count') return 4;
return typeOrder[field.type];
};
vlfield.order.typeThenName = function(field) {
return vlfield.order.type(field) + '_' +
(field.aggregate === 'count' ? '~' : field.name.toLowerCase());
// ~ is the last character in ASCII
};
vlfield.order.original = function() {
return 0; // no swap will occur
};
vlfield.order.name = function(field) {
return field.name;
};
vlfield.order.typeThenCardinality = function(field, stats){
return stats[field.name].distinct;
};
var isType = vlfield.isType = function (fieldDef, type) {
return fieldDef.type === type;
};
var isTypes = vlfield.isTypes = function (fieldDef, types) {
for (var t=0; t<types.length; t++) {
if(fieldDef.type === types[t]) return true;
}
return false;
};
/*
* Most fields that use ordinal scale are dimensions.
* However, YEAR(T), YEARMONTH(T) use time scale, not ordinal but are dimensions too.
*/
vlfield.isOrdinalScale = function(field) {
return isTypes(field, [N, O]) || field.bin ||
( isType(field, T) && field.timeUnit && time.isOrdinalFn(field.timeUnit) );
};
function isDimension(field) {
return isTypes(field, [N, O]) || !!field.bin ||
( isType(field, T) && !!field.timeUnit );
}
/**
* For encoding, use encoding.isDimension() to avoid confusion.
* Or use Encoding.isType if your field is from Encoding (and thus have numeric data type).
* otherwise, do not specific isType so we can use the default isTypeName here.
*/
vlfield.isDimension = function(field) {
return field && isDimension(field);
};
vlfield.isMeasure = function(field) {
return field && !isDimension(field);
};
vlfield.role = function(field) {
return isDimension(field) ? 'dimension' : 'measure';
};
vlfield.count = function() {
return {name:'*', aggregate: 'count', type: Q, displayName: vlfield.count.displayName};
};
vlfield.count.displayName = 'Number of Records';
vlfield.isCount = function(field) {
return field.aggregate === 'count';
};
/**
* For encoding, use encoding.cardinality() to avoid confusion. Or use Encoding.isType if your field is from Encoding (and thus have numeric data type).
* otherwise, do not specific isType so we can use the default isTypeName here.
*/
vlfield.cardinality = function(field, stats, filterNull) {
// FIXME need to take filter into account
var stat = stats[field.name];
var type = field.type;
filterNull = filterNull || {};
if (field.bin) {
var bins = util.getbins(stat, field.bin.maxbins || schema.MAXBINS_DEFAULT);
return (bins.stop - bins.start) / bins.step;
}
if (isType(field, T)) {
var cardinality = time.cardinality(field, stats, filterNull, type);
if(cardinality !== null) return cardinality;
//otherwise use calculation below
}
if (field.aggregate) {
return 1;
}
// remove null
return stat.distinct -
(stat.nulls > 0 && filterNull[type] ? 1 : 0);
};
|
import React, { Component } from 'react';
import Steps from './widgets/steps/steps';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
const styles = {
container: {
display: 'flex',
justifyContent: 'space-around',
flexDirection: 'column',
marginBottom: '1vh',
flex: 1,
},
green: {
display: 'inline-block',
verticalAlign: 'top',
width: '10px',
height: '10px',
borderRadius: '50%',
border: 'solid 1px #333',
background: '#008000',
fontSize: 0,
textIndent: '-9999em',
},
yellow: {
display: 'inline-block',
verticalAlign: 'top',
width: '10px',
height: '10px',
borderRadius: '50%',
border: 'solid 1px #333',
background: '#ffff00',
fontSize: 0,
textIndent: '-9999em',
},
red: {
display: 'inline-block',
verticalAlign: 'top',
width: '10px',
height: '10px',
borderRadius: '50%',
border: 'solid 1px #333',
background: '#ff0000',
fontSize: 0,
textIndent: '-9999em',
},
lightgray: {
display: 'inline-block',
verticalAlign: 'top',
width: '10px',
height: '10px',
borderRadius: '50%',
border: 'solid 1px #333',
background: '#d3d3d3',
fontSize: 0,
textIndent: '-9999em',
},
black: {
display: 'inline-block',
verticalAlign: 'top',
width: '10px',
height: '10px',
borderRadius: '50%',
border: 'solid 1px #333',
background: '#000000',
fontSize: 0,
textIndent: '-9999em',
},
};
class QA extends Component {
static propTypes = {
exposureId: PropTypes.string,
qaTests: PropTypes.array,
arms: PropTypes.array.isRequired,
spectrographs: PropTypes.array.isRequired,
mjd: PropTypes.string,
date: PropTypes.string,
time: PropTypes.string,
navigateToMetrics: PropTypes.func,
navigateToProcessingHistory: PropTypes.func,
petalSizeFactor: PropTypes.number.isRequired,
processId: PropTypes.number,
monitor: PropTypes.bool,
flavor: PropTypes.string,
};
componentDidMount() {
document.title = 'QA';
}
renderMetrics = (step, spectrographNumber, arm) => {
if (this.props.navigateToMetrics) {
this.props.navigateToMetrics(
step,
spectrographNumber,
arm,
this.props.exposureId
);
}
};
renderSteps = () => {
return (
<Steps
navigateToProcessingHistory={this.props.navigateToProcessingHistory}
qaTests={this.props.qaTests}
renderMetrics={this.renderMetrics}
mjd={this.props.mjd}
exposureId={this.props.exposureId}
date={this.props.date}
time={this.props.time}
petalSizeFactor={this.props.petalSizeFactor}
processId={this.props.processId}
monitor={this.props.monitor}
flavor={this.props.flavor}
/>
);
};
render() {
return <div style={styles.container}>{this.renderSteps()}</div>;
}
}
export default withStyles(styles)(QA);
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
const {isLitHtmlTemplateCall} = require('./utils.js');
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Check for self closing custom element tag names in Lit templates.',
category: 'Possible Errors',
},
fixable: 'code',
schema: [] // no options
},
create: function(context) {
return {
TaggedTemplateExpression(node) {
const isLitHtmlCall = isLitHtmlTemplateCall(node);
if (!isLitHtmlCall) {
return;
}
const text = node.quasi.quasis.map(templatePart => templatePart.value.raw).join('@TEMPLATE_EXPRESSION()');
if (text.match(/<@TEMPLATE_EXPRESSION\(\)([^>]*?)\/>/)) {
context.report({
node,
message: 'Custom elements should not be self closing.',
});
}
},
};
}
};
|
'use strict';
angular.module("ngLocale", [], ["$provide", function ($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"Sunntag",
"M\u00e4ntag",
"Zi\u0161tag",
"Mittwu\u010d",
"Fr\u00f3ntag",
"Fritag",
"Sam\u0161tag"
],
"ERANAMES": [
"v. Chr.",
"n. Chr"
],
"ERAS": [
"v. Chr.",
"n. Chr"
],
"FIRSTDAYOFWEEK": 0,
"MONTH": [
"Jenner",
"Hornig",
"M\u00e4rze",
"Abrille",
"Meije",
"Br\u00e1\u010det",
"Heiwet",
"\u00d6ig\u0161te",
"Herb\u0161tm\u00e1net",
"W\u00edm\u00e1net",
"Winterm\u00e1net",
"Chri\u0161tm\u00e1net"
],
"SHORTDAY": [
"Sun",
"M\u00e4n",
"Zi\u0161",
"Mit",
"Fr\u00f3",
"Fri",
"Sam"
],
"SHORTMONTH": [
"Jen",
"Hor",
"M\u00e4r",
"Abr",
"Mei",
"Br\u00e1",
"Hei",
"\u00d6ig",
"Her",
"W\u00edm",
"Win",
"Chr"
],
"STANDALONEMONTH": [
"Jenner",
"Hornig",
"M\u00e4rze",
"Abrille",
"Meije",
"Br\u00e1\u010det",
"Heiwet",
"\u00d6ig\u0161te",
"Herb\u0161tm\u00e1net",
"W\u00edm\u00e1net",
"Winterm\u00e1net",
"Chri\u0161tm\u00e1net"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE, d. MMMM y",
"longDate": "d. MMMM y",
"medium": "d. MMM y HH:mm:ss",
"mediumDate": "d. MMM y",
"mediumTime": "HH:mm:ss",
"short": "y-MM-dd HH:mm",
"shortDate": "y-MM-dd",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "CHF",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u2019",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-\u00a4\u00a0",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "wae-ch",
"localeID": "wae_CH",
"pluralCat": function (n, opt_precision) {
var i = n | 0;
var vf = getVF(n, opt_precision);
if (i == 1 && vf.v == 0) {
return PLURAL_CATEGORY.ONE;
}
return PLURAL_CATEGORY.OTHER;
}
});
}]);
|
"use strict";;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var types_1 = __importDefault(require("./types"));
function default_1(fork) {
var types = fork.use(types_1.default);
var Type = types.Type;
var builtin = types.builtInTypes;
var isNumber = builtin.number;
// An example of constructing a new type with arbitrary constraints from
// an existing type.
function geq(than) {
return Type.from(function (value) { return isNumber.check(value) && value >= than; }, isNumber + " >= " + than);
}
;
// Default value-returning functions that may optionally be passed as a
// third argument to Def.prototype.field.
var defaults = {
// Functions were used because (among other reasons) that's the most
// elegant way to allow for the emptyArray one always to give a new
// array instance.
"null": function () { return null; },
"emptyArray": function () { return []; },
"false": function () { return false; },
"true": function () { return true; },
"undefined": function () { },
"use strict": function () { return "use strict"; }
};
var naiveIsPrimitive = Type.or(builtin.string, builtin.number, builtin.boolean, builtin.null, builtin.undefined);
var isPrimitive = Type.from(function (value) {
if (value === null)
return true;
var type = typeof value;
if (type === "object" ||
type === "function") {
return false;
}
return true;
}, naiveIsPrimitive.toString());
return {
geq: geq,
defaults: defaults,
isPrimitive: isPrimitive,
};
}
exports.default = default_1;
module.exports = exports["default"];
|
var MemoryBlogStore = require('./MemoryBlogStore');
var blogStore = new MemoryBlogStore();
blogStore.addPost({
text: 'Hello'
}, function(err, post) {
console.log(err, post);
});
blogStore.addPost({
text: 'Hello'
}, function(err, post) {
console.log(err, post);
});
blogStore.addPost({
text: 'Hello'
}, function(err, post) {
console.log(err, post);
});
// blogStore.getPostsRange(0, 2, function(err, posts) {
// console.log(err, posts)
// });
blogStore.getPostsAfter(1, 2, function(err, posts) {
console.log(err, posts)
});
|
var mysql = require('mysql');
function mysqlConn(config,logger) {
this.connectionPool = mysql.createPool(config);
this.initialized = true;
this.logger = logger;
}
mysqlConn.prototype = {
/// if the raw connection is needed
getConnection: function (callback) {
if (!this.initialized) {
callback(new Error("Connection not initialized"));
return;
}
this.connectionPool.getConnection(function (err, connection) {
// Use the connection
if (err )
this.logger.error('#Database -> Connection: ' + JSON.stringify(err));
if (callback) callback(err, connection);
connection.release();
});
}
,executeSP: function (procedureName, params, callback) {
if (!this.initialized) {
callback(new Error("Connection not initialized"));
return;
}
if (typeof (params) == "function" && callback == undefined) {
callback = params;
params = null;
}
var sql = 'CALL ' + procedureName + '(params)';
sql = this._injectParams(sql, params);
var l= this.logger;
//Execute stored procedure call
this.connectionPool.query(sql, function (err, rows, fields) {
if (err) {
try {
if (err.code == 'ER_SIGNAL_EXCEPTION' && err.sqlState == '45000' && err.message) {
var errorCode = err.message.replace('ER_SIGNAL_EXCEPTION: ', '');
l.warn('#Database -> Stored Procedure: ' + sql + ' Error code ##' + errorCode + '## was relieved while executing stored procedure :' ,err);
err.errorCode = errorCode;
}
else {
l.error('#Database -> Stored Procedure: ' + sql + ' an error has occurred while executing stored procedure :', err);
}
}
catch(e) {
console.error(e);
}
callback(err, null);
}
else {
l.debug('#Database -> Stored Procedure: ' + sql + ' connected to database successfully');
callback(null, rows);
}
});
}
,_injectParams: function (query, params) {
//Inject parameters in Stored Procedure Call
var parameters = '';
if (params) {
params.forEach(function (param, index) {
if (param == null || param.value == null)
parameters += "null";
else{
try{
parameters += "@" + param.name + ':=' + mysql.escape(param.value);
}
catch(e)
{
console.log(e);
throw e;
}
}
if (index < params.length - 1) parameters += ",";
});
}
query = query.replace("params", parameters);
return query;
}
, createCommand: function (procedureName) {
return new mysqlCommand(procedureName, this);
}
};
function mysqlCommand(procedureName, connectionPool) {
this.connectionPool = connectionPool;
this.procedureName = procedureName;
this.params = [];
}
mysqlCommand.prototype = {
addParam: function (name, value) {
this.params.push({ "name": name , "value" : value });
}
,getDataSet: function (callback) {
this.connectionPool.executeSP(this.procedureName, this.params, function (err, data) {
if (err)
callback(err, null);
else {
if (data)
callback(null, data);
else
callback(null, null);
}
});
}
,getDataTable: function (callback) {
this.getDataSet(function (err, data) {
if (err)
callback(err, null);
else {
if (data && data.length > 0)
callback(null, data[0]);
else
callback(null, []);
}
});
}
,getDataObject: function (callback) {
this.getDataTable(function (err, data) {
if (err)
callback(err, null);
else {
if (data && data.length > 0)
callback(null, data[0]);
else
callback(null, null);
}
});
}
,getScalar: function (callback) {
this.getDataObject(function (err, data) {
if (err)
callback(err, null);
else {
if (data != null) {
var key = Object.keys(data);
callback(null, data[key[0]]);
}
else
callback(null, null);
}
});
}
}
module.exports = mysqlConn;
|
'use strict';
define([
'three',
'explorer',
'underscore'
], function(
THREE,
Explorer,
_
) {
var mp3names = ['crystalCenter', 'cellCollision', 'atomCollision', 'popOutOfAtom', 'dollHolder', 'atomUnderDoll', 'navCube', 'dollArrived', 'leapGrab', 'leapNoGrab'];
function Sound(animationMachine) {
this.procced = true, this.context ;
this.animationMachine = animationMachine ;
this.mute = true ;
this.buffers = [] ;
this.crystalHold ;
this.crystalCameraOrbit ;
this.crysCentrSource = {panner: undefined , dryGain: undefined , panX : 0, panZ : 0, gain : 0 };
this.steredLoops = {};
this.lattice;
this.volume = 0.75 ;
this.atomSourcePos = undefined;
var _this = this ;
try {
this.context = new (window.AudioContext || window.webkitAudioContext)();
}
catch(e) {
this.procced = false;
alert('Web Audio API not supported in this browser.');
}
if(this.procced === true){
this.universalGainNode = this.context.createGain();
this.universalGainNode.gain.value = 0.75;
this.universalGainNode.connect(this.context.destination);
}
};
Sound.prototype.changeVolume = function(arg){
if(arg.sound){
this.universalGainNode.gain.value = parseFloat(arg.sound)/100;
}
};
Sound.prototype.loadSamples = function(url){
var _this = this ;
var request = new XMLHttpRequest();
request.open('GET', 'sounds/'+url+'.mp3', true);
request.setRequestHeader ("Accept", "Access-Control-Allow-Origin: *'"); // to access locally the Mp3s
request.responseType = 'arraybuffer';
request.onload = function() {
var audioData = request.response;
_this.context.decodeAudioData(
audioData,
function(buffer) { _this.buffers[url] = buffer; },
function(e){"Error with decoding audio data" + e.err});
}
request.send();
}
Sound.prototype.crystalCenterStop = function() {
if(this.crystalHold) {
clearInterval(this.crystalHold);
}
};
Sound.prototype.calculateAngle = function(x,z){
var vec1 = new THREE.Vector2(this.crystalCameraOrbit.control.target.x-this.crystalCameraOrbit.camera.position.x,this.crystalCameraOrbit.control.target.z-this.crystalCameraOrbit.camera.position.z);
var vec2 = new THREE.Vector2(x-this.crystalCameraOrbit.camera.position.x,z-this.crystalCameraOrbit.camera.position.z);
vec1.normalize();
vec2.normalize();
var angle = Math.atan2( vec2.y,vec2.x) - Math.atan2(vec1.y,vec1.x);
var f =angle* (180/Math.PI);
if(f > 180 ) f = f - 360;
if(f < -180 ) f = f + 360;
return f;
};
Sound.prototype.soundSourcePos = function() {
if(this.lattice === undefined){
return;
}
var centroid = new THREE.Vector3(0,0,0);
if(this.atomSourcePos !== undefined){
centroid = this.atomSourcePos.clone();
}
else{
var g = this.lattice.customBox(this.lattice.viewBox);
if(g !== undefined){
centroid = new THREE.Vector3();
for ( var z = 0, l = g.vertices.length; z < l; z ++ ) {
centroid.add( g.vertices[ z ] );
}
centroid.divideScalar( g.vertices.length );
}
}
return centroid ;
};
Sound.prototype.switcher = function(start) {
if(this.procced && this.buffers.length === 0 && start === true){
for (var i = mp3names.length - 1; i >= 0; i--) {
this.loadSamples(mp3names[i]);
};
}
var _this = this ;
if(start === true){
this.mute = false ;
this.crystalHold = setInterval( function() {
var centroid = _this.soundSourcePos();
_this.animationMachine.produceWave(centroid, 'crystalCenter');
_this.play('crystalCenter', centroid, true);
},2000);
}
else{
if(this.crystalHold) clearInterval(this.crystalHold);
this.mute = true ;
}
};
Sound.prototype.stopStoredPlay = function(sampleName) {
if(this.steredLoops[sampleName] !== undefined){
this.steredLoops[sampleName].stop();
}
};
Sound.prototype.storePlay = function(sampleName) {
var _this = this, voice;
if(!this.mute){
voice = this.context.createBufferSource();
voice.buffer = this.buffers[sampleName] ;
voice.connect(this.universalGainNode);
this.steredLoops[sampleName] = voice ;
voice.start(0);
}
};
Sound.prototype.play = function(sampleName, sourcePos, calcPanning) {
if(!this.mute && mp3names.length === Object.keys(this.buffers).length){
var data;
var voice = this.context.createBufferSource();
voice.buffer = this.buffers[sampleName] ;
if(calcPanning){
data = this.calculatePanning(sourcePos);
var dryGain = this.context.createGain();
var panner = this.context.createPanner();
panner.setPosition(data.panX, data.panY, data.panZ);
dryGain.gain.value = data.gain;
voice.connect(dryGain);
dryGain.connect(panner);
panner.connect(this.universalGainNode);
}
else{
voice.connect(this.universalGainNode);
}
voice.start(0);
}
};
// panning vars go from -1 to 1
var ttt = false;
Sound.prototype.calculatePanning = function(objPos){
var _this = this ;
var c = this.crystalCameraOrbit.camera.position.clone();
// custom panning method. panX goes sinusoidal and panZ is set according to panX so panX + panZ = 1
var panX = Math.sin( this.calculateAngle(objPos.x,objPos.z) * (Math.PI/180) ) ;
var panZ = (panX <= 0 ? (1 + panX) : ( 1 - panX) );
var panY = 0;
var distance = objPos.distanceTo(this.crystalCameraOrbit.camera.position );
var gain = (distance < 20 ? 1 : (1 - distance/700)) ;
gain = gain * 1 ;
if(gain < 0.1) gain = 0.1 ;
return {'gain' : gain, 'panX' : panX, 'panY' : panY, 'panZ' : panZ };
}
return Sound;
});
|
//
// tselect01.js
// Test for select
//
if(typeof exports === 'object') {
var assert = require("assert");
var alasql = require('..');
};
describe('Create database', function(){
it('Create new database', function(done) {
var db = new alasql.Database();
assert.deepEqual(db.tables, {});
done();
});
});
|
/**
* Returns the string, with after processing the following backslash escape sequences.
*
* attacklab: The polite way to do this is with the new escapeCharacters() function:
*
* text = escapeCharacters(text,"\\",true);
* text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
*
* ...but we're sidestepping its use of the (slow) RegExp constructor
* as an optimization for Firefox. This function gets called a LOT.
*/
showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
text = text.replace(/\\([`*_{}\[\]()>#+.!~=-])/g, showdown.helper.escapeCharactersCallback);
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
return text;
});
|
const ts = require('typescript');
const utils = require('tsutils');
const Lint = require('tslint');
const ERROR_MESSAGE =
'A TODO may only appear in inline (//) style comments. ' +
'This is meant to prevent a TODO from being accidentally included in any public API docs.';
/**
* Rule that walks through all comments inside of the library and adds failures when it
* detects TODO's inside of multi-line comments. TODOs need to be placed inside of single-line
* comments.
*/
class Rule extends Lint.Rules.AbstractRule {
apply(sourceFile) {
return this.applyWithWalker(new NoExposedTodoWalker(sourceFile, this.getOptions()));
}
}
class NoExposedTodoWalker extends Lint.RuleWalker {
visitSourceFile(sourceFile) {
utils.forEachComment(sourceFile, (fullText, commentRange) => {
let isTodoComment = fullText.substring(commentRange.pos, commentRange.end).includes('TODO');
if (commentRange.kind === ts.SyntaxKind.MultiLineCommentTrivia && isTodoComment) {
this.addFailureAt(commentRange.pos, commentRange.end - commentRange.pos, ERROR_MESSAGE);
}
});
super.visitSourceFile(sourceFile);
}
}
exports.Rule = Rule;
|
// this is just a demo. To run it execute from the root of repository:
//
// > npm start
//
// Then open ./example/index.html
//
module.exports.main = function () {
var graph = require('ngraph.generators').balancedBinTree(6);
var createPixiGraphics = require('../');
var pixiGraphics = createPixiGraphics(graph);
var layout = pixiGraphics.layout;
// just make sure first node does not move:
layout.pinNode(graph.getNode(1), true);
// begin animation loop:
pixiGraphics.run();
}
|
describe( 'AppCtrl', function() {
describe( 'isCurrentUrl', function() {
var AppCtrl, $location, $scope;
beforeEach( module( 'app' ) );
beforeEach( inject( function( $controller, _$location_, $rootScope ) {
$location = _$location_;
$scope = $rootScope.$new();
AppCtrl = $controller( 'AppCtrl', { $location: $location, $scope: $scope });
}));
it( 'should pass a dummy test', inject( function() {
expect( AppCtrl ).toBeTruthy();
}));
});
});
|
<p>
Añadir nuevo comentario:
</p>
<p>
<form method="POST" action="/quizzes/<%=quiz.id%>/comments/">
<input type="text" id="comment" name="comment[text]" value="" placeholder="Comentario" /> <p>
<button type="submit">Enviar</button>
</form>
</p>
|
module.exports = {
entry: ["react", "react-dom", "lodash"]
}
|
var EPOCH = 1900;
var PATTERN = /(\d+)[^\/|-]/g;
function iskabisat(year) {
if(year % 4 === 0){
if(year % 100 === 0 && year % 400 !== 0)
return false;
else
return true;
}
return false;
}
/*
* kabisats:
* Calculating how many kabisats' years in time span between
* given year and primordial year, Y0
*/
function kabisats(year) {
var kabcount = 0;
for(var i=1900; i<year; i++) {
if(iskabisat(i))
kabcount++;
}
return kabcount;
}
function calcdays(date) {
function months(mth) {
var days = 0;
for(var i=1; i<mth; i++) {
if(extraday.indexOf(i) !== -1)
days += 31;
else if (i == 2)
days += 28;
else
days += 30;
}
return days+1;
}
var extraday = [1, 3, 5, 7, 8, 10, 12];
var dayarr = date.match(PATTERN);
var day = parseInt(dayarr[2]);
var month = parseInt(dayarr[1]);
var year = parseInt(dayarr[0]);
var days = day + months(month) + (year - EPOCH) * 365 +
kabisats(year);
return days;
}
function triwara(day) {
return ['Pasah', 'Beteng', 'Kajeng'][(day-1) % 3];
}
function pancawara(day) {
var pancalist = ["Umanis", "Paing", "Pon", "Wage", "Kliwon"];
return pancalist[(day-1) % 5];
}
function saptawara(day) {
return ["Redite", "Coma", "Anggara","Buda", "Wrespati",
"Sukra", "Saniscara"][(day-1) % 7];
}
function wuku(day) {
var wukulist = [
"Sinta", "Landep", "Ukir", "Kulantir", "Tolu",
"Gumbreg", "Wariga", "Warigadean", "Julungwangi", "Sungsang",
"Dungulan", "Kuningan", "Langkir", "Medangsya", "Pujut",
"Pahang", "Krulut", "Merakih", "Tambir", "Medangkungan",
"Matal", "Uye", "Menail", "Prangbakat", "Bala",
"Ugu", "Wayang", "Kelawu", "Dukut", "Watugunung"
];
idx = (Math.floor((day-1) / 7) + 12) % 30;
return wukulist[idx];
}
function bali_calendar(date) {
var day = calcdays(date);
return {
Triwara: triwara(day),
Pancawara: pancawara(day),
Saptawara: saptawara(day),
Wuku: wuku(day)
};
}
module.exports.bali_calendar = bali_calendar;
|
var _elm_lang$window$Native_Window = function()
{
var size = _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
callback(_elm_lang$core$Native_Scheduler.succeed({
width: window.innerWidth,
height: window.innerHeight
}));
});
return {
size: size
};
}();
|
/* ShipManager.js
KC3改 Ship Manager
Managesship roster and does indexing for data access.
Saves and loads list to and from localStorage
*/
(function(){
"use strict";
window.KC3ShipManager = {
list: {},
max: 100,
pendingShipNum: 0,
// Get a specific ship by ID
get :function( rosterId ){
// console.log("getting ship", rosterId, this.list["x"+rosterId]);
return this.list["x"+rosterId] || (new KC3Ship());
},
// Count number of ships
count :function(){
return Object.size(this.list) + this.pendingShipNum;
},
// Add or replace a ship on the list
add :function(data){
var didFlee = false;
if(typeof data.api_id != "undefined"){
if (typeof this.list["x"+data.api_id] !== "undefined") {
didFlee = this.list["x"+data.api_id].didFlee;
}
this.list["x"+data.api_id] = new KC3Ship(data);
this.list["x"+data.api_id].didFlee = didFlee;
}else if(typeof data.rosterId != "undefined"){
if (typeof this.list["x"+data.rosterId] !== "undefined") {
didFlee = this.list["x"+data.rosterId].didFlee;
}
this.list["x"+data.rosterId] = new KC3Ship(data);
this.list["x"+data.rosterId].didFlee = didFlee;
}
},
// Mass set multiple ships
set :function(data){
var ctr;
for(ctr in data){
if(!!data[ctr]){
this.add(data[ctr]);
}
}
this.save();
},
// Remove ship from the list, scrapped, mod-fodded, or sunk
remove :function( rosterId ){
console.log("removing ship", rosterId);
var thisShip = this.list["x"+rosterId];
if(thisShip != "undefined"){
// initializing for fleet sanitizing of zombie ships
var
flatShips = PlayerManager.fleets
.map(function(x){ return x.ships; })
.reduce(function(x,y){ return x.concat(y); }),
shipTargetOnFleet = flatShips.indexOf(Number(rosterId)), // check from which fleet
shipTargetFleetID = Math.floor(shipTargetOnFleet/6);
// check whether the designated ship is on fleet or not
if(shipTargetOnFleet >= 0){
PlayerManager.fleets[shipTargetFleetID].discard(rosterId);
}
// remove any equipments from her
for(var gctr in thisShip.items){
if(thisShip.items[gctr] > -1){
KC3GearManager.remove( thisShip.items[gctr] );
}
}
delete this.list["x"+rosterId];
this.save();
KC3GearManager.save();
}
},
// Show JSON string of the list for debugging purposes
json: function(){
console.log(JSON.stringify(this.list));
},
// Save ship list onto local storage
clear: function(){
this.list = {};
},
// Save ship list onto local storage
save: function(){
localStorage.ships = JSON.stringify(this.list);
},
// Load from storage and add each one to manager list
load: function(){
if(typeof localStorage.ships != "undefined"){
this.clear();
var ShipList = JSON.parse(localStorage.ships);
for(var ctr in ShipList){
this.add( ShipList[ctr] );
}
return true;
}
return false;
}
};
})();
|
/*
* 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.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Create recovery plan input class.
*
*/
class CreateRecoveryPlanInput {
/**
* Create a CreateRecoveryPlanInput.
* @member {object} properties Recovery plan creation properties.
* @member {string} [properties.primaryFabricId] The primary fabric Id.
* @member {string} [properties.recoveryFabricId] The recovery fabric Id.
* @member {string} [properties.failoverDeploymentModel] The failover
* deployment model. Possible values include: 'NotApplicable', 'Classic',
* 'ResourceManager'
* @member {array} [properties.groups] The recovery plan groups.
*/
constructor() {
}
/**
* Defines the metadata of CreateRecoveryPlanInput
*
* @returns {object} metadata of CreateRecoveryPlanInput
*
*/
mapper() {
return {
required: false,
serializedName: 'CreateRecoveryPlanInput',
type: {
name: 'Composite',
className: 'CreateRecoveryPlanInput',
modelProperties: {
properties: {
required: true,
serializedName: 'properties',
type: {
name: 'Composite',
className: 'CreateRecoveryPlanInputProperties'
}
}
}
}
};
}
}
module.exports = CreateRecoveryPlanInput;
|
describe("About Expects", function() {
// We shall contemplate truth by testing reality, via spec expectations.
it("should expect true", function() {
expect(true).toBeTruthy(); //This should be true
});
// To understand reality, we must compare our expectations against reality.
it("should expect equality", function () {
var expectedValue = 2;
var actualValue = 1 + 1;
expect(actualValue === expectedValue).toBeTruthy();
});
// Some ways of asserting equality are better than others.
it("should assert equality a better way", function () {
var expectedValue = 2;
var actualValue = 1 + 1;
// toEqual() compares using common sense equality.
expect(actualValue).toEqual(expectedValue);
});
// Sometimes you need to be really exact about what you "type."
it("should assert equality with ===", function () {
var expectedValue = 2;
var actualValue = (1 + 1);
// toBe() will always use === to compare.
expect(actualValue).toBe(expectedValue);
});
// Sometimes we will ask you to fill in the values.
it("should have filled in values", function () {
expect(1 + 1).toEqual(2);
});
});
|
/*
* 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.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* @class
* Initializes a new instance of the ComputeNodeListNextOptions class.
* @constructor
* Additional parameters for the listNext operation.
*
* @member {string} [clientRequestId] The caller-generated request identity,
* in the form of a GUID with no decoration such as curly braces, e.g.
* 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
*
* @member {boolean} [returnClientRequestId] Whether the server should return
* the client-request-id identifier in the response.
*
* @member {date} [ocpDate] The time the request was issued. If not specified,
* this header will be automatically populated with the current system clock
* time.
*
*/
function ComputeNodeListNextOptions() {
}
/**
* Defines the metadata of ComputeNodeListNextOptions
*
* @returns {object} metadata of ComputeNodeListNextOptions
*
*/
ComputeNodeListNextOptions.prototype.mapper = function () {
return {
required: false,
type: {
name: 'Composite',
className: 'ComputeNodeListNextOptions',
modelProperties: {
clientRequestId: {
required: false,
type: {
name: 'String'
}
},
returnClientRequestId: {
required: false,
type: {
name: 'Boolean'
}
},
ocpDate: {
required: false,
type: {
name: 'DateTimeRfc1123'
}
}
}
}
};
};
module.exports = ComputeNodeListNextOptions;
|
'use strict';
const common = require('../common');
const assert = require('assert');
const tick = require('./tick');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');
const fs = require('fs');
const hooks = initHooks();
hooks.enable();
fs.readFile(__filename, common.mustCall(onread));
function onread() {
const as = hooks.activitiesOfTypes('FSREQWRAP');
let lastParent = 1;
for (let i = 0; i < as.length; i++) {
const a = as[i];
assert.strictEqual(a.type, 'FSREQWRAP');
assert.strictEqual(typeof a.uid, 'number');
assert.strictEqual(a.triggerAsyncId, lastParent);
lastParent = a.uid;
}
checkInvocations(as[0], { init: 1, before: 1, after: 1, destroy: 1 },
'reqwrap[0]: while in onread callback');
checkInvocations(as[1], { init: 1, before: 1, after: 1, destroy: 1 },
'reqwrap[1]: while in onread callback');
checkInvocations(as[2], { init: 1, before: 1, after: 1, destroy: 1 },
'reqwrap[2]: while in onread callback');
// this callback is called from within the last fs req callback therefore
// the last req is still going and after/destroy haven't been called yet
checkInvocations(as[3], { init: 1, before: 1 },
'reqwrap[3]: while in onread callback');
tick(2);
}
process.on('exit', onexit);
function onexit() {
hooks.disable();
hooks.sanityCheck('FSREQWRAP');
const as = hooks.activitiesOfTypes('FSREQWRAP');
const a = as.pop();
checkInvocations(a, { init: 1, before: 1, after: 1, destroy: 1 },
'when process exits');
}
|
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.
var common = require('../common');
var assert = require('assert');
var Stream = require('stream').Stream;
(function testErrorListenerCatches() {
var source = new Stream();
var dest = new Stream();
source.pipe(dest);
var gotErr = null;
source.on('error', function(err) {
gotErr = err;
});
var err = new Error('This stream turned into bacon.');
source.emit('error', err);
assert.strictEqual(gotErr, err);
})();
(function testErrorWithoutListenerThrows() {
var source = new Stream();
var dest = new Stream();
source.pipe(dest);
var err = new Error('This stream turned into bacon.');
var gotErr = null;
try {
source.emit('error', err);
} catch (e) {
gotErr = e;
}
assert.strictEqual(gotErr, err);
})();
|
import React from 'react';
import test from 'ava';
import { shallow } from 'enzyme';
import SettingsWrapper from '../SettingsWrapper';
test('renders if isEnabled', (t) => {
const wrapper = shallow(<SettingsWrapper isEnabled />);
t.true(wrapper.matchesElement(<div />));
});
test('renders with settings toggle when provided', (t) => {
const settingsToggle = () => <div>Toggle</div>;
const wrapper = shallow(<SettingsWrapper isEnabled SettingsToggle={settingsToggle} />);
t.is(wrapper.html(), '<div><div>Toggle</div></div>');
});
test('renders with style', (t) => {
const style = { backgroundColor: '#EDEDED' };
const wrapper = shallow(<SettingsWrapper isEnabled style={style} />);
t.true(wrapper.matchesElement(<div style={{ backgroundColor: '#EDEDED' }} />));
});
test('renders with className', (t) => {
const wrapper = shallow(<SettingsWrapper isEnabled className="className" />);
t.true(wrapper.matchesElement(<div className="className" />));
});
test('renders with settings if visible and settings component is provided', (t) => {
const settings = () => <div>Settings</div>;
const wrapper = shallow(<SettingsWrapper isEnabled isVisible Settings={settings} />);
t.is(wrapper.html(), '<div><div>Settings</div></div>');
});
test('renders without settings if isVisible is false and settings component is provided', (t) => {
const settings = () => <div>Settings</div>;
const wrapper = shallow(<SettingsWrapper isEnabled isVisible={false} Settings={settings} />);
t.is(wrapper.html(), '<div></div>');
});
|
var fs = require('fs');
var daff = require('daff');
var assert = require('assert');
var Fiber = null;
var sqlite3 = null;
try {
Fiber = require('fibers');
sqlite3 = require('sqlite3');
} catch (err) {
// We don't have what we need for accessing the sqlite database.
// Not an error.
console.log("No sqlite3/fibers");
return;
}
Fiber(function() {
var sql = new SqliteDatabase(new sqlite3.Database(':memory:'),null,Fiber);
sql.exec("CREATE TABLE ver1 (id INTEGER PRIMARY KEY, name TEXT)");
sql.exec("CREATE TABLE ver2 (id INTEGER PRIMARY KEY, name TEXT)");
sql.exec("INSERT INTO ver1 VALUES(?,?)",[1, "Paul"]);
sql.exec("INSERT INTO ver1 VALUES(?,?)",[2, "Naomi"]);
sql.exec("INSERT INTO ver1 VALUES(?,?)",[4, "Hobbes"]);
sql.exec("INSERT INTO ver2 VALUES(?,?)",[2, "Noemi"]);
sql.exec("INSERT INTO ver2 VALUES(?,?)",[3, "Calvin"]);
sql.exec("INSERT INTO ver2 VALUES(?,?)",[4, "Hobbes"]);
var st1 = new daff.SqlTable(sql,"ver1")
var st2 = new daff.SqlTable(sql,"ver2")
var sc = new daff.SqlCompare(sql,st1,st2)
var alignment = sc.apply();
var flags = new daff.CompareFlags();
var td = new daff.TableDiff(alignment,flags);
var out = new daff.TableView([]);
td.hilite(out);
var target = new daff.TableView([['@@', 'id', 'name'],
['+++', 3, 'Calvin'],
['->', 2, 'Naomi->Noemi'],
['---', 1, 'Paul']]);
assert(target.isSimilar(out));
}).run();
|
/**
* @fileoverview transition parser/implementation - still WIP
*
* @author Tony Parisi
*/
goog.provide('glam.TransitionElement');
goog.require('glam.AnimationElement');
glam.TransitionElement.DEFAULT_DURATION = glam.AnimationElement.DEFAULT_DURATION;
glam.TransitionElement.DEFAULT_TIMING_FUNCTION = glam.AnimationElement.DEFAULT_TIMING_FUNCTION;
// transition:transform 2s, background-color 5s linear 2s;
glam.TransitionElement.parse = function(docelt, style, obj) {
var transition = style.transition || "";
var transitions = {
};
var comps = transition.split(",");
var i, len = comps.length;
for (i = 0; i < len; i++) {
var comp = comps[i];
if (comp) {
var params = comp.split(" ");
if (params[0] == "")
params.shift();
var propname = params[0];
var duration = params[1];
var timingFunction = params[2] || glam.TransitionElement.DEFAULT_TIMING_FUNCTION;
var delay = params[3] || "";
duration = glam.AnimationElement.parseTime(duration);
timingFunction = glam.AnimationElement.parseTimingFunction(timingFunction);
delay = glam.AnimationElement.parseTime(delay);
transitions[propname] = {
duration : duration,
timingFunction : timingFunction,
delay : delay
};
}
}
}
|
var assert = require('assert');
var common = require('../../common');
var path = common.fixtures + '/data.csv';
var table = 'multi_load_data_test';
var newline = common.detectNewline(path);
common.getTestConnection({multipleStatements: true}, function (err, connection) {
assert.ifError(err);
common.useTestDb(connection);
connection.query([
'CREATE TEMPORARY TABLE ?? (',
'`id` int(11) unsigned NOT NULL AUTO_INCREMENT,',
'`title` varchar(400),',
'PRIMARY KEY (`id`)',
') ENGINE=InnoDB DEFAULT CHARSET=utf8'
].join('\n'), [table], assert.ifError);
var stmt =
'LOAD DATA LOCAL INFILE ? INTO TABLE ?? CHARACTER SET utf8 ' +
'FIELDS TERMINATED BY ? ' +
'LINES TERMINATED BY ? ' +
'(id, title)';
var sql =
connection.format(stmt, [path, table, ',', newline]) + ';' +
connection.format(stmt, [path, table, ',', newline]) + ';';
connection.query(sql, function (err, results) {
assert.ifError(err);
assert.equal(results.length, 2);
assert.equal(results[0].affectedRows, 5);
assert.equal(results[1].affectedRows, 0);
});
connection.query('SELECT * FROM ??', [table], function (err, rows) {
assert.ifError(err);
assert.equal(rows.length, 5);
assert.equal(rows[0].id, 1);
assert.equal(rows[0].title, 'Hello World');
assert.equal(rows[3].id, 4);
assert.equal(rows[3].title, '中文内容');
assert.equal(rows[4].id, 5);
assert.equal(rows[4].title.length, 321);
assert.equal(rows[4].title, 'this is a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long string');
});
connection.end(assert.ifError);
});
|
'use strict';
// Declare app level module which depends on views, and components
angular.module('sidecar', [
'ngRoute',
'sidecar.services',
// 'sidecar.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/services'});
}]);
|
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _assetloader = require('./assetloader');
var _assetloader2 = _interopRequireDefault(_assetloader);
var _input = require('./input');
var _input2 = _interopRequireDefault(_input);
var _loop = require('./loop');
var _loop2 = _interopRequireDefault(_loop);
var _log = require('./log');
var _log2 = _interopRequireDefault(_log);
var _timer = require('./timer');
var _timer2 = _interopRequireDefault(_timer);
var _math = require('./math');
var _math2 = _interopRequireDefault(_math);
var _types = require('./types');
var _types2 = _interopRequireDefault(_types);
'use strict';
exports['default'] = {
AssetLoader: _assetloader2['default'],
Input: _input2['default'],
Loop: _loop2['default'],
Log: _log2['default'],
Timer: _timer2['default'],
Math: _math2['default'],
Types: _types2['default']
};
module.exports = exports['default'];
|
'use strict';
//Contacts service used to communicate Contacts REST endpoints
angular.module('contacts').factory('Contacts', ['$resource',
function ($resource) {
return $resource('api/v1/contacts/:contactId', {
contactId: '@_id'
}, {
update: {
method: 'PUT'
}
});
}
]);
|
module.exports = {
bundle_id: 'app',
webpack_config: {
entry: './assets/src/app.js',
},
};
|
var debugpp = require('..');
var debugSystem = debugpp.debug('system', true);
var debugSystemTest = debugpp.debug('system.test', true);
debugSystem.log("Hello system!");
debugSystemTest.log("Hello system test!");
debugSystemTest.log("World");
debugSystemTest.warn("Hm?!");
debugSystemTest.error("Huston!!!");
|
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/*.js',
'assets/js/plugins/*.js',
'!assets/js/scripts.min.js'
]
},
uglify: {
dist: {
files: {
'assets/js/scripts.min.js': [
'assets/js/plugins/*.js',
'assets/js/_*.js'
]
}
}
},
imagemin: {
dist: {
options: {
optimizationLevel: 7,
progressive: true
},
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.{png,jpg,jpeg}',
dest: 'images/'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.svg',
dest: 'images/'
}]
}
},
watch: {
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['uglify']
}
},
clean: {
dist: [
'assets/js/scripts.min.js'
]
}
});
// Load tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-svgmin');
// Register tasks
grunt.registerTask('default', [
'clean',
'imagemin',
'svgmin'
]);
grunt.registerTask('dev', [
'watch'
]);
};
|
import Button from './Button';
/**
* The `LinkButton` component defines a `Button` which links to a route.
*
* ### Props
*
* All of the props accepted by `Button`, plus:
*
* - `active` Whether or not the page that this button links to is currently
* active.
* - `href` The URL to link to. If the current URL `m.route()` matches this,
* the `active` prop will automatically be set to true.
*/
export default class LinkButton extends Button {
static initProps(props) {
props.active = this.isActive(props);
props.config = props.config || m.route;
}
view() {
const vdom = super.view();
vdom.tag = 'a';
return vdom;
}
/**
* Determine whether a component with the given props is 'active'.
*
* @param {Object} props
* @return {Boolean}
*/
static isActive(props) {
return typeof props.active !== 'undefined'
? props.active
: m.route() === props.href;
}
}
|
module.exports = function throwIfNonUnexpectedError(err) {
if (err && err.message === 'aggregate error') {
for (var i = 0 ; i < err.length ; i += 1) {
throwIfNonUnexpectedError(err[i]);
}
} else if (!err || !err._isUnexpected) {
throw err;
}
};
|
'use strict';
exports.__esModule = true;
exports.configure = configure;
var _aureliaViewManager = require('aurelia-view-manager');
var _datatable = require('./datatable');
var _columnsFilter = require('./columns-filter');
var _convertManager = require('./convert-manager');
function configure(aurelia) {
aurelia.plugin('aurelia-pager');
aurelia.container.get(_aureliaViewManager.Config).configureNamespace('spoonx/datatable', {
location: './{{framework}}/{{view}}.html'
});
aurelia.globalResources('./datatable');
}
|
file:/home/charlike/dev/glob-fs/fixtures/a/d9.js
|
const DrawCard = require('../../drawcard.js');
class Alayaya extends DrawCard {
setupCardAbilities() {
this.reaction({
when: {
afterChallenge: event => (
event.challenge.winner === this.controller &&
this.isParticipating() &&
event.challenge.loser.gold >= 1)
},
handler: context => {
let otherPlayer = context.event.challenge.loser;
this.game.transferGold({ from: otherPlayer, to: this.controller, amount: 1 });
this.game.addMessage('{0} uses {1} to move 1 gold from {2}\'s gold pool to their own', this.controller, this, otherPlayer);
}
});
}
}
Alayaya.code = '05013';
module.exports = Alayaya;
|
exports.createSession = function(req, res, newUser) {
return req.session.regenerate(function() {
req.session.user = newUser;
// res.redirect('/');
});
};
exports.isLoggedIn = function(req, res) {
// return req.session ? !!req.session.user : false;
console.log(!!req.user);
return req.user ? !!req.user : false;
};
exports.checkUser = function(req, res, next){
if (!exports.isLoggedIn(req)){
res.redirect('/login');
} else {
next();
}
};
|
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function returnValueSquare(x,y,z)
{
WScript.Echo("value:"+ x + " index:" + y + " Object:" + z);
return x*x;
}
function returnIndexSquare(x,y,z)
{
WScript.Echo("value:"+ x + " index:" + y + " Object:" + z);
return y*y;
}
function returnRandom(x,y,z)
{
WScript.Echo("value:"+ x + " index:" + y + " Object:" + z);
return x*y;
}
Array.prototype[6] = 20;
var x = [1,2,3,4,5];
var y = x.map(returnValueSquare,this);
WScript.Echo(y);
x = [10,20,30,40,50];
y = x.map(returnIndexSquare, this);
WScript.Echo(y);
x = [10,20,30,40,50];
y = x.map(returnRandom, this);
WScript.Echo(y);
x = {0: "abc", 1: "def", 2: "xyz"}
x.length = 3;
y = Array.prototype.map.call(x, returnValueSquare,this);
WScript.Echo(y);
y = Array.prototype.map.call(x, returnIndexSquare,this);
WScript.Echo(y);
y = Array.prototype.map.call(x, returnRandom, this);
WScript.Echo(y);
x = [10,20,30,40,50];
x[8] = 10;
y = x.map(returnValueSquare, this);
WScript.Echo(y);
|
const gulp = require('gulp');
const util = require('gulp-util');
const zip = require('gulp-zip');
const release = require('gulp-github-release');
const folders = require('gulp-folders');
const nwBuilder = require('gulp-nw-builder');
const fs = require('fs');
const changelog = require('conventional-changelog');
const execSync = require('child_process').execSync;
const del = require('del');
const vinylPaths = require('vinyl-paths');
const getPaths = require('./_common').getPaths;
const currentTag = require('./_common').currentTag;
const binaryPath = () => getPaths().bin.build + '/OpenChallenge';
gulp.task('clean:binaries', () => {
const paths = getPaths();
return gulp.src([paths.bin.build, paths.bin.release])
.pipe(vinylPaths(del))
.on('error', util.log);
});
gulp.task('package:binaries', ['generate:binaries'], folders(binaryPath(), (folder) => {
return gulp.src(`${binaryPath()}/${folder}/**/*`)
.pipe(zip(`${folder}.zip`))
.pipe(gulp.dest(getPaths().bin.release));
}));
gulp.task('upload:binaries', ['package:binaries'], () => {
return gulp.src(`${getPaths().bin.release}/*.zip`)
.pipe(release({
repo: 'openchallenge',
owner: 'seiyria',
tag: currentTag(),
manifest: require('../package.json')
}));
});
gulp.task('generate:binaries', ['clean:binaries', 'copy:nw'], () => {
execSync('npm install --prefix ./dist/ express');
const paths = getPaths();
return gulp.src(`${paths.dist}/**/*`)
.pipe(nwBuilder({
version: 'v0.12.2',
platforms: ['osx64', 'win64', 'linux64'],
appName: 'OpenChallenge',
appVersion: currentTag(),
buildDir: paths.bin.build,
cacheDir: paths.bin.cache,
macIcns: './favicon.icns',
winIco: './favicon.ico'
}));
});
gulp.task('generate:changelog', () => {
return changelog({
releaseCount: 0,
preset: 'angular'
})
.pipe(fs.createWriteStream('CHANGELOG.md'));
});
|
(function () {
'use strict';
angular
.module('app.layout')
.controller('SidebarController', SidebarController);
SidebarController.$inject = ['routerHelper', '$scope', '$rootScope'];
/* @ngInject */
function SidebarController (routerHelper, $scope, $rootScope) {
var vm = this;
vm.hideSidebar = hideSidebar;
init();
///////////////
function init () {
// generate sidebar nav menus
vm.navs = _getNavMenus();
// tell others we have sidebar
$rootScope.hasSidebar = true;
$scope.$on('$destroy', function () {
$rootScope.hasSidebar = false;
});
}
function hideSidebar () {
$rootScope.showSidebar = false;
}
function _getNavMenus () {
var navs = [];
var allStates = routerHelper.getStates();
allStates.forEach(function (state) {
if (state.sidebar) {
var nav = state.sidebar;
nav.link = state.name;
navs.push(nav);
}
});
return navs;
}
}
})();
|
// ==UserScript==
// @name Sticky vote buttons
// @namespace http://stackexchange.com/users/4337810/
// @version 1.0
// @description Makes the vote buttons next to posts sticky whilst scrolling on that post
// @author ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/)
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @require https://cdn.rawgit.com/EnzoMartin/Sticky-Element/master/jquery.stickyelement.js
// @grant none
// ==/UserScript==
$(document).ready(function() {
$(window).scroll(function(){
$(".votecell").each(function(){
var offset = 0;
if($(".topbar").css("position") == "fixed"){
offset = 34;
}
var vote = $(this).find(".vote");
if($(this).offset().top - $(window).scrollTop() + offset <= 0){
if($(this).offset().top + $(this).height() + offset - $(window).scrollTop() - vote.height() > 0){
vote.css({position:"fixed", left:$(this).offset().left, top:0 + offset});
}else{
vote.css({position:"relative", left:0, top:$(this).height()-vote.height()});
}
}else{
vote.css({position:"relative", left:0, top:0});
}
});
});
});
|
"use strict";
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util/util");
/**
* Abstraction around FirebaseApp's token fetching capabilities.
*/
var AuthTokenProvider = /** @class */ (function () {
/**
* @param {!FirebaseApp} app_
*/
function AuthTokenProvider(app_) {
this.app_ = app_;
}
/**
* @param {boolean} forceRefresh
* @return {!Promise<FirebaseAuthTokenData>}
*/
AuthTokenProvider.prototype.getToken = function (forceRefresh) {
return this.app_['INTERNAL']['getToken'](forceRefresh).then(null,
// .catch
function (error) {
// TODO: Need to figure out all the cases this is raised and whether
// this makes sense.
if (error && error.code === 'auth/token-not-initialized') {
util_1.log('Got auth/token-not-initialized error. Treating as null token.');
return null;
}
else {
return Promise.reject(error);
}
});
};
AuthTokenProvider.prototype.addTokenChangeListener = function (listener) {
// TODO: We might want to wrap the listener and call it with no args to
// avoid a leaky abstraction, but that makes removing the listener harder.
this.app_['INTERNAL']['addAuthTokenListener'](listener);
};
AuthTokenProvider.prototype.removeTokenChangeListener = function (listener) {
this.app_['INTERNAL']['removeAuthTokenListener'](listener);
};
AuthTokenProvider.prototype.notifyForInvalidToken = function () {
var errorMessage = 'Provided authentication credentials for the app named "' +
this.app_.name +
'" are invalid. This usually indicates your app was not ' +
'initialized correctly. ';
if ('credential' in this.app_.options) {
errorMessage +=
'Make sure the "credential" property provided to initializeApp() ' +
'is authorized to access the specified "databaseURL" and is from the correct ' +
'project.';
}
else if ('serviceAccount' in this.app_.options) {
errorMessage +=
'Make sure the "serviceAccount" property provided to initializeApp() ' +
'is authorized to access the specified "databaseURL" and is from the correct ' +
'project.';
}
else {
errorMessage +=
'Make sure the "apiKey" and "databaseURL" properties provided to ' +
'initializeApp() match the values provided for your app at ' +
'https://console.firebase.google.com/.';
}
util_1.warn(errorMessage);
};
return AuthTokenProvider;
}());
exports.AuthTokenProvider = AuthTokenProvider;
//# sourceMappingURL=AuthTokenProvider.js.map
|
import modules from 'ui/modules';
import angular from 'angular';
function Storage(store) {
let self = this;
self.store = store;
self.get = function (key) {
try {
return JSON.parse(self.store.getItem(key));
} catch (e) {
return null;
}
};
self.set = function (key, value) {
try {
return self.store.setItem(key, angular.toJson(value));
} catch (e) {
return false;
}
};
self.remove = function (key) {
return self.store.removeItem(key);
};
self.clear = function () {
return self.store.clear();
};
}
let createService = function (type) {
return function ($window) {
return new Storage($window[type]);
};
};
modules.get('kibana/storage')
.service('localStorage', createService('localStorage'))
.service('sessionStorage', createService('sessionStorage'));
|
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* @name Camera
* @description
* Take a photo or capture video.
*
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
* ```typescript
* import { Camera } from 'ionic-native';
*
*
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* // Handle error
* });
* ```
* @interfaces
* CameraOptions
* CameraPopoverOptions
*/
var Camera = (function () {
function Camera() {
}
/**
* Take a picture or video, or load one from the library.
* @param {CameraOptions?} options optional. Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-).
* @returns {Promise<any>} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
*/
Camera.getPicture = function (options) { return; };
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
* @returns {Promise<any>}
*/
Camera.cleanup = function () { return; };
;
/**
* @private
* @enum {number}
*/
Camera.DestinationType = {
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
DATA_URL: 0,
/** Return file uri (content://media/external/images/media/2 for Android) */
FILE_URI: 1,
/** Return native uri (eg. asset-library://... for iOS) */
NATIVE_URI: 2
};
/**
* @private
* @enum {number}
*/
Camera.EncodingType = {
/** Return JPEG encoded image */
JPEG: 0,
/** Return PNG encoded image */
PNG: 1
};
/**
* @private
* @enum {number}
*/
Camera.MediaType = {
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
PICTURE: 0,
/** Allow selection of video only, ONLY RETURNS URL */
VIDEO: 1,
/** Allow selection from all media types */
ALLMEDIA: 2
};
/**
* @private
* @enum {number}
*/
Camera.PictureSourceType = {
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
PHOTOLIBRARY: 0,
/** Take picture from camera */
CAMERA: 1,
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
SAVEDPHOTOALBUM: 2
};
/**
* @private
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
*/
Camera.PopoverArrowDirection = {
ARROW_UP: 1,
ARROW_DOWN: 2,
ARROW_LEFT: 4,
ARROW_RIGHT: 8,
ARROW_ANY: 15
};
/**
* @private
* @enum {number}
*/
Camera.Direction = {
/** Use the back-facing camera */
BACK: 0,
/** Use the front-facing camera */
FRONT: 1
};
__decorate([
plugin_1.Cordova({
callbackOrder: 'reverse'
})
], Camera, "getPicture", null);
__decorate([
plugin_1.Cordova({
platforms: ['iOS']
})
], Camera, "cleanup", null);
Camera = __decorate([
plugin_1.Plugin({
pluginName: 'Camera',
plugin: 'cordova-plugin-camera',
pluginRef: 'navigator.camera',
repo: 'https://github.com/apache/cordova-plugin-camera',
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
})
], Camera);
return Camera;
}());
exports.Camera = Camera;
//# sourceMappingURL=camera.js.map
|
// Copyright (c) 2020 Uber Technologies, Inc.
//
// 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.
'use strict';
function ThriftConst(def) {
this.name = def.id.name;
this.valueDefinition = def.value;
this.defined = false;
this.value = null;
this.surface = null;
}
ThriftConst.prototype.models = 'value';
ThriftConst.prototype.link = function link(model) {
if (!this.defined) {
this.defined = true;
this.value = model.resolveValue(this.valueDefinition);
this.surface = this.value;
model.consts[this.name] = this.value;
// Alias if first character is not lower-case
if (!/^[a-z]/.test(this.name)) {
model[this.name] = this.value;
}
}
return this;
};
module.exports.ThriftConst = ThriftConst;
|
define(
"dojox/widget/nls/he/FilePicker", ({
name: "שם",
path: "נתיב",
size: "גודל (בבתים)"
})
);
|
import PlanRequiredRoute from "../plan-required";
import Notify from 'ember-notify';
export default PlanRequiredRoute.extend({
model: function(params) {
var _this = this;
return this.store.find('entry', params.entry_id).then(function(entry) {
// Force a reload if the meta data is out of date
var meta = _this.store.metadataFor("entry");
if (meta.current_entry !== entry.get('entryDate')) {
return entry.reload();
} else {
return entry;
}
}, function(data) {
if (data.status === 404) {
// Set the meta data
var meta = data.responseJSON.meta;
_this.store.metaForType("entry", meta);
// Build the dummy record, for use in the new form
var entry = _this.store.createRecord('entry', {
entryDate: params.entry_id
});
return entry;
} else {
Notify.error(data.responseText, {closeAfter: 5000});
}
});
},
setupController: function(controller, model) {
this._super(controller, model);
var meta = this.store.metadataFor("entry");
controller.setProperties({
nextEntry: meta.next_entry,
randomEntry: meta.random_entry,
prevEntry: meta.prev_entry,
entryDatePretty: moment(model.get('entryDate')).format("MMMM Do, YYYY")
});
}
});
|
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'flash', 'de', {
access: 'Skriptzugriff',
accessAlways: 'Immer',
accessNever: 'Nie',
accessSameDomain: 'Gleiche Domain',
alignAbsBottom: 'Abs Unten',
alignAbsMiddle: 'Abs Mitte',
alignBaseline: 'Basislinie',
alignTextTop: 'Text oben',
bgcolor: 'Hintergrundfarbe',
chkFull: 'Vollbildmodus erlauben',
chkLoop: 'Endlosschleife',
chkMenu: 'Flash-Menü aktivieren',
chkPlay: 'Automatisch Abspielen',
flashvars: 'Variablen für Flash',
hSpace: 'Horizontal-Abstand',
properties: 'Flash-Eigenschaften',
propertiesTab: 'Eigenschaften',
quality: 'Qualität',
qualityAutoHigh: 'Auto Hoch',
qualityAutoLow: 'Auto Niedrig',
qualityBest: 'Beste',
qualityHigh: 'Hoch',
qualityLow: 'Niedrig',
qualityMedium: 'Mittel',
scale: 'Skalierung',
scaleAll: 'Alles anzeigen',
scaleFit: 'Passgenau',
scaleNoBorder: 'Ohne Rand',
title: 'Flash-Eigenschaften',
vSpace: 'Vertikal-Abstand',
validateHSpace: 'HSpace muss eine Zahl sein.',
validateSrc: 'URL darf nicht leer sein.',
validateVSpace: 'VSpace muss eine Zahl sein.',
windowMode: 'Fenstermodus',
windowModeOpaque: 'Deckend',
windowModeTransparent: 'Transparent',
windowModeWindow: 'Fenster'
} );
|
var TRACE_LEVEL_NONE = new JsUnitTraceLevel(0, null);
var TRACE_LEVEL_WARNING = new JsUnitTraceLevel(1, "#FF0000");
var TRACE_LEVEL_INFO = new JsUnitTraceLevel(2, "#009966");
var TRACE_LEVEL_DEBUG = new JsUnitTraceLevel(3, "#0000FF");
function JsUnitTracer(testManager) {
this._testManager = testManager;
this._traceWindow = null;
this.popupWindowsBlocked = false;
}
JsUnitTracer.prototype.initialize = function() {
if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked)
this._traceWindow.close();
this._traceWindow = null;
}
JsUnitTracer.prototype.finalize = function() {
if (this._traceWindow != null) {
this._traceWindow.document.write('<\/body>\n<\/html>');
this._traceWindow.document.close();
}
}
JsUnitTracer.prototype.warn = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_WARNING);
}
JsUnitTracer.prototype.inform = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_INFO);
}
JsUnitTracer.prototype.debug = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_DEBUG);
}
JsUnitTracer.prototype._trace = function(message, value, traceLevel) {
if (!top.shouldSubmitResults() && this._getChosenTraceLevel().matches(traceLevel)) {
var traceString = message;
if (value)
traceString += ': ' + value;
var prefix = this._testManager.getTestFileName() + ":" +
this._testManager.getTestFunctionName() + " - ";
this._writeToTraceWindow(prefix, traceString, traceLevel);
}
}
JsUnitTracer.prototype._getChosenTraceLevel = function() {
var levelNumber = eval(top.testManager.traceLevel.value);
return traceLevelByLevelNumber(levelNumber);
}
JsUnitTracer.prototype._writeToTraceWindow = function(prefix, traceString, traceLevel) {
var htmlToAppend = '<p class="jsUnitDefault">' + prefix + '<font color="' + traceLevel.getColor() + '">' + traceString + '</font><\/p>\n';
this._getTraceWindow().document.write(htmlToAppend);
}
JsUnitTracer.prototype._getTraceWindow = function() {
if (this._traceWindow == null && !top.shouldSubmitResults() && !this.popupWindowsBlocked) {
this._traceWindow = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
if (!this._traceWindow)
this.popupWindowsBlocked = true;
else {
var resDoc = this._traceWindow.document;
resDoc.write('<html>\n<head>\n<link rel="stylesheet" href="css/jsUnitStyle.css">\n<title>Tracing - JsUnit<\/title>\n<head>\n<body>');
resDoc.write('<h2>Tracing - JsUnit<\/h2>\n');
resDoc.write('<p class="jsUnitDefault"><i>(Traces are color coded: ');
resDoc.write('<font color="' + TRACE_LEVEL_WARNING.getColor() + '">Warning</font> - ');
resDoc.write('<font color="' + TRACE_LEVEL_INFO.getColor() + '">Information</font> - ');
resDoc.write('<font color="' + TRACE_LEVEL_DEBUG.getColor() + '">Debug</font>');
resDoc.write(')</i></p>');
}
}
return this._traceWindow;
}
if (xbDEBUG.on) {
xbDebugTraceObject('window', 'JsUnitTracer');
}
function JsUnitTraceLevel(levelNumber, color) {
this._levelNumber = levelNumber;
this._color = color;
}
JsUnitTraceLevel.prototype.matches = function(anotherTraceLevel) {
return this._levelNumber >= anotherTraceLevel._levelNumber;
}
JsUnitTraceLevel.prototype.getColor = function() {
return this._color;
}
function traceLevelByLevelNumber(levelNumber) {
switch (levelNumber) {
case 0: return TRACE_LEVEL_NONE;
case 1: return TRACE_LEVEL_WARNING;
case 2: return TRACE_LEVEL_INFO;
case 3: return TRACE_LEVEL_DEBUG;
}
return null;
}
|
var n = 10000000;
function bar(f) { f(10); }
function foo(b) {
var result = 0;
var imUndefined;
var baz;
var set = function (x) { result = x; return (imUndefined, baz); }
baz = 40;
if (b) {
bar(set);
if (result != 10)
throw "Error: bad: " + result;
if (baz !== 40)
throw "Error: bad: " + baz;
if (imUndefined !== void 0)
throw "Error: bad value: " + imUndefined;
return 0;
}
return result;
}
noInline(bar);
noInline(foo);
for (var i = 0; i < n; i++) {
var result = foo(!(i % 100));
if (result != 0)
throw "Error: bad result: " + result;
}
|
// AMD-ID "dojox/math/random/prng4"
define("dojox/math/random/prng4", ["dojo", "dojox"], function(dojo, dojox) {
dojo.getObject("math.random.prng4", true, dojox);
// Copyright (c) 2005 Tom Wu
// All Rights Reserved.
// See "LICENSE-BigInteger" for details.
// prng4.js - uses Arcfour as a PRNG
function Arcfour() {
this.i = 0;
this.j = 0;
this.S = new Array(256);
}
dojo.extend(Arcfour, {
init: function(key){
// summary:
// Initialize arcfour context
// key: int[]
// an array of ints, each from [0..255]
var i, j, t, S = this.S, len = key.length;
for(i = 0; i < 256; ++i){
S[i] = i;
}
j = 0;
for(i = 0; i < 256; ++i){
j = (j + S[i] + key[i % len]) & 255;
t = S[i];
S[i] = S[j];
S[j] = t;
}
this.i = 0;
this.j = 0;
},
next: function(){
var t, i, j, S = this.S;
this.i = i = (this.i + 1) & 255;
this.j = j = (this.j + S[i]) & 255;
t = S[i];
S[i] = S[j];
S[j] = t;
return S[(t + S[i]) & 255];
}
});
dojox.math.random.prng4 = function(){
return new Arcfour();
};
// Pool size must be a multiple of 4 and greater than 32.
// An array of bytes the size of the pool will be passed to init()
dojox.math.random.prng4.size = 256;
return dojox.math.random.prng4;
});
|
/*global waitsFor:true expect:true describe:true beforeEach:true it:true spyOn:true */
describe("Discourse.Utilities", function() {
describe("emailValid", function() {
it("allows upper case in first part of emails", function() {
expect(Discourse.Utilities.emailValid('Bob@example.com')).toBe(true);
});
it("allows upper case in domain of emails", function() {
expect(Discourse.Utilities.emailValid('bob@EXAMPLE.com')).toBe(true);
});
});
describe("validateFilesForUpload", function() {
it("returns false when file is undefined", function() {
expect(Discourse.Utilities.validateFilesForUpload(null)).toBe(false);
expect(Discourse.Utilities.validateFilesForUpload(undefined)).toBe(false);
});
it("returns false when file there is no file", function() {
expect(Discourse.Utilities.validateFilesForUpload([])).toBe(false);
});
it("supports only one file", function() {
spyOn(bootbox, 'alert');
spyOn(Em.String, 'i18n');
expect(Discourse.Utilities.validateFilesForUpload([1, 2])).toBe(false);
expect(bootbox.alert).toHaveBeenCalled();
expect(Em.String.i18n).toHaveBeenCalledWith('post.errors.upload_too_many_images');
});
it("supports only an image", function() {
var html = { type: "text/html" };
spyOn(bootbox, 'alert');
spyOn(Em.String, 'i18n');
expect(Discourse.Utilities.validateFilesForUpload([html])).toBe(false);
expect(bootbox.alert).toHaveBeenCalled();
expect(Em.String.i18n).toHaveBeenCalledWith('post.errors.only_images_are_supported');
});
it("prevents the upload of a too large image", function() {
var image = { type: "image/png", size: 10 * 1024 };
Discourse.SiteSettings.max_upload_size_kb = 5;
spyOn(bootbox, 'alert');
spyOn(Em.String, 'i18n');
expect(Discourse.Utilities.validateFilesForUpload([image])).toBe(false);
expect(bootbox.alert).toHaveBeenCalled();
expect(Em.String.i18n).toHaveBeenCalledWith('post.errors.upload_too_large', { max_size_kb: 5 });
});
it("works", function() {
var image = { type: "image/png", size: 10 * 1024 };
Discourse.SiteSettings.max_upload_size_kb = 15;
expect(Discourse.Utilities.validateFilesForUpload([image])).toBe(true);
});
});
});
|
/**
* @file
* Address widget and GMap geocoder routines.
*/
/*global jQuery, Drupal, GClientGeocoder */
/**
* Provide a shared geocoder.
* Lazy initialize it so it's not resident until needed.
*/
Drupal.gmap.geocoder = function () {
var theGeocoder;
if (!theGeocoder) {
theGeocoder = new google.maps.Geocoder();
}
return theGeocoder;
};
Drupal.gmap.addHandler('gmap', function (elem) {
var obj = this;
obj.bind('geocode_pan', function (addr) {
Drupal.gmap.geocoder().geocode({'address': addr}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
obj.vars.latitude = results[0].geometry.location.lat();
obj.vars.longitude = results[0].geometry.location.lng();
obj.change("move", -1);
}
else {
// Error condition?
}
});
});
obj.bind('geocode_panzoom', function (addr) {
Drupal.gmap.geocoder().geocode({'address': addr}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var place = results[0];
obj.vars.latitude = results[0].geometry.location.lat();
obj.vars.longitude = results[0].geometry.location.lng();
// This is, of course, temporary.
switch (place.AddressDetails.Accuracy) {
case 1: // Country level
obj.vars.zoom = 4;
break;
case 2: // Region (state, province, prefecture, etc.) level
obj.vars.zoom = 6;
break;
case 3: // Sub-region (county, municipality, etc.) level
obj.vars.zoom = 8;
break;
case 4: // Town (city, village) level accuracy. (Since 2.59)
case 5: // Post code (zip code) level accuracy. (Since 2.59)
case 6: // Street level accuracy. (Since 2.59)
case 7: // Intersection level accuracy. (Since 2.59)
case 8: // Address level accuracy. (Since 2.59)
obj.vars.zoom = 12;
}
obj.change('move', -1);
}
});
});
obj.bind('preparemarker', function (marker) {
if (marker.address && (!marker.latitude || !marker.longitude)) {
Drupal.gmap.geocoder().geocode({'address': marker.address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
marker.latitude = results[0].geometry.lat();
marker.longitude = results[0].geometry.lng();
}
});
}
});
});
////////////////////////////////////////
// Address widget //
////////////////////////////////////////
Drupal.gmap.addHandler('address', function (elem) {
var obj = this;
// Respond to focus event.
jQuery(elem).focus(function () {
this.value = '';
});
// Respond to incoming movements.
// Clear the box when the coords change...
var binding = obj.bind("move", function () {
elem.value = 'Enter an address';
});
// Send out outgoing movements.
// This happens ASYNC!!!
jQuery(elem).change(function () {
if (elem.value.length > 0) {
Drupal.gmap.geocoder().geocode({'address': elem.value}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
obj.vars.latitude = results[0].geometry.location.lat();
obj.vars.longitude = results[0].geometry.location.lng();
obj.change("move", binding);
}
else {
// Todo: Get translated value using settings.
elem.value = 'Geocoder error: Address not found';
}
});
}
else {
// Was empty. Ignore.
elem.value = 'Enter an address';
}
});
});
////////////////////////////////////////
// Locpick address handler (testing) //
////////////////////////////////////////
Drupal.gmap.addHandler('locpick_address', function (elem) {
var obj = this;
// Respond to focus event.
jQuery(elem).focus(function () {
this.value = '';
});
// Respond to incoming movements.
// Clear the box when the coords change...
var binding = obj.bind("locpickchange", function () {
elem.value = 'Enter an address';
});
// Send out outgoing movements.
// This happens ASYNC!!!
jQuery(elem).change(function () {
if (elem.value.length > 0) {
Drupal.gmap.geocoder().geocode({'address': elem.value}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
obj.locpick_coord = results[0];
obj.change("locpickchange", binding);
}
else {
// Todo: Get translated value using settings.
elem.value = 'Geocoder error: Address not found';
}
});
}
else {
// Was empty. Ignore.
elem.value = 'Enter an address';
}
});
});
|
/*
* jsPlumb
*
* Title:jsPlumb 2.0.2
*
* Provides a way to visually connect elements on an HTML page, using SVG.
*
* This file contains the code for the Bezier connector type.
*
* Copyright (c) 2010 - 2015 jsPlumb (hello@jsplumbtoolkit.com)
*
* http://jsplumbtoolkit.com
* http://github.com/sporritt/jsplumb
*
* Dual licensed under the MIT and GPL2 licenses.
*/
;
(function () {
"use strict";
var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
var Bezier = function (params) {
params = params || {};
var _super = _jp.Connectors.AbstractConnector.apply(this, arguments),
majorAnchor = params.curviness || 150,
minorAnchor = 10;
this.type = "Bezier";
this.getCurviness = function () {
return majorAnchor;
};
this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) {
// determine if the two anchors are perpendicular to each other in their orientation. we swap the control
// points around if so (code could be tightened up)
var perpendicular = soo[0] != too[0] || soo[1] == too[1],
p = [];
if (!perpendicular) {
if (soo[0] === 0) // X
p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
else p.push(point[0] - (majorAnchor * soo[0]));
if (soo[1] === 0) // Y
p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
else p.push(point[1] + (majorAnchor * too[1]));
}
else {
if (too[0] === 0) // X
p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
else p.push(point[0] + (majorAnchor * too[0]));
if (too[1] === 0) // Y
p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
else p.push(point[1] + (majorAnchor * soo[1]));
}
return p;
};
this._compute = function (paintInfo, p) {
var sp = p.sourcePos,
tp = p.targetPos,
_w = Math.abs(sp[0] - tp[0]),
_h = Math.abs(sp[1] - tp[1]),
_sx = sp[0] < tp[0] ? _w : 0,
_sy = sp[1] < tp[1] ? _h : 0,
_tx = sp[0] < tp[0] ? 0 : _w,
_ty = sp[1] < tp[1] ? 0 : _h,
_CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to),
_CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so);
_super.addSegment(this, "Bezier", {
x1: _sx, y1: _sy, x2: _tx, y2: _ty,
cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1]
});
};
};
_ju.extend(Bezier, _jp.Connectors.AbstractConnector);
_jp.registerConnectorType(Bezier, "Bezier");
}).call(this);
|
/**
* Librerías Javascript
*
* @package Roraima
* @author $Author$ <desarrollo@cidesa.com.ve>
* @version SVN: $Id$
*
* @copyright Copyright 2007, Cide S.A.
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
*/
//FUNCIONES JAVASCRIPT
var form = null;
var arreglo = null;
var inicio = true;
var noActualizarInputs = false;
function ActualizarInputs()
{
if(!noActualizarInputs){
form = $('sf_admin_edit_form');
arreglo = Array();
if(form) arreglo = $$('input[type=text]', 'select','textarea'); // -> only text inputs
var i = 0;
arreglo.each(function(e,index){
if(!e.disabled && !e.readOnly)
{
e.tabindex = index;
i++;
}
});
if(arreglo & inicio) {
try{arreglo.first().focus();}catch(e){}
inicio=false;
}
}
}
///////////////////////////////////////////////////
// Observar si se cargado la p�gina por completo //
///////////////////////////////////////////////////
Event.observe(window, 'load',
function() {
ActualizarInputs();
}
);
///////////////////////////////////////////////////
// Observando si se presiona enter para cmabiar
Event.observe(document, 'keypress', function(event)
{
if(event.keyCode == Event.KEY_RETURN && form) {
if(!noActualizarInputs){
var obj = Event.element(event);
var indice = parseInt(obj.tabindex);
/*arreglo.each(function(e,index){
if(e.name == obj.name) indice = index;
});
*/
var salir=false;
var i=1;
while(!salir)
{
try{
if(!arreglo[indice+i].disabled && !arreglo[indice+i].readOnly)
{
arreglo[indice+i].focus();
try{arreglo[indice+i].select();}catch(e){}
salir=true;
}else {
i++;
}
}catch(e){
if(arreglo[indice])
if(!arreglo[indice].disabled && !arreglo[indice].readOnly)
{
arreglo[indice].blur();
arreglo[indice].focus();
//try{arreglo[indice].select();}catch(e){}
}
salir=true;
}
}
obj.returnEvent = false;
return false;
/*
var indexSig = parseInt(obj.tabindex);
indexSig++;
objSig = $$('input[tabindex=' + indexSig + ']');
if(objSig) objSig.focus();
*/
}
}
return true
})
|
/**
* 100% stacked area are multi-series area charts where categories are stacked (percentage
* values) on top of each other, with an additional category 'Others' that is used to sum
* up the various categories for each series to a perfect 100%.
*/
Ext.define('KitchenSink.view.charts.area.Stacked100', {
extend: 'Ext.Panel',
xtype: 'area-stacked-100',
controller: 'area-stacked-100',
// <example>
// Content between example tags is omitted from code preview.
bodyStyle: 'background: transparent !important',
layout: {
type: 'vbox',
pack: 'center'
},
otherContent: [{
type: 'Controller',
path: 'classic/samples/view/charts/area/Stacked100Controller.js'
}, {
type: 'Store',
path: 'classic/samples/store/Browsers.js'
}],
// </example>
width: 650,
tbar: [
'->',
{
text: 'Preview',
handler: 'onPreview'
}
],
items: [{
xtype: 'cartesian',
reference: 'chart',
width: '100%',
height: 500,
insetPadding: 40,
store: {
type: 'browsers'
},
legend: {
docked: 'bottom'
},
sprites: [{
type: 'text',
text: 'Area Charts - 100% Stacked Area',
fontSize: 22,
width: 100,
height: 30,
x: 40, // the sprite x position
y: 20 // the sprite y position
}, {
type: 'text',
text: 'Data: Browser Stats 2012',
fontSize: 10,
x: 12,
y: 420
}, {
type: 'text',
text: 'Source: http://www.w3schools.com/',
fontSize: 10,
x: 12,
y: 435
}],
axes: [{
type: 'numeric',
position: 'left',
fields: ['data1', 'data2', 'data3', 'data4', 'other' ],
grid: true,
minimum: 0,
maximum: 100,
renderer: 'onAxisLabelRender'
}, {
type: 'category',
position: 'bottom',
fields: 'month',
grid: true,
label: {
rotate: {
degrees: -45
}
}
}],
series: [{
type: 'area',
fullStack: true,
title: [ 'IE', 'Firefox', 'Chrome', 'Safari', 'Others' ],
xField: 'month',
yField: [ 'data1', 'data2', 'data3', 'data4', 'other' ],
style: {
opacity: 0.80
},
marker: {
opacity: 0,
scaling: 0.01,
fx: {
duration: 200,
easing: 'easeOut'
}
},
highlightCfg: {
opacity: 1,
scaling: 1.5
},
tooltip: {
trackMouse: true,
renderer: 'onSeriesTooltipRender'
}
}]
//<example>
}, {
style: 'margin-top: 10px;',
xtype: 'gridpanel',
columns : {
defaults: {
sortable: false,
menuDisabled: true,
renderer: 'onColumnRender'
},
items: [
{ text: 'Month', dataIndex: 'month', renderer: Ext.identityFn },
{ text: 'IE', dataIndex: 'data1' },
{ text: 'Firefox', dataIndex: 'data2' },
{ text: 'Chrome', dataIndex: 'data3' },
{ text: 'Safari', dataIndex: 'data4' },
{ text: 'Other', dataIndex: 'other' }
]
},
store: {
type: 'browsers'
},
width: '100%'
//</example>
}]
});
|
var searchData=
[
['_7eqresourcestream',['~QResourceStream',['../classqsf_1_1QResourceStream.html#a5bea8c4481aec48f45d10c0b98e366a9',1,'qsf::QResourceStream']]],
['_7eqsfmlwidget',['~QSFMLWidget',['../classqsf_1_1QSFMLWidget.html#a4eae9c14ac6a8389edcd5949e154f337',1,'qsf::QSFMLWidget']]]
];
|
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/en-au/gregorian",{"dateFormatItem-yMEd":"E, d/M/y","timeFormat-full":"h:mm:ss a zzzz","timeFormat-medium":"h:mm:ss a","dateFormatItem-MEd":"E, d/M","dateFormat-medium":"dd/MM/y","dateFormatItem-yMd":"d/M/y","dateFormat-full":"EEEE, d MMMM y","timeFormat-long":"h:mm:ss a z","timeFormat-short":"h:mm a","dateFormat-short":"d/MM/yy","dateFormat-long":"d MMMM y","dateFormatItem-MMMEd":"E, d MMM"});
|
import ModalTrigger from 'ember-modal/components/modal-trigger';
export default ModalTrigger;
|
'use strict';
define(['angular-mocks'], function(angularMocks) {
describe('the adverse event service', function() {
var rootScope, q,
adverseEventService,
outcomeServiceMock = jasmine.createSpyObj('OutcomeService', ['queryItems', 'addItem', 'editItem', 'deleteItem']),
outcomeQueryDefer,
outcomeAddDefer,
outcomeEditDefer,
outcomeDeleteDefer;
beforeEach(function() {
module('trialverse.adverseEvent', function($provide) {
$provide.value('OutcomeService', outcomeServiceMock);
});
});
beforeEach(module('trialverse.adverseEvent'));
beforeEach(angularMocks.inject(function($q, $rootScope, AdverseEventService) {
q = $q;
rootScope = $rootScope;
adverseEventService = AdverseEventService;
outcomeQueryDefer = q.defer();
outcomeServiceMock.queryItems.and.returnValue(outcomeQueryDefer.promise);
outcomeAddDefer = q.defer();
outcomeServiceMock.addItem.and.returnValue(outcomeAddDefer.promise);
outcomeEditDefer = q.defer();
outcomeServiceMock.editItem.and.returnValue(outcomeEditDefer.promise);
outcomeDeleteDefer = q.defer();
outcomeServiceMock.deleteItem.and.returnValue(outcomeDeleteDefer.promise);
}));
describe('query adverse events', function() {
beforeEach(function() {
outcomeQueryDefer.resolve([{
id: 'item1'
}]);
});
it('should query the events', function(done) {
adverseEventService.queryItems().then(function(items) {
expect(items.length).toBe(1);
expect(outcomeServiceMock.queryItems).toHaveBeenCalled();
done();
});
rootScope.$digest();
});
});
describe('add adverse event', function() {
beforeEach(function(){
outcomeAddDefer.resolve({});
});
it('should add the advere event', function(done) {
adverseEventService.addItem({}).then(function() {
expect(outcomeServiceMock.addItem).toHaveBeenCalled();
done();
});
rootScope.$digest();
});
});
describe('edit adverse event', function() {
beforeEach(function(){
outcomeEditDefer.resolve({});
});
it('should edit the adverse event', function(done) {
adverseEventService.editItem({}).then(function() {
expect(outcomeServiceMock.editItem).toHaveBeenCalled();
done();
});
rootScope.$digest();
});
});
describe('delete adverse event', function() {
beforeEach(function(){
outcomeDeleteDefer.resolve({});
});
it('should delete the adverse event', function(done) {
adverseEventService.deleteItem({}).then(function() {
expect(outcomeServiceMock.deleteItem).toHaveBeenCalled();
done();
});
rootScope.$digest();
});
});
});
});
|
/*
Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dijit._base.manager"]){
dojo._hasResource["dijit._base.manager"]=true;
dojo.provide("dijit._base.manager");
dojo.declare("dijit.WidgetSet",null,{constructor:function(){
this._hash={};
},add:function(_1){
if(this._hash[_1.id]){
throw new Error("Tried to register widget with id=="+_1.id+" but that id is already registered");
}
this._hash[_1.id]=_1;
},remove:function(id){
delete this._hash[id];
},forEach:function(_3){
for(var id in this._hash){
_3(this._hash[id]);
}
},filter:function(_5){
var _6=new dijit.WidgetSet();
this.forEach(function(_7){
if(_5(_7)){
_6.add(_7);
}
});
return _6;
},byId:function(id){
return this._hash[id];
},byClass:function(_9){
return this.filter(function(_a){
return _a.declaredClass==_9;
});
}});
dijit.registry=new dijit.WidgetSet();
dijit._widgetTypeCtr={};
dijit.getUniqueId=function(_b){
var id;
do{
id=_b+"_"+(_b in dijit._widgetTypeCtr?++dijit._widgetTypeCtr[_b]:dijit._widgetTypeCtr[_b]=0);
}while(dijit.byId(id));
return id;
};
if(dojo.isIE){
dojo.addOnWindowUnload(function(){
dijit.registry.forEach(function(_d){
_d.destroy();
});
});
}
dijit.byId=function(id){
return (dojo.isString(id))?dijit.registry.byId(id):id;
};
dijit.byNode=function(_f){
return dijit.registry.byId(_f.getAttribute("widgetId"));
};
dijit.getEnclosingWidget=function(_10){
while(_10){
if(_10.getAttribute&&_10.getAttribute("widgetId")){
return dijit.registry.byId(_10.getAttribute("widgetId"));
}
_10=_10.parentNode;
}
return null;
};
dijit._tabElements={area:true,button:true,input:true,object:true,select:true,textarea:true};
dijit._isElementShown=function(_11){
var _12=dojo.style(_11);
return (_12.visibility!="hidden")&&(_12.visibility!="collapsed")&&(_12.display!="none")&&(dojo.attr(_11,"type")!="hidden");
};
dijit.isTabNavigable=function(_13){
if(dojo.hasAttr(_13,"disabled")){
return false;
}
var _14=dojo.hasAttr(_13,"tabindex");
var _15=dojo.attr(_13,"tabindex");
if(_14&&_15>=0){
return true;
}
var _16=_13.nodeName.toLowerCase();
if(((_16=="a"&&dojo.hasAttr(_13,"href"))||dijit._tabElements[_16])&&(!_14||_15>=0)){
return true;
}
return false;
};
dijit._getTabNavigable=function(_17){
var _18,_19,_1a,_1b,_1c,_1d;
var _1e=function(_1f){
dojo.query("> *",_1f).forEach(function(_20){
var _21=dijit._isElementShown(_20);
if(_21&&dijit.isTabNavigable(_20)){
var _22=dojo.attr(_20,"tabindex");
if(!dojo.hasAttr(_20,"tabindex")||_22==0){
if(!_18){
_18=_20;
}
_19=_20;
}else{
if(_22>0){
if(!_1a||_22<_1b){
_1b=_22;
_1a=_20;
}
if(!_1c||_22>=_1d){
_1d=_22;
_1c=_20;
}
}
}
}
if(_21&&_20.nodeName.toUpperCase()!="SELECT"){
_1e(_20);
}
});
};
if(dijit._isElementShown(_17)){
_1e(_17);
}
return {first:_18,last:_19,lowest:_1a,highest:_1c};
};
dijit.getFirstInTabbingOrder=function(_23){
var _24=dijit._getTabNavigable(dojo.byId(_23));
return _24.lowest?_24.lowest:_24.first;
};
dijit.getLastInTabbingOrder=function(_25){
var _26=dijit._getTabNavigable(dojo.byId(_25));
return _26.last?_26.last:_26.highest;
};
dijit.defaultDuration=dojo.config["defaultDuration"]||200;
}
|
// This file is part of Pa11y Webservice.
//
// Pa11y Webservice is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pa11y Webservice is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pa11y Webservice. If not, see <http://www.gnu.org/licenses/>.
'use strict';
const assert = require('proclaim');
describe('GET /tasks/results', function() {
describe('with no query', function() {
beforeEach(function(done) {
const request = {
method: 'GET',
endpoint: 'tasks/results'
};
this.navigate(request, done);
});
it('should send a 200 status', function() {
assert.strictEqual(this.last.status, 200);
});
it('should output a JSON representation of all results (in the last 30 days) sorted by date', async function() {
const body = this.last.body;
const results = await this.app.model.result.getAll({});
assert.isArray(body);
assert.strictEqual(body.length, 4);
assert.strictEqual(body[0].id, 'def000000000000000000001');
assert.isUndefined(body[0].results);
assert.strictEqual(body[1].id, 'def000000000000000000002');
assert.isUndefined(body[1].results);
assert.strictEqual(body[2].id, 'def000000000000000000003');
assert.isUndefined(body[2].results);
assert.strictEqual(body[3].id, 'def000000000000000000004');
assert.isUndefined(body[3].results);
assert.deepEqual(body, results);
});
});
describe('with date-range query', function() {
let query;
beforeEach(function(done) {
const request = {
method: 'GET',
endpoint: 'tasks/results',
query: {
from: '2013-01-02',
to: '2013-01-07'
}
};
query = request.query;
this.navigate(request, done);
});
it('should send a 200 status', function() {
assert.strictEqual(this.last.status, 200);
});
it('should output a JSON representation of all expected results sorted by date', async function() {
const body = this.last.body;
const results = await this.app.model.result.getAll(query);
assert.isArray(body);
assert.strictEqual(body.length, 2);
assert.strictEqual(body[0].id, 'def000000000000000000007');
assert.isUndefined(body[0].results);
assert.strictEqual(body[1].id, 'def000000000000000000006');
assert.isUndefined(body[1].results);
assert.deepEqual(body, results);
});
});
describe('with full details query', function() {
let query;
beforeEach(function(done) {
const request = {
method: 'GET',
endpoint: 'tasks/results',
query: {
full: true
}
};
query = request.query;
this.navigate(request, done);
});
it('should send a 200 status', function() {
assert.strictEqual(this.last.status, 200);
});
it('should output a JSON representation of all results (in the last 30 days) with full details sorted by date', async function() {
const body = this.last.body;
const results = await this.app.model.result.getAll(query);
assert.isArray(body);
assert.strictEqual(body.length, 4);
assert.strictEqual(body[0].id, 'def000000000000000000001');
assert.isArray(body[0].results);
assert.strictEqual(body[1].id, 'def000000000000000000002');
assert.isArray(body[1].results);
assert.strictEqual(body[2].id, 'def000000000000000000003');
assert.isArray(body[2].results);
assert.strictEqual(body[3].id, 'def000000000000000000004');
assert.isArray(body[3].results);
assert.deepEqual(body, results);
});
});
describe('with invalid query', function() {
beforeEach(function(done) {
const request = {
method: 'GET',
endpoint: 'tasks/results',
query: {
foo: 'bar'
}
};
this.navigate(request, done);
});
it('should send a 400 status', function() {
assert.strictEqual(this.last.status, 400);
});
});
});
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
File Name: 15.9.5.13.js
ECMA Section: 15.9.5.13
Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "15.9.5.13";
var VERSION = "ECMA_1";
startTest();
var TITLE = "Date.prototype.getUTCDay()";
writeHeaderToLog( SECTION + " "+ TITLE);
addTestCase( TIME_1970 );
test();
function addTestCase( t ) {
var start = TimeFromYear(YearFromTime(t));
var stop = TimeFromYear(YearFromTime(t) + 1);
for (var d = start; d < stop; d += msPerDay)
{
new TestCase( SECTION,
"(new Date("+d+")).getUTCDay()",
WeekDay((d)),
(new Date(d)).getUTCDay() );
}
}
|
// Copyright 2013 the V8 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.
// Flags: --harmony-unicode-regexps
var s = "a".repeat(1E7) + "\u1234";
assertEquals(["\u1234", "\u1234"], /(\u1234)/u.exec(s));
|
var node = S(input, "application/json");
node.lastIndexOf("test");
|
define([
'text!views/home/home.html'
], function (template) {
var model = kendo.observable({
title: 'Home'
});
var view = new kendo.View(template, { model: model });
return view;
});
|
//>>built
define(
"dojox/editor/plugins/nls/da/TextColor", //begin v1.x content
({
"setButtonText": "Definér",
"cancelButtonText": "Annullér"
})
//end v1.x content
);
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.2.3.6-3-134
description: >
Object.defineProperty - 'value' property in 'Attributes' is own
accessor property that overrides an inherited data property
(8.10.5 step 5.a)
---*/
var obj = {};
var proto = {
value: "inheritedDataProperty"
};
var ConstructFun = function () { };
ConstructFun.prototype = proto;
var child = new ConstructFun();
Object.defineProperty(child, "value", {
get: function () {
return "ownAccessorProperty";
}
});
Object.defineProperty(obj, "property", child);
assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property');
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
import { Log } from './Log.js';
import { IFrameWindow } from './IFrameWindow.js';
export class IFrameNavigator {
prepare(params) {
let frame = new IFrameWindow(params);
return Promise.resolve(frame);
}
callback(url) {
Log.debug("IFrameNavigator.callback");
try {
IFrameWindow.notifyParent(url);
return Promise.resolve();
}
catch (e) {
return Promise.reject(e);
}
}
}
|
/**
* Copyright 2013 Google, Inc.
* @fileoverview Calculate SHA1 hash of the given content.
*/
goog.provide("adapt.sha1");
goog.require("adapt.base");
/**
* @param {number} n
* @return {string} big-endian byte sequence
*/
adapt.sha1.encode32 = function(n) {
return String.fromCharCode((n >>> 24)&0xFF, (n >>> 16)&0xFF, (n >>> 8)&0xFF, n&0xFF);
};
/**
* @param {string} bytes big-endian byte sequence
* @return {number}
*/
adapt.sha1.decode32 = function(bytes) {
// Important facts: "".charCodeAt(0) == NaN, NaN & 0xFF == 0
var b0 = bytes.charCodeAt(0) & 0xFF;
var b1 = bytes.charCodeAt(1) & 0xFF;
var b2 = bytes.charCodeAt(2) & 0xFF;
var b3 = bytes.charCodeAt(3) & 0xFF;
return (b0 << 24) | (b1 << 16) | (b2 << 8) | b3;
};
/**
* @param {string} bytes chars with codes 0 - 255 that represent message byte values
* @return {Array.<number>} big-endian uint32 numbers representing sha1 hash
*/
adapt.sha1.bytesToSHA1Int32 = function(bytes) {
var sb = new adapt.base.StringBuffer();
sb.append(bytes);
var appendCount = (55 - bytes.length) & 63;
sb.append('\u0080');
while (appendCount > 0) {
appendCount--;
sb.append('\0');
}
sb.append('\0\0\0\0');
sb.append(adapt.sha1.encode32(bytes.length*8));
bytes = sb.toString();
var h = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0];
var w = /** @type Array.<number> */ ([]);
var i;
for (var bi = 0; bi < bytes.length; bi += 64) {
for (i = 0; i < 16; i++) {
w[i] = adapt.sha1.decode32(bytes.substr(bi + 4*i, 4));
}
for ( ; i < 80; i++) {
var q = w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16];
w[i] = (q << 1) | (q >>> 31);
}
var a = h[0];
var b = h[1];
var c = h[2];
var d = h[3];
var e = h[4];
var f;
for (i = 0; i < 80; i++) {
if (i < 20) {
f = ((b & c) | (~b & d)) + 0x5A827999;
} else if (i < 40) {
f = (b ^ c ^ d) + 0x6ED9EBA1;
} else if (i < 60) {
f = ((b & c) | (b & d) | (c & d)) + 0x8F1BBCDC;
} else {
f = (b ^ c ^ d) + 0xCA62C1D6;
}
f += ((a << 5) | (a >>> 27)) + e + w[i];
e = d;
d = c;
c = (b << 30) | (b >>> 2);
b = a;
a = f;
}
h[0] = (h[0] + a) | 0;
h[1] = (h[1] + b) | 0;
h[2] = (h[2] + c) | 0;
h[3] = (h[3] + d) | 0;
h[4] = (h[4] + e) | 0;
}
return h;
};
/**
* @param {string} bytes chars with codes 0 - 255 that represent message byte values
* @return {Array.<number>} uint8 numbers representing sha1 hash
*/
adapt.sha1.bytesToSHA1Int8 = function(bytes) {
var h = adapt.sha1.bytesToSHA1Int32(bytes);
var res = [];
for (var i = 0; i < h.length; i++) {
var n = h[i];
res.push((n >>> 24)&0xFF, (n >>> 16)&0xFF, (n >>> 8)&0xFF, n&0xFF);
}
return res;
};
/**
* @param {string} bytes chars with codes 0 - 255 that represent message byte values
* @return {string} chars with codes 0 - 255 equal to SHA1 hash of the input
*/
adapt.sha1.bytesToSHA1Bytes = function(bytes) {
var h = adapt.sha1.bytesToSHA1Int32(bytes);
var sb = new adapt.base.StringBuffer();
for (var i = 0; i < h.length; i++) {
sb.append(adapt.sha1.encode32(h[i]));
}
return sb.toString();
};
/**
* @param {string} bytes chars with codes 0 - 255 that represent message byte values
* @return {string} hex-encoded SHA1 hash
*/
adapt.sha1.bytesToSHA1Hex = function(bytes) {
var sha1 = adapt.sha1.bytesToSHA1Bytes(bytes);
var sb = new adapt.base.StringBuffer();
for (var i = 0; i < sha1.length; i++) {
sb.append((sha1.charCodeAt(i)|0x100).toString(16).substr(1));
}
return sb.toString();
};
/**
* @param {string} bytes chars with codes 0 - 255 that represent message byte values
* @return {string} base64-encoded SHA1 hash of the input
*/
adapt.sha1.bytesToSHA1Base64 = function(bytes) {
var sha1 = adapt.sha1.bytesToSHA1Bytes(bytes);
var sb = new adapt.base.StringBuffer();
adapt.base.appendBase64(sb, sha1);
return sb.toString();
};
|
(function () {
var ns = $.namespace('pskl.controller.settings');
var settings = {
'user' : {
template : 'templates/settings/preferences.html',
controller : ns.PreferencesController
},
'resize' : {
template : 'templates/settings/resize.html',
controller : ns.resize.ResizeController
},
'export' : {
template : 'templates/settings/export.html',
controller : ns.exportimage.ExportController
},
'import' : {
template : 'templates/settings/import.html',
controller : ns.ImportController
},
'localstorage' : {
template : 'templates/settings/localstorage.html',
controller : ns.LocalStorageController
},
'save' : {
template : 'templates/settings/save.html',
controller : ns.SaveController
}
};
var SEL_SETTING_CLS = 'has-expanded-drawer';
var EXP_DRAWER_CLS = 'expanded';
ns.SettingsController = function (piskelController) {
this.piskelController = piskelController;
this.closeDrawerShortcut = pskl.service.keyboard.Shortcuts.MISC.CLOSE_POPUP;
this.settingsContainer = document.querySelector('[data-pskl-controller=settings]');
this.drawerContainer = document.getElementById('drawer-container');
this.isExpanded = false;
this.currentSetting = null;
};
/**
* @public
*/
ns.SettingsController.prototype.init = function() {
pskl.utils.Event.addEventListener(this.settingsContainer, 'click', this.onSettingsContainerClick_, this);
pskl.utils.Event.addEventListener(document.body, 'click', this.onBodyClick_, this);
$.subscribe(Events.CLOSE_SETTINGS_DRAWER, this.closeDrawer_.bind(this));
};
ns.SettingsController.prototype.onSettingsContainerClick_ = function (evt) {
var setting = pskl.utils.Dom.getData(evt.target, 'setting');
if (!setting) {
return;
}
if (this.currentSetting != setting) {
this.loadSetting_(setting);
} else {
this.closeDrawer_();
}
evt.stopPropagation();
evt.preventDefault();
};
ns.SettingsController.prototype.onBodyClick_ = function (evt) {
var target = evt.target;
var isInDrawerContainer = pskl.utils.Dom.isParent(target, this.drawerContainer);
var isInSettingsIcon = target.dataset.setting;
var isInSettingsContainer = isInDrawerContainer || isInSettingsIcon;
if (this.isExpanded && !isInSettingsContainer) {
this.closeDrawer_();
}
};
ns.SettingsController.prototype.loadSetting_ = function (setting) {
this.drawerContainer.innerHTML = pskl.utils.Template.get(settings[setting].template);
// when switching settings controller, destroy previously loaded controller
this.destroyCurrentController_();
this.currentSetting = setting;
this.currentController = new settings[setting].controller(this.piskelController);
this.currentController.init();
pskl.app.shortcutService.registerShortcut(this.closeDrawerShortcut, this.closeDrawer_.bind(this));
pskl.utils.Dom.removeClass(SEL_SETTING_CLS);
var selectedSettingButton = document.querySelector('[data-setting=' + setting + ']');
if (selectedSettingButton) {
selectedSettingButton.classList.add(SEL_SETTING_CLS);
}
this.settingsContainer.classList.add(EXP_DRAWER_CLS);
this.isExpanded = true;
};
ns.SettingsController.prototype.closeDrawer_ = function () {
pskl.utils.Dom.removeClass(SEL_SETTING_CLS);
this.settingsContainer.classList.remove(EXP_DRAWER_CLS);
this.isExpanded = false;
this.currentSetting = null;
document.activeElement.blur();
this.destroyCurrentController_();
};
ns.SettingsController.prototype.destroyCurrentController_ = function () {
if (this.currentController) {
pskl.app.shortcutService.unregisterShortcut(this.closeDrawerShortcut);
if (this.currentController.destroy) {
this.currentController.destroy();
this.currentController = null;
}
}
};
})();
|
// Copyright 2015-present runtime.js project authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License 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.
'use strict';
class BufferBuilder {
constructor() {
this._p = [];
this._repeatFirst = 0;
this._repeatLast = 0;
this._ck = null;
this._checksumFirst = 0;
this._checksumLast = 0;
this._checksumOffset = 0;
}
uint8(valueOpt) {
const value = (valueOpt >>> 0) & 0xff;
this._p.push(value);
this._repeatFirst = this._p.length - 1;
this._repeatLast = this._p.length;
return this;
}
uint16(valueOpt) {
const value = valueOpt >>> 0;
this.uint8((value >>> 8) & 0xff);
this.uint8(value & 0xff);
this._repeatFirst = this._p.length - 2;
this._repeatLast = this._p.length;
return this;
}
beginChecksum() {
this._checksumFirst = this._p.length;
return this;
}
endChecksum() {
this._checksumLast = this._p.length;
return this;
}
checksum(fn) {
this._checksumOffset = this._p.length;
this._ck = fn;
return this.uint16(0);
}
uint32(valueOpt) {
const value = valueOpt >>> 0;
this.uint8((value >>> 24) & 0xff);
this.uint8((value >>> 16) & 0xff);
this.uint8((value >>> 8) & 0xff);
this.uint8(value & 0xff);
this._repeatFirst = this._p.length - 4;
this._repeatLast = this._p.length;
return this;
}
align(alignment = 0, value = 0) {
while ((this._p.length % alignment) !== 0) {
this.uint8(value);
}
return this;
}
array(u8) {
for (const item of u8) {
this.uint8(item & 0xff);
}
this._repeatFirst = this._p.length - u8.length;
this._repeatLast = this._p.length;
return this;
}
repeat(times = 0) {
for (let t = 0; t < times; ++t) {
for (let i = this._repeatFirst; i < this._repeatLast; ++i) {
this._p.push(this._p[i]);
}
}
return this;
}
buffer() {
const buf = new Uint8Array(this._p);
if (this._ck) {
if (this._checksumLast === 0) {
this._checksumLast = this._p.length;
}
const sub = buf.subarray(this._checksumFirst, this._checksumLast);
const cksum = this._ck(sub);
buf[this._checksumOffset] = (cksum >>> 8) & 0xff;
buf[this._checksumOffset + 1] = cksum & 0xff;
}
return buf;
}
}
module.exports = BufferBuilder;
|
var b;
b.reduce(function (c, d) {
return c + d;
}, 0); // should not error on '+'
|
continue;
ONE:
for (var x in {})
continue TWO;
TWO:
for (var x in {}) {
var fn = function () {
continue TWO;
};
}
THREE:
for (var x in {}) {
var fn = function () {
continue THREE;
};
}
for (var x in {}) {
continue FIVE;
FIVE:
for (var x in {}) {
}
}
NINE:
var y = 12;
for (var x in {}) {
continue NINE;
}
|
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
activitiApp.controller('LandingController', ['$scope','$window', '$location', '$http', '$translate', '$modal', 'RuntimeAppDefinitionService', '$rootScope',
function ($scope, $window, $location, $http, $translate, $modal, RuntimeAppDefinitionService, $rootScope) {
$scope.model = {
loading: true
};
$translate('APP.ACTION.DELETE').then(function(message) {
$scope.appActions = [
{
text: message,
click: 'deleteApp(app); '
}
];
});
$scope.loadApps = function() {
$scope.model.customAppsFetched = false;
RuntimeAppDefinitionService.getApplications().then(function(result){
$scope.model.apps = result.defaultApps.concat(result.customApps);
$scope.model.customAppsFetched = true;
$scope.model.customApps = result.customApps.length > 0;
// Determine the full url with a context root (if any)
var baseUrl = $location.absUrl();
var index = baseUrl.indexOf('/#');
if (index >= 0) {
baseUrl = baseUrl.substring(0, index);
}
index = baseUrl.indexOf('?');
if (index >= 0) {
baseUrl = baseUrl.substring(0, index);
}
if (baseUrl[baseUrl.length - 1] == '/') {
baseUrl = baseUrl.substring(0, baseUrl.length - 1);
}
$scope.urls = {
editor: baseUrl + '/editor/',
identity: baseUrl + '/idm/',
workflow: baseUrl + '/workflow/',
analytics: baseUrl + '/analytics/'
};
})
};
$scope.appSelected = function(app) {
if(app.fixedUrl) {
$window.location.href = app.fixedUrl;
}
};
$scope.addAppDefinition = function() {
_internalCreateModal({
template: 'views/modal/add-app-definition-modal.html',
scope: $scope
}, $modal, $scope);
};
$scope.deleteApp = function(app) {
if(app && app.id) {
RuntimeAppDefinitionService.deleteAppDefinition(app.id).then(function() {
$rootScope.addAlertPromise($translate('APP.MESSAGE.DELETED'), 'info')
// Remove app from list
var index = -1;
for(var i=0; i< $scope.model.apps.length; i++) {
if($scope.model.apps[i].id == app.id) {
index = i;
break;
}
}
if(index >= 0) {
$scope.model.apps.splice(index, 1);
}
});
}
};
$scope.loadApps();
}]
);
|
const React = require('react');
const CompLibrary = require('../../core/CompLibrary');
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
const CWD = process.cwd();
const translate = require('../../server/translate.js').translate;
const siteConfig = require(`${CWD}/siteConfig.js`);
// versions post docusaurus
const versions = require(`${CWD}/versions.json`);
// versions pre docusaurus
const oldversions = require(`${CWD}/oldversions.json`);
function Versions(props) {
const latestStableVersion = versions[0];
const repoUrl = `https://github.com/${siteConfig.organizationName}/${
siteConfig.projectName
}`;
return (
<div className="pageContainer">
<Container className="mainContainer documentContainer postContainer">
<div className="post">
<header className="postHeader">
<h1>{siteConfig.title} <translate>Versions</translate></h1>
</header>
<h3 id="latest"><translate>Latest Stable Version</translate></h3>
<p><translate>Latest stable release of Apache Pulsar.</translate></p>
<table className="versions">
<tbody>
<tr>
<th>{latestStableVersion}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/${props.language}/standalone`}>
<translate>
Documentation
</translate>
</a>
</td>
<td>
<a href={`${siteConfig.baseUrl}release-notes#${latestStableVersion}`}>
<translate>
Release Notes
</translate>
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="rc"><translate>Latest Version</translate></h3>
<translate>
Here you can find the latest documentation and unreleased code.
</translate>
<table className="versions">
<tbody>
<tr>
<th>master</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/${props.language}/next/standalone`}>
<translate>Documentation</translate>
</a>
</td>
<td>
<a href={repoUrl}><translate>Source Code</translate></a>
</td>
</tr>
</tbody>
</table>
<h3 id="archive"><translate>Past Versions</translate></h3>
<p>
<translate>
Here you can find documentation for previous versions of Apache Pulsar.
</translate>
</p>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestStableVersion && (
<tr key={version}>
<th>{version}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/${props.language}/${version}/standalone`}>
<translate>Documentation</translate>
</a>
</td>
<td>
<a href={`${siteConfig.baseUrl}release-notes#${version}`}>
<translate>Release Notes</translate>
</a>
</td>
</tr>
)
)}
{oldversions.map(
version =>
version !== latestStableVersion && (
<tr key={version}>
<th>{version}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/v${version}/getting-started/LocalCluster/`}>
<translate>Documentation</translate>
</a>
</td>
<td>
<a href={`${siteConfig.baseUrl}release-notes#${version}`}>
<translate>Release Notes</translate>
</a>
</td>
</tr>
)
)}
</tbody>
</table>
<p>
<translate>
You can find past versions of this project on{' '}
<a href={`${repoUrl}/releases`}>GitHub</a> or download from{' '}
<a href={`${siteConfig.baseUrl}download`}>Apache</a>.
</translate>
</p>
</div>
</Container>
</div>
);
}
Versions.title = 'Versions';
module.exports = Versions;
|
var searchData=
[
['jsontographfunction',['jsonToGraphFunction',['../namespacechi.html#a6a3fedb48e6702c016f996d8a7f445fc',1,'chi']]],
['jsontographmodule',['jsonToGraphModule',['../namespacechi.html#a4489e333fecc4168278e94f8b3f81e3c',1,'chi']]],
['jsontographstruct',['jsonToGraphStruct',['../namespacechi.html#a629f77832b6e7a6e0eaab123c4be1cda',1,'chi']]],
['jumpbackinst',['jumpBackInst',['../structchi_1_1NodeCompiler.html#a7dc06ad0390f2113fbeb5e7c0cf3dd06',1,'chi::NodeCompiler']]]
];
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Based in part on code from Apache Ripple, https://github.com/apache/incubator-ripple
var utils = require('utils');
var _lastMouseEvent,
_isMouseDown;
// NOTE: missing view, detail, touches, targetTouches, scale and rotation
function _createTouchEvent(type, canBubble, cancelable, eventData) {
var touchEvent = window.document.createEvent('Event');
touchEvent.initEvent(type, canBubble, cancelable);
utils.mixin(eventData, touchEvent);
return touchEvent;
}
function _simulateTouchEvent(type, mouseevent) {
if (_lastMouseEvent &&
mouseevent.type === _lastMouseEvent.type &&
mouseevent.pageX === _lastMouseEvent.pageX &&
mouseevent.pageY === _lastMouseEvent.pageY) {
return;
}
_lastMouseEvent = mouseevent;
var touchObj = {
clientX: mouseevent.pageX,
clientY: mouseevent.pageY,
pageX: mouseevent.pageX,
pageY: mouseevent.pageY,
screenX: mouseevent.pageX,
screenY: mouseevent.pageY,
target: mouseevent.target,
identifier: ''
};
var eventData = {
altKey: mouseevent.altKey,
ctrlKey: mouseevent.ctrlKey,
shiftKey: mouseevent.shiftKey,
metaKey: mouseevent.metaKey,
changedTouches: [touchObj],
targetTouches: type === 'touchend' ? [] : [touchObj],
touches: type === 'touchend' ? [] : [touchObj]
};
utils.mixin(touchObj, eventData);
var itemFn = function (index) {
return this[index];
};
eventData.touches.item = itemFn;
eventData.changedTouches.item = itemFn;
eventData.targetTouches.item = itemFn;
var listenerName = 'on' + type,
simulatedEvent = _createTouchEvent(type, true, true, eventData);
mouseevent.target.dispatchEvent(simulatedEvent);
if (typeof mouseevent.target[listenerName] === 'function') {
mouseevent.target[listenerName].apply(mouseevent.target, [simulatedEvent]);
}
}
function init() {
window.document.addEventListener('mousedown', function (event) {
_isMouseDown = true;
_simulateTouchEvent('touchstart', event);
}, true);
window.document.addEventListener('mousemove', function (event) {
if (_isMouseDown) {
_simulateTouchEvent('touchmove', event);
}
}, true);
window.document.addEventListener('mouseup', function (event) {
_isMouseDown = false;
_simulateTouchEvent('touchend', event);
}, true);
window.Node.prototype.ontouchstart = null;
window.Node.prototype.ontouchend = null;
window.Node.prototype.ontouchmove = null;
}
module.exports.init = init;
|
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*
* @providesModule ReactTransitionGroup
*/
"use strict";
var React = require('React');
var ReactTransitionChildMapping = require('ReactTransitionChildMapping');
var cloneWithProps = require('cloneWithProps');
var emptyFunction = require('emptyFunction');
var merge = require('merge');
var ReactTransitionGroup = React.createClass({
propTypes: {
component: React.PropTypes.func,
childFactory: React.PropTypes.func
},
getDefaultProps: function() {
return {
component: React.DOM.span,
childFactory: emptyFunction.thatReturnsArgument
};
},
getInitialState: function() {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
componentWillReceiveProps: function(nextProps) {
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
nextProps.children
);
var prevChildMapping = this.state.children;
this.setState({
children: ReactTransitionChildMapping.mergeChildMappings(
prevChildMapping,
nextChildMapping
)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
if (nextChildMapping[key] && !hasPrev &&
!this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
if (prevChildMapping[key] && !hasNext &&
!this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
// If we want to someday check for reordering, we could do it here.
},
componentWillMount: function() {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
componentDidUpdate: function() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performEnter: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
component.componentWillEnter(
this._handleDoneEntering.bind(this, key)
);
} else {
this._handleDoneEntering(key);
}
},
_handleDoneEntering: function(key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
this.performLeave(key);
}
},
performLeave: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
} else {
// Note that this is somewhat dangerous b/c it calls setState()
// again, effectively mutating the component before all the work
// is done.
this._handleDoneLeaving(key);
}
},
_handleDoneLeaving: function(key) {
var component = this.refs[key];
if (component.componentDidLeave) {
component.componentDidLeave();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
var newChildren = merge(this.state.children);
delete newChildren[key];
this.setState({children: newChildren});
}
},
render: function() {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = {};
for (var key in this.state.children) {
var child = this.state.children[key];
if (child) {
// You may need to apply reactive updates to a child as it is leaving.
// The normal React way to do it won't work since the child will have
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
childrenToRender[key] = cloneWithProps(
this.props.childFactory(child),
{ref: key}
);
}
}
return this.transferPropsTo(this.props.component(null, childrenToRender));
}
});
module.exports = ReactTransitionGroup;
|
$(document).ready(function () {
form = $('#form');
$("#Grid tbody>tr").click(function () {
var id = $(this).find("[name='id']").attr('value');
$("#grid_selecteditem").val(id);
});
});
function ClearSelection(e) {
$("#grid_selecteditem").val("");
}
var options = {};
function Show(prefix) {
$("#" + prefix + "SearchPanel").show('slide');
}
function Hide(prefix) {
$("#" + prefix + "SearchPanel").hide('slide');
}
function OnComboboxMasterChange(e) {
var slave = $('#' + e.target.id + "SlaveName").val();
var params = $('#' + e.target.id + "ParameterString").val().replace("*value*", e.value);
var ddl = $('#' + slave).data('tComboBox');
if (ddl.ajax) {
start = '?';
if (ddl.backupAjax.selectUrl.indexOf('?') != -1) {
start = '&';
}
ddl.ajax.selectUrl = ddl.backupAjax.selectUrl + start + params;
ddl.reload();
}
}
function OnComboboxSlaveLoad(e) {
var ddl = $('#' + e.target.id).data('tComboBox');
if (ddl && ddl.ajax) {
ddl.backupAjax = new Object;
ddl.backupAjax.selectUrl = ddl.ajax.selectUrl;
}
}
function GetAllObjectProps(obj) {
var str = "";
for(p in obj)
{
str += p + ': ' + obj[p] + '\r\n';
}
return str;
}
function FillStandardRange(range, idfrom, idto) {
var date = new Date();
var datefrom;
if (range == "month") {
datefrom = new Date(date.getFullYear(), date.getMonth(), 1);
}
else {
if (range == "quarter") {
datefrom = new Date(date.getFullYear(), 3*(date.getMonth() / 3), 1);
}
else {
if (range == "year") {
datefrom = new Date(date.getFullYear(), 0, 1);
}
}
}
var pickerFrom = $("#" + idfrom).data("tDatePicker");
var pickerTo = $("#" + idto).data("tDatePicker");
if (pickerFrom && pickerTo) {
pickerFrom.value(datefrom);
pickerTo.value(new Date(date.getFullYear(),date.getMonth(),date.getDate())); //always to current date
}
}
function ClearSearch() {
//$("input[type='text']").val("");
$("input[class='t-input']").val("");
$("input[type='text']").val("");
}
|
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBorderCharacters = exports.createStream = exports.table = void 0;
const createStream_1 = require("./createStream");
Object.defineProperty(exports, "createStream", { enumerable: true, get: function () { return createStream_1.createStream; } });
const getBorderCharacters_1 = require("./getBorderCharacters");
Object.defineProperty(exports, "getBorderCharacters", { enumerable: true, get: function () { return getBorderCharacters_1.getBorderCharacters; } });
const table_1 = require("./table");
Object.defineProperty(exports, "table", { enumerable: true, get: function () { return table_1.table; } });
__exportStar(require("./types/api"), exports);
//# sourceMappingURL=index.js.map
|
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule testEditDistance
* @flow
* @typechecks
*
*/
/* eslint-disable no-shadow */
/**
* @internal
*
* Determines whether the edit distance between two strings is at or below the
* specified threshold distance, using the approach described by Ukkonen (1985)
* in "Algorithms for Approximate String Matching"[0] and then improved upon by
* Berghel and Roach (1996) in "An Extension of Ukkonen's Enhanced Dynamic
* Programming ASM Algorithm"[1].
*
* Given two strings of length `m` and `n` respectively, and threshold `t`,
* uses `O(t*min(m,n))` time and `O(min(t,m,n))` space.
*
* @see [0]: http://www.cs.helsinki.fi/u/ukkonen/InfCont85.PDF
* @see [1]: http://berghel.net/publications/asm/asm.pdf
*/
function testEditDistance(a: string, b: string, threshold: number): boolean {
// Ensure `b` is at least as long as `a`, swapping if necessary.
let m = a.length;
let n = b.length;
if (n < m) {
[n, m] = [m, n];
[b, a] = [a, b];
}
if (!m) {
return n <= threshold;
}
const zeroK = n;
const maxK = zeroK * 2 + 1;
const fkp = Array.from(Array(maxK), () => []);
for (let k = -zeroK; k < 0; k++) {
const p = -k - 1;
fkp[k + zeroK][p + 1] = -k - 1;
fkp[k + zeroK][p] = -Infinity;
}
fkp[zeroK][0] = -1;
for (let k = 1; k <= zeroK; k++) {
const p = k - 1;
fkp[k + zeroK][p + 1] = -1;
fkp[k + zeroK][p] = -Infinity;
}
// This loop is the alternative form suggested in the afterword of Berghel &
// Roach.
let p = n - m - 1;
do {
if (p > threshold) {
return false;
}
p++;
for (let i = Math.floor((p - (n - m)) / 2); i >= 1; i--) {
f(n - m + i, p - i);
}
for (let i = Math.floor((n - m + p) / 2); i >= 1; i--) {
f(n - m - i, p - i);
}
f(n - m, p);
} while (fkp[n - m + zeroK][p] !== m);
return true;
function f(k, p) {
let t = fkp[k + zeroK][p] + 1;
let t2 = t;
// Check for transposed characters.
if (a[t - 1] === b[k + t] && a[t] === b[k + t - 1]) {
t2 = t + 1;
}
t = Math.max(
t,
fkp[k - 1 + zeroK][p],
fkp[k + 1 + zeroK][p] + 1,
t2
);
while (a[t] === b[t + k] && t < Math.min(m, n - k)) {
t++;
}
fkp[k + zeroK][p + 1] = t;
}
}
module.exports = testEditDistance;
|
import Ember from 'ember';
import ColumnDefinition from 'ember-table/models/column-definition';
export default Ember.Controller.extend({
tableColumns: Ember.computed(function() {
var dateColumn = ColumnDefinition.create({
savedWidth: 150,
textAlign: 'text-align-left',
headerCellName: 'Date',
getCellContent: function(row) {
return row.get('date').toDateString();
}
});
var openColumn = ColumnDefinition.create({
savedWidth: 100,
headerCellName: 'Open',
getCellContent: function(row) {
return row.get('open').toFixed(2);
}
});
var highColumn = ColumnDefinition.create({
savedWidth: 100,
headerCellName: 'High',
getCellContent: function(row) {
return row.get('high').toFixed(2);
}
});
var lowColumn = ColumnDefinition.create({
savedWidth: 100,
headerCellName: 'Low',
getCellContent: function(row) {
return row.get('low').toFixed(2);
}
});
var closeColumn = ColumnDefinition.create({
savedWidth: 100,
headerCellName: 'Close',
getCellContent: function(row) {
return row.get('close').toFixed(2);
}
});
return [dateColumn, openColumn, highColumn, lowColumn, closeColumn];
}),
tableContent: Ember.computed(function() {
return _.range(100).map(function(index) {
var date = new Date();
date.setDate(date.getDate() + index);
return {
date: date,
open: Math.random() * 100 - 50,
high: Math.random() * 100 - 50,
low: Math.random() * 100 - 50,
close: Math.random() * 100 - 50,
volume: Math.random() * 1000000
};
});
})
});
|
import Model from 'flarum/Model';
import Discussion from 'flarum/models/Discussion';
import IndexPage from 'flarum/components/IndexPage';
import Tag from 'tags/models/Tag';
import TagsPage from 'tags/components/TagsPage';
import DiscussionTaggedPost from 'tags/components/DiscussionTaggedPost';
import addTagList from 'tags/addTagList';
import addTagFilter from 'tags/addTagFilter';
import addTagLabels from 'tags/addTagLabels';
import addTagControl from 'tags/addTagControl';
import addTagComposer from 'tags/addTagComposer';
app.initializers.add('tags', function(app) {
app.routes.tags = {path: '/tags', component: TagsPage.component()};
app.routes.tag = {path: '/t/:tags', component: IndexPage.component()};
app.route.tag = tag => app.route('tag', {tags: tag.slug()});
app.postComponents.discussionTagged = DiscussionTaggedPost;
app.store.models.tags = Tag;
Discussion.prototype.tags = Model.hasMany('tags');
Discussion.prototype.canTag = Model.attribute('canTag');
addTagList();
addTagFilter();
addTagLabels();
addTagControl();
addTagComposer();
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.