text
stringlengths
2
6.14k
const express = require('express'); const path = require('path'); const compression = require('compression'); const webpackDevMiddleware = require('webpack-dev-middleware'); const webpackHotMiddleware = require('webpack-hot-middleware'); const webpack = require('webpack'); // Dev middleware const addDevMiddlewares = (app, options) => { const compiler = webpack(options); const middleware = webpackDevMiddleware(compiler, { noInfo: true, publicPath: options.output.publicPath, silent: true, }); app.use(middleware); app.use(webpackHotMiddleware(compiler)); // Since webpackDevMiddleware uses memory-fs internally to store build // artifacts, we use it instead const fs = middleware.fileSystem; app.get('*', (req, res) => { const file = fs.readFileSync(path.join(compiler.outputPath, 'index.html')); res.send(file.toString()); }); }; // Production middlewares const addProdMiddlewares = (app, options) => { // compression middleware compresses your server responses which makes them // smaller (applies also to assets). You can read more about that technique // and other good practices on official Express.js docs http://mxs.is/googmy app.use(compression()); app.use(options.output.publicPath, express.static(options.output.path)); app.get('*', (req, res) => res.sendFile(path.join(options.output.path, 'index.html'))); }; /** * Front-end middleware */ module.exports = (options) => { const isProd = process.env.NODE_ENV === 'production'; const app = express(); if (isProd) { addProdMiddlewares(app, options); } else { addDevMiddlewares(app, options); } return app; };
(function( $ ) { wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.site-title a' ).text( to ); } ); } ); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); } ); } ); })( jQuery );
/* EventON Generate Google maps function */ (function($){ $.fn.evoGenmaps = function(opt){ var defaults = { delay: 0, fnt: 1, cal: '', mapSpotId: '', _action:'' }; var options = $.extend({}, defaults, opt); var geocoder; // popup lightbox generation if(options._action=='lightbox'){ var cur_window_top = parseInt($(window).scrollTop()) + 50; $('.evo_popin').css({'margin-top':cur_window_top}); $('.evo_pop_body').html(''); var event_list = this.closest('.eventon_events_list'); var content = this.siblings('.event_description').html(); var content_front = this.html(); var _content = $(content).not('.evcal_close'); // RTL if(event_list.hasClass('evortl')){ $('.evo_popin').addClass('evortl'); } $('.evo_pop_body').append('<div class="evopop_top">'+content_front+'</div>').append(_content); var this_map = $('.evo_pop_body').find('.evcal_gmaps'); var idd = this_map.attr('id'); this_map.attr({'id':idd+'_evop'}); $('.evo_popup').fadeIn(300); $('.evo_popbg').fadeIn(300); // check if gmaps should run if( this.attr('data-gmtrig')=='1' && this.attr('data-gmap_status')!='null'){ var cal = this.closest('div.ajde_evcal_calendar '); loadl_gmaps_in(this, cal, idd+'_evop'); } } // functions if(options.fnt==1){ this.each(function(){ var eventcard = $(this).attr('eventcard'); if(eventcard=='1'){ $(this).find('a.desc_trig').each(function(elm){ //$(this).siblings('.event_description').slideDown(); var obj = $(this); if(options.delay==0){ load_googlemaps_here(obj); }else{ setTimeout(load_googlemaps_here, options.delay, obj); } }); } }); } if(options.fnt==2){ if(options.delay==0){ load_googlemaps_here(this); }else{ setTimeout(load_googlemaps_here, options.delay, this); } } if(options.fnt==3){ loadl_gmaps_in(this, options.cal, ''); } // gmaps on popup if(options.fnt==4){ // check if gmaps should run if( this.attr('data-gmtrig')=='1' && this.attr('data-gmap_status')!='null'){ var cal = this.closest('div.ajde_evcal_calendar '); loadl_gmaps_in(this, cal, options.mapSpotId); } } // function to load google maps for eventcard function load_googlemaps_here(obj){ if( obj.data('gmstat')!= '1'){ obj.attr({'data-gmstat':'1'}); } var cal = obj.closest('div.ajde_evcal_calendar '); if( obj.attr('data-gmtrig')=='1' && obj.attr('data-gmap_status')!='null'){ loadl_gmaps_in(obj, cal, ''); } } // Load the google map on the object function loadl_gmaps_in(obj, cal, mapId){ var evodata = cal.find('.evo-data'); var mapformat = evodata.data('mapformat'); var ev_location = obj.find('.evcal_desc'); var location_type = ev_location.attr('data-location_type'); if(location_type=='address'){ var address = ev_location.attr('data-location_address'); var location_type = 'add'; }else{ var address = ev_location.attr('data-latlng'); var location_type = 'latlng'; } var map_canvas_id= (mapId!=='')? mapId: obj.siblings('.event_description').find('.evcal_gmaps').attr('id'); // google maps styles // @since 2.2.22 var styles = ''; if(gmapstyles != 'default'){ styles = $.parseJSON(gmapstyles); } var zoom = evodata.data('mapzoom'); var zoomlevel = (typeof zoom !== 'undefined' && zoom !== false)? parseInt(zoom):12; var scroll = evodata.data('mapscroll'); //console.log(map_canvas_id+' '+mapformat+' '+ location_type +' '+scroll +' '+ address); //obj.siblings('.event_description').find('.evcal_gmaps').html(address); initialize(map_canvas_id, address, mapformat, zoomlevel, location_type, scroll, styles); } //console.log(options); }; }(jQuery));
/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'find', 'cs', { find: 'Hledat', findOptions: 'Možnosti hledání', findWhat: 'Co hledat:', matchCase: 'Rozlišovat velikost písma', matchCyclic: 'Procházet opakovaně', matchWord: 'Pouze celá slova', notFoundMsg: 'Hledaný text nebyl nalezen.', replace: 'Nahradit', replaceAll: 'Nahradit vše', replaceSuccessMsg: '%1 nahrazení.', replaceWith: 'Čím nahradit:', title: 'Najít a nahradit' } );
//>>built define("dojox/editor/plugins/nls/zh-tw/SafePaste",({"instructions":"已停用直接貼上。請使用標準瀏覽器鍵盤或功能表貼上控制項,在這個對話框中貼上內容。當您滿意要插入的內容之後,請按貼上按鈕。若要中斷插入內容,請按取消按鈕。"}));
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the * full text of the license. */ /** * @requires OpenLayers/Layer.js */ /** * Class: OpenLayers.Layer.Markers * * Inherits from: * - <OpenLayers.Layer> */ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, { /** * APIProperty: isBaseLayer * {Boolean} Markers layer is never a base layer. */ isBaseLayer: false, /** * APIProperty: markers * {Array(<OpenLayers.Marker>)} internal marker list */ markers: null, /** * Property: drawn * {Boolean} internal state of drawing. This is a workaround for the fact * that the map does not call moveTo with a zoomChanged when the map is * first starting up. This lets us catch the case where we have *never* * drawn the layer, and draw it even if the zoom hasn't changed. */ drawn: false, /** * Constructor: OpenLayers.Layer.Markers * Create a Markers layer. * * Parameters: * name - {String} * options - {Object} Hashtable of extra options to tag onto the layer */ initialize: function(name, options) { OpenLayers.Layer.prototype.initialize.apply(this, arguments); this.markers = []; }, /** * APIMethod: destroy */ destroy: function() { this.clearMarkers(); this.markers = null; OpenLayers.Layer.prototype.destroy.apply(this, arguments); }, /** * APIMethod: setOpacity * Sets the opacity for all the markers. * * Parameter: * opacity - {Float} */ setOpacity: function(opacity) { if (opacity != this.opacity) { this.opacity = opacity; for (var i=0, len=this.markers.length; i<len; i++) { this.markers[i].setOpacity(this.opacity); } } }, /** * Method: moveTo * * Parameters: * bounds - {<OpenLayers.Bounds>} * zoomChanged - {Boolean} * dragging - {Boolean} */ moveTo:function(bounds, zoomChanged, dragging) { OpenLayers.Layer.prototype.moveTo.apply(this, arguments); if (zoomChanged || !this.drawn) { for(var i=0, len=this.markers.length; i<len; i++) { this.drawMarker(this.markers[i]); } this.drawn = true; } }, /** * APIMethod: addMarker * * Parameters: * marker - {<OpenLayers.Marker>} */ addMarker: function(marker) { this.markers.push(marker); if (this.opacity != null) { marker.setOpacity(this.opacity); } if (this.map && this.map.getExtent()) { marker.map = this.map; this.drawMarker(marker); } }, /** * APIMethod: removeMarker * * Parameters: * marker - {<OpenLayers.Marker>} */ removeMarker: function(marker) { if (this.markers && this.markers.length) { OpenLayers.Util.removeItem(this.markers, marker); marker.erase(); } }, /** * Method: clearMarkers * This method removes all markers from a layer. The markers are not * destroyed by this function, but are removed from the list of markers. */ clearMarkers: function() { if (this.markers != null) { while(this.markers.length > 0) { this.removeMarker(this.markers[0]); } } }, /** * Method: drawMarker * Calculate the pixel location for the marker, create it, and * add it to the layer's div * * Parameters: * marker - {<OpenLayers.Marker>} */ drawMarker: function(marker) { var px = this.map.getLayerPxFromLonLat(marker.lonlat); if (px == null) { marker.display(false); } else { if (!marker.isDrawn()) { var markerImg = marker.draw(px); this.div.appendChild(markerImg); } else if(marker.icon) { marker.icon.moveTo(px); } } }, /** * APIMethod: getDataExtent * Calculates the max extent which includes all of the markers. * * Returns: * {<OpenLayers.Bounds>} */ getDataExtent: function () { var maxExtent = null; if ( this.markers && (this.markers.length > 0)) { var maxExtent = new OpenLayers.Bounds(); for(var i=0, len=this.markers.length; i<len; i++) { var marker = this.markers[i]; maxExtent.extend(marker.lonlat); } } return maxExtent; }, CLASS_NAME: "OpenLayers.Layer.Markers" });
function ValidarPuntaje(id) { var aux = id.split("_"); var name=aux[0]; var fil=parseInt(aux[1]); var col=parseInt(aux[2]); var colpuntaje=col; var colpuntajereal=col+1; var puntaje=name+"_"+fil+"_"+colpuntaje; var puntajereal=name+"_"+fil+"_"+colpuntajereal; var num1=toFloat(puntaje); var num2=toFloat(puntajereal); if (num1>num2) { alert("El puntaje introducido no puede ser mayor al definido: "+$(puntajereal).value); $(puntaje).value="0.00"; } } function totalizar() { var monrec=toFloat('cobdocume_recdoc'); var dscdoc=toFloat('cobdocume_dscdoc'); var abodoc=toFloat('cobdocume_abodoc'); var mondoc=toFloat('cobdocume_mondoc'); var tototal= mondoc+monrec-dscdoc+abodoc; $('cobdocume_saldoc').value=format(tototal.toFixed(2),'.',',','.'); }
var classgr__interleave = [ [ "~gr_interleave", "classgr__interleave.html#ae342ba63322b78359ee71de113e41fc1", null ], [ "check_topology", "classgr__interleave.html#ade74f196c0fc8a91ca4f853a2d1202e1", null ], [ "work", "classgr__interleave.html#a44664518c86559da58b3feccb9e45d7f", null ], [ "gr_make_interleave", "classgr__interleave.html#acf7153a343a7bfbf2687bcc4c98d410e", null ] ];
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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. // Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>. import { observer } from 'mobx-react'; import React, { Component, PropTypes } from 'react'; import { FormattedMessage } from 'react-intl'; import shapeshiftLogo from '~/../assets/images/shapeshift-logo.png'; import { Button, IdentityIcon, Portal } from '~/ui'; import { CancelIcon, DoneIcon } from '~/ui/Icons'; import AwaitingDepositStep from './AwaitingDepositStep'; import AwaitingExchangeStep from './AwaitingExchangeStep'; import CompletedStep from './CompletedStep'; import ErrorStep from './ErrorStep'; import OptionsStep from './OptionsStep'; import Store, { STAGE_COMPLETED, STAGE_OPTIONS, STAGE_WAIT_DEPOSIT, STAGE_WAIT_EXCHANGE } from './store'; import styles from './shapeshift.css'; const STAGE_TITLES = [ <FormattedMessage id='shapeshift.title.details' defaultMessage='details' />, <FormattedMessage id='shapeshift.title.deposit' defaultMessage='awaiting deposit' />, <FormattedMessage id='shapeshift.title.exchange' defaultMessage='awaiting exchange' />, <FormattedMessage id='shapeshift.title.completed' defaultMessage='completed' /> ]; const ERROR_TITLE = ( <FormattedMessage id='shapeshift.title.error' defaultMessage='exchange failed' /> ); @observer export default class Shapeshift extends Component { static contextTypes = { store: PropTypes.object.isRequired } static propTypes = { address: PropTypes.string.isRequired, onClose: PropTypes.func } store = new Store(this.props.address); componentDidMount () { this.store.retrieveCoins(); } componentWillUnmount () { this.store.unsubscribe(); } render () { const { error, stage } = this.store; return ( <Portal activeStep={ stage } busySteps={ [ STAGE_WAIT_DEPOSIT, STAGE_WAIT_EXCHANGE ] } buttons={ this.renderDialogActions() } onClose={ this.onClose } open steps={ error ? null : STAGE_TITLES } title={ error ? ERROR_TITLE : null } > { this.renderPage() } </Portal> ); } renderDialogActions () { const { address } = this.props; const { coins, error, hasAcceptedTerms, stage } = this.store; const logo = ( <a className={ styles.shapeshift } href='http://shapeshift.io' key='logo' target='_blank' > <img src={ shapeshiftLogo } /> </a> ); const cancelBtn = ( <Button icon={ <CancelIcon /> } key='cancel' label={ <FormattedMessage id='shapeshift.button.cancel' defaultMessage='Cancel' /> } onClick={ this.onClose } /> ); if (error) { return [ logo, cancelBtn ]; } switch (stage) { case STAGE_OPTIONS: return [ logo, cancelBtn, <Button disabled={ !coins.length || !hasAcceptedTerms } icon={ <IdentityIcon address={ address } button /> } key='shift' label={ <FormattedMessage id='shapeshift.button.shift' defaultMessage='Shift Funds' /> } onClick={ this.onShift } /> ]; case STAGE_WAIT_DEPOSIT: case STAGE_WAIT_EXCHANGE: return [ logo, cancelBtn ]; case STAGE_COMPLETED: return [ logo, <Button icon={ <DoneIcon /> } key='done' label={ <FormattedMessage id='shapeshift.button.done' defaultMessage='Close' /> } onClick={ this.onClose } /> ]; } } renderPage () { const { error, stage } = this.store; if (error) { return ( <ErrorStep store={ this.store } /> ); } switch (stage) { case STAGE_OPTIONS: return ( <OptionsStep store={ this.store } /> ); case STAGE_WAIT_DEPOSIT: return ( <AwaitingDepositStep store={ this.store } /> ); case STAGE_WAIT_EXCHANGE: return ( <AwaitingExchangeStep store={ this.store } /> ); case STAGE_COMPLETED: return ( <CompletedStep store={ this.store } /> ); } } onClose = () => { this.store.setStage(STAGE_OPTIONS); this.props.onClose && this.props.onClose(); } onShift = () => { return this.store.shift(); } }
define( [ 'jquery', 'stapes', './conditionals' ], function( $, Stapes, conditionalsMediator ) { 'use strict'; /** * Global Mediator (included on every page) * @module Globals * @implements {Stapes} */ var Mediator = Stapes.subclass({ /** * Reference to conditionals mediator singleton * @type {Object} */ conditionals: conditionalsMediator, /** * Mediator Constructor * @return {void} */ constructor: function (){ var self = this; self.initEvents(); $(function(){ self.emit('domready'); }); }, /** * Initialize events * @return {void} */ initEvents: function(){ var self = this; self.on('domready', self.onDomReady); // // DEBUG // conditionalsMediator.on('all', function(val, e){ // console.log(e.type, val); // }); }, /** * DomReady Callback * @return {void} */ onDomReady: function(){ var self = this; } }); return new Mediator(); } );
import React from 'react' import { createDevTools } from 'redux-devtools' import LogMonitor from 'redux-devtools-log-monitor' import DockMonitor from 'redux-devtools-dock-monitor' export default createDevTools( <DockMonitor toggleVisibilityKey="H" changePositionKey="Q" > <LogMonitor /> </DockMonitor> )
/* * The contents of this file are subject to the OpenMRS Public License * Version 1.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://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Copyright (C) OpenMRS, LLC. All Rights Reserved. */ var ExitHandlers = { // a widget can dynamically set "do-not-exit" or "do-not-exit-once" classes on the field to indicate we should not // exit the field. "do-not-exit-once" will be cleared after a single exit attempt. 'manual-exit': { handleExit: function(fieldModel) { var doNotExit = fieldModel.element.hasClass('do-not-exit') || fieldModel.element.hasClass('do-not-exit-once'); fieldModel.element.removeClass('do-not-exit-once'); return !doNotExit; } }, 'leading-zeros': { handleExit: function(fieldModel) { var val = fieldModel.element.val(); if (val) { // if the field is blank, leave it alone var maxLength = parseInt(fieldModel.element.attr('maxlength')); if (maxLength > 0) { while (val.length < maxLength) { val = "0" + val; } fieldModel.element.val(val); } } return true; } } };
import { Model, belongsTo } from 'ember-cli-mirage'; export default Model.extend({ parent: belongsTo('alloc-file'), });
/* * Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see <http://www.gnu.org/licenses/>. * * The latest code can be found at <https://pydio.com>. * * Description : focusable component / Tab navigation */ Interface.create("IContextMenuable", { setContextualMenu : function(contextMenu){} });
// // Copyright (C) 2016 - present Instructure, Inc. // // This file is part of Canvas. // // Canvas is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the Free // Software Foundation, version 3 of the License. // // Canvas 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 Affero General Public License for more // details. // // You should have received a copy of the GNU Affero General Public License along // with this program. If not, see <http://www.gnu.org/licenses/>. import _ from 'underscore' import Depaginate from 'jsx/shared/CheatDepaginator' const listUrl = () => ENV.ENROLLMENT_TERMS_URL const deserializeTerms = termGroups => _.flatten( _.map(termGroups, group => _.map(group.enrollment_terms, (term) => { const groupID = term.grading_period_group_id const newGroupID = _.isNumber(groupID) ? groupID.toString() : groupID return { id: term.id.toString(), name: term.name, startAt: term.start_at ? new Date(term.start_at) : null, endAt: term.end_at ? new Date(term.end_at) : null, createdAt: term.created_at ? new Date(term.created_at) : null, gradingPeriodGroupId: newGroupID, } }) ) ) export default { list (terms) { return new Promise((resolve, reject) => { Depaginate(listUrl()) .then(response => resolve(deserializeTerms(response))) .fail(error => reject(error)) }) } }
"use strict"; var express = require('express'); var less = require('less-middleware'); function HttpServer(port, staticServedPath, logRequest) { this.port = port; this.staticServedPath = staticServedPath; this.logRequest = (typeof logRequest === "undefined") ? true : logRequest; } HttpServer.prototype.start = function(fn) { console.log("Starting server"); var self = this; var app = express(); self.app = app; if(self.logRequest) { app.use(function (req, res, next) { console.log(req.method, req.url); next(); }); } app.use('/', express.static(self.staticServedPath)); self.server = app.listen(self.port, function () { console.log("Server started on port", self.port); if (fn !== undefined) fn(); }); }; HttpServer.prototype.stop = function() { console.log("Stopping server"); var self = this; self.server.close(); }; module.exports = HttpServer;
/* * World Calendars * https://github.com/alexcjohnson/world-calendars * * Batch-converted from kbwood/calendars * Many thanks to Keith Wood and all of the contributors to the original project! * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /* http://keith-wood.name/calendars.html Traditional Chinese localisation for Taiwanese calendars for jQuery v2.0.2. Written by Ressol (ressol@gmail.com). */ var main = require('../main'); main.calendars.taiwan.prototype.regionalOptions['zh-TW'] = { name: 'Taiwan', epochs: ['BROC', 'ROC'], monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'], monthNamesShort: ['一','二','三','四','五','六', '七','八','九','十','十一','十二'], dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], dayNamesMin: ['日','一','二','三','四','五','六'], digits: null, dateFormat: 'yyyy/mm/dd', firstDay: 1, isRTL: false };
'use strict'; import EventMap from 'eventmap'; import Log from './log'; var audioTypes = { 'mp3': 'audio/mpeg', 'wav': 'audio/wav', 'ogg': 'audio/ogg' }; var imageTypes = { 'png': 'image/png', 'jpg': 'image/jpg', 'gif': 'image/gif' }; class AssetLoader extends EventMap { constructor(assets) { super(); this.assets = assets || {}; this.files = {}; this.maxAssets = 0; this.assetsLoaded = 0; this.percentLoaded = 0; this.cache = {}; } start() { // TODO: Something was wrong here. So it's deleted right now } } export default AssetLoader;
(function () { function remap(fromValue, fromMin, fromMax, toMin, toMax) { // Compute the range of the data var fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue; // If either range is 0, then the value can only be mapped to 1 value if (fromRange === 0) { return toMin + toRange / 2; } if (toRange === 0) { return toMin; } // (1) untranslate, (2) unscale, (3) rescale, (4) retranslate toValue = (fromValue - fromMin) / fromRange; toValue = (toRange * toValue) + toMin; return toValue; } /** * Enhance Filter. Adjusts the colors so that they span the widest * possible range (ie 0-255). Performs w*h pixel reads and w*h pixel * writes. * @function * @name Enhance * @memberof Kinetic.Filters * @param {Object} imageData * @author ippo615 * @example * node.cache(); * node.filters([Kinetic.Filters.Enhance]); * node.enhance(0.4); */ Kinetic.Filters.Enhance = function (imageData) { var data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i; // If we are not enhancing anything - don't do any computation var enhanceAmount = this.enhance(); if( enhanceAmount === 0 ){ return; } // 1st Pass - find the min and max for each channel: for (i = 0; i < nSubPixels; i += 4) { r = data[i + 0]; if (r < rMin) { rMin = r; } else if (r > rMax) { rMax = r; } g = data[i + 1]; if (g < gMin) { gMin = g; } else if (g > gMax) { gMax = g; } b = data[i + 2]; if (b < bMin) { bMin = b; } else if (b > bMax) { bMax = b; } //a = data[i + 3]; //if (a < aMin) { aMin = a; } else //if (a > aMax) { aMax = a; } } // If there is only 1 level - don't remap if( rMax === rMin ){ rMax = 255; rMin = 0; } if( gMax === gMin ){ gMax = 255; gMin = 0; } if( bMax === bMin ){ bMax = 255; bMin = 0; } var rMid, rGoalMax,rGoalMin, gMid, gGoalMax,gGoalMin, bMid, bGoalMax,bGoalMin; // If the enhancement is positive - stretch the histogram if ( enhanceAmount > 0 ){ rGoalMax = rMax + enhanceAmount*(255-rMax); rGoalMin = rMin - enhanceAmount*(rMin-0); gGoalMax = gMax + enhanceAmount*(255-gMax); gGoalMin = gMin - enhanceAmount*(gMin-0); bGoalMax = bMax + enhanceAmount*(255-bMax); bGoalMin = bMin - enhanceAmount*(bMin-0); // If the enhancement is negative - compress the histogram } else { rMid = (rMax + rMin)*0.5; rGoalMax = rMax + enhanceAmount*(rMax-rMid); rGoalMin = rMin + enhanceAmount*(rMin-rMid); gMid = (gMax + gMin)*0.5; gGoalMax = gMax + enhanceAmount*(gMax-gMid); gGoalMin = gMin + enhanceAmount*(gMin-gMid); bMid = (bMax + bMin)*0.5; bGoalMax = bMax + enhanceAmount*(bMax-bMid); bGoalMin = bMin + enhanceAmount*(bMin-bMid); } // Pass 2 - remap everything, except the alpha for (i = 0; i < nSubPixels; i += 4) { data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax); data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax); data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax); //data[i + 3] = remap(data[i + 3], aMin, aMax, aGoalMin, aGoalMax); } }; Kinetic.Factory.addGetterSetter(Kinetic.Node, 'enhance', 0, null, Kinetic.Factory.afterSetFilter); /** * get/set enhance. Use with {@link Kinetic.Filters.Enhance} filter. * @name enhance * @method * @memberof Kinetic.Node.prototype * @param {Float} amount * @returns {Float} */ })();
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: The String.prototype.charAt.length property has the attribute DontEnum es5id: 15.5.4.4_A8 description: > Checking if enumerating the String.prototype.charAt.length property fails ---*/ ////////////////////////////////////////////////////////////////////////////// //CHECK#0 if (!(String.prototype.charAt.hasOwnProperty('length'))) { $ERROR('#0: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.charAt.hasOwnProperty('length')); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // CHECK#1 if (String.prototype.charAt.propertyIsEnumerable('length')) { $ERROR('#1: String.prototype.charAt.propertyIsEnumerable(\'length\') return false. Actual: '+String.prototype.charAt.propertyIsEnumerable('length')); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // CHECK#2 var count=0; for (var p in String.prototype.charAt){ if (p==="length") count++; } if (count !== 0) { $ERROR('#2: count=0; for (p in String.prototype.charAt){if (p==="length") count++;}; count === 0. Actual: count ==='+count ); } // //////////////////////////////////////////////////////////////////////////////
// Copyright 2014 The Oppia Authors. 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 // // 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. /** * @fileoverview Minor general functional components for end-to-end testing * with protractor. */ var editor = require('./editor.js'); // Time (in ms) to wait when the system needs time for some computations. var WAIT_TIME = 4000; // Optionally accepts a waitTime integer in milliseconds. var waitForSystem = function() { var waitTime; if (arguments.length === 1) { waitTime = arguments[0]; } else { waitTime = WAIT_TIME; } browser.sleep(waitTime); }; var scrollToTop = function() { browser.executeScript('window.scrollTo(0,0);'); }; // We will report all console logs of level greater than this. var CONSOLE_LOG_THRESHOLD = 900; var CONSOLE_ERRORS_TO_IGNORE = []; var checkForConsoleErrors = function(errorsToIgnore) { var irrelevantErrors = errorsToIgnore.concat(CONSOLE_ERRORS_TO_IGNORE); browser.manage().logs().get('browser').then(function(browserLogs) { var fatalErrors = []; for (var i = 0; i < browserLogs.length; i++) { if (browserLogs[i].level.value > CONSOLE_LOG_THRESHOLD) { var errorFatal = true; for (var j = 0; j < irrelevantErrors.length; j++) { if (browserLogs[i].message.match(irrelevantErrors[j])) { errorFatal = false; } } if (errorFatal) { fatalErrors.push(browserLogs[i]); } } } expect(fatalErrors).toEqual([]); }); }; var SERVER_URL_PREFIX = 'http://localhost:9001'; var LIBRARY_URL_SUFFIX = '/library'; var EDITOR_URL_SLICE = '/create/'; var PLAYER_URL_SLICE = '/explore/'; var LOGIN_URL_SUFFIX = '/_ah/login'; var ADMIN_URL_SUFFIX = '/admin'; var MODERATOR_URL_SUFFIX = '/moderator'; var DONATION_THANK_URL_SUFFIX = '/thanks'; // Note that this only works in dev, due to the use of cache slugs in prod. var SCRIPTS_URL_SLICE = '/assets/scripts/'; var EXPLORATION_ID_LENGTH = 12; var FIRST_STATE_DEFAULT_NAME = 'Introduction'; var _getExplorationId = function(currentUrlPrefix) { return { then: function(callbackFunction) { browser.getCurrentUrl().then(function(url) { expect(url.slice(0, currentUrlPrefix.length)).toBe(currentUrlPrefix); var explorationId = url.slice( currentUrlPrefix.length, currentUrlPrefix.length + EXPLORATION_ID_LENGTH); return callbackFunction(explorationId); }); } }; }; // If we are currently in the editor, this will return a promise with the // exploration ID. var getExplorationIdFromEditor = function() { return _getExplorationId(SERVER_URL_PREFIX + EDITOR_URL_SLICE); }; // Likewise for the player var getExplorationIdFromPlayer = function() { return _getExplorationId(SERVER_URL_PREFIX + PLAYER_URL_SLICE); }; // The explorationId here should be a string, not a promise. var openEditor = function(explorationId) { browser.get(EDITOR_URL_SLICE + explorationId); browser.waitForAngular(); editor.exitTutorialIfNecessary(); }; var openPlayer = function(explorationId) { browser.get(PLAYER_URL_SLICE + explorationId); browser.waitForAngular(); }; // Takes the user from an exploration editor to its player. // NOTE: we do not use the preview button because that will open a new window. var moveToPlayer = function() { getExplorationIdFromEditor().then(openPlayer); }; // Takes the user from the exploration player to its editor. var moveToEditor = function() { getExplorationIdFromPlayer().then(openEditor); }; var expect404Error = function() { expect(element(by.css('.protractor-test-error-container')).getText()). toMatch('Error 404'); }; // Checks no untranslated values are shown in the page. var ensurePageHasNoTranslationIds = function() { // The use of the InnerHTML is hacky, but is faster than checking each // individual component that contains text. element(by.css('.oppia-base-container')).getInnerHtml().then( function(promiseValue) { // First remove all the attributes translate and variables that are // not displayed var REGEX_TRANSLATE_ATTR = new RegExp('translate="I18N_', 'g'); var REGEX_NG_VARIABLE = new RegExp('<\\[\'I18N_', 'g'); expect(promiseValue.replace(REGEX_TRANSLATE_ATTR, '') .replace(REGEX_NG_VARIABLE, '')).not.toContain('I18N'); }); }; var acceptAlert = function() { browser.wait(function() { return browser.switchTo().alert().accept().then( function() { return true; }, function() { return false; } ); }); }; exports.acceptAlert = acceptAlert; exports.waitForSystem = waitForSystem; exports.scrollToTop = scrollToTop; exports.checkForConsoleErrors = checkForConsoleErrors; exports.SERVER_URL_PREFIX = SERVER_URL_PREFIX; exports.LIBRARY_URL_SUFFIX = LIBRARY_URL_SUFFIX; exports.EDITOR_URL_SLICE = EDITOR_URL_SLICE; exports.LOGIN_URL_SUFFIX = LOGIN_URL_SUFFIX; exports.MODERATOR_URL_SUFFIX = MODERATOR_URL_SUFFIX; exports.ADMIN_URL_SUFFIX = ADMIN_URL_SUFFIX; exports.DONATION_THANK_URL_SUFFIX = DONATION_THANK_URL_SUFFIX; exports.SCRIPTS_URL_SLICE = SCRIPTS_URL_SLICE; exports.FIRST_STATE_DEFAULT_NAME = FIRST_STATE_DEFAULT_NAME; exports.getExplorationIdFromEditor = getExplorationIdFromEditor; exports.getExplorationIdFromPlayer = getExplorationIdFromPlayer; exports.openEditor = openEditor; exports.openPlayer = openPlayer; exports.moveToPlayer = moveToPlayer; exports.moveToEditor = moveToEditor; exports.expect404Error = expect404Error; exports.ensurePageHasNoTranslationIds = ensurePageHasNoTranslationIds;
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// the following disclaimer. /// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and /// the following disclaimer in the documentation and/or other materials provided with the distribution. /// * Neither the name of Microsoft nor the names of its contributors may be used to /// endorse or promote products derived from this software without specific prior written permission. /// /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR /// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS /// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE /// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT /// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS /// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, /// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF /// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ES5Harness.registerTest({ id: "15.2.3.6-3-37", path: "TestCases/chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-3-37.js", description: "Object.defineProperty - 'Attributes' is a Number object that uses Object's [[Get]] method to access the 'enumerable' property (8.10.5 step 3.a)", test: function testcase() { var obj = {}; var accessed = false; var numObj = new Number(-2); numObj.enumerable = true; Object.defineProperty(obj, "property", numObj); for (var prop in obj) { if (prop === "property") { accessed = true; } } return accessed; }, precondition: function prereq() { return fnExists(Object.defineProperty); } });
/** * @license * Copyright 2020 The FOAM Authors. All Rights Reserved. * http://www.apache.org/licenses/LICENSE-2.0 */ foam.CLASS({ package: 'foam.nanos.crunch.lite', name: 'MinMaxCapabilityRefinement', refines: 'foam.nanos.crunch.MinMaxCapability', implements: [ 'foam.nanos.crunch.lite.CapableCompatibleCapability' ], javaImports: [ 'foam.nanos.crunch.CapabilityJunctionPayload', 'foam.nanos.crunch.CrunchService', 'static foam.nanos.crunch.CapabilityJunctionStatus.*' ], methods: [ { name: 'getCapableChainedStatus', documentation: ` numberGrantedOrPending are the available CapablePayloads which are GRANTED or can eventually be turned into GRANTED from PENDING state. If MinMaxCapability.min is greater than the number of available payloads which are GRANTED or can eventually be turned into GRANTED, then it is impossible for the total amount of GRANTED payloads to be greater than the MIN, thereby fulfilling the minimum requirement. For example, let there be a min max capablity which has 10 prerequisites and a min of 2. If the user selected only 3 of those prereqs in the wizard, then the CapablePayload.status for those 3 will each be in PENDING state with approvals generated for each one. Note, there will only be these 3 CapablePayloads out of the 10 Prereqs avaliable on the Capable object since the user only selected 3. If 1 of those 3 CapablePayloads get rejected. Then there will be 2 numberGrantedOrPending which could still potentially satisfy the min requirement of 2 if those 2 CapablePayloads get set to GRANTED. If 2 of those 3 CapablePayloads get rejected. Then there will be 1 numberGrantedOrPending which would be impossible to satisfy the MinMaxCapability.min requirement of 2 even if that 1 CapablePayload is GRANTED. `, javaCode: ` CrunchService crunchService = (CrunchService) x.get("crunchService"); List<String> prereqCapIds = crunchService.getPrereqs(getId()); int numberGranted = 0; int numberPending = 0; int numberRejected = 0; for ( String capId : prereqCapIds ) { CapabilityJunctionPayload prereqPayload = (CapabilityJunctionPayload) capablePayloadDAO.find(capId); if ( prereqPayload == null ) { continue; } switch ( prereqPayload.getStatus() ) { case GRANTED: numberGranted++; continue; case PENDING: case APPROVED: numberPending++; continue; case REJECTED: numberRejected++; continue; } } int numberTotal = numberGranted + numberPending + numberRejected; int numberGrantedOrPending = numberGranted + numberPending; if ( numberTotal == 0 ){ return CapabilityJunctionStatus.ACTION_REQUIRED; } if ( getMin() > numberGrantedOrPending ){ return CapabilityJunctionStatus.REJECTED; } if ( numberGranted >= getMin() ) { return CapabilityJunctionStatus.GRANTED; } if ( numberTotal >= getMin() ) { return CapabilityJunctionStatus.PENDING; } return CapabilityJunctionStatus.ACTION_REQUIRED; ` } ] });
module('BadAriaRole'); test('No elements === no problems.', function(assert) { var config = { ruleName: 'badAriaRole', expected: axs.constants.AuditResult.NA }; assert.runRule(config); }); test('No roles === no problems.', function(assert) { // Setup fixture var fixture = document.getElementById('qunit-fixture'); for (var i = 0; i < 10; i++) fixture.appendChild(document.createElement('div')); var config = { ruleName: 'badAriaRole', expected: axs.constants.AuditResult.NA }; assert.runRule(config); }); test('Good role === no problems.', function(assert) { // Setup fixture var fixture = document.getElementById('qunit-fixture'); for (var r in axs.constants.ARIA_ROLES) { if (axs.constants.ARIA_ROLES.hasOwnProperty(r) && !axs.constants.ARIA_ROLES[r]['abstract']) { var div = document.createElement('div'); div.setAttribute('role', r); fixture.appendChild(div); } } var config = { ruleName: 'badAriaRole', expected: axs.constants.AuditResult.PASS, elements: [] }; assert.runRule(config); }); test('Bad role == problem', function(assert) { // Setup fixture var fixture = document.getElementById('qunit-fixture'); var div = document.createElement('div'); div.setAttribute('role', 'not-an-aria-role'); fixture.appendChild(div); var config = { ruleName: 'badAriaRole', expected: axs.constants.AuditResult.FAIL, elements: [div] }; assert.runRule(config); }); test('Abstract role == problem', function(assert) { // Setup fixture var fixture = document.getElementById('qunit-fixture'); var div = document.createElement('div'); div.setAttribute('role', 'input'); fixture.appendChild(div); var config = { ruleName: 'badAriaRole', expected: axs.constants.AuditResult.FAIL, elements: [div] }; assert.runRule(config); });
let connectionIdx = 0; let messageIdx = 0; function addConnection(connection) { connection.connectionId = ++connectionIdx; addMessage('New connection #' + connectionIdx); connection.addEventListener('message', function(event) { messageIdx++; const data = JSON.parse(event.data); const logString = 'Message ' + messageIdx + ' from connection #' + connection.connectionId + ': ' + data.message; addMessage(logString, data.lang); maybeSetFruit(data.message); connection.send('Received message ' + messageIdx); }); connection.addEventListener('close', function(event) { addMessage('Connection #' + connection.connectionId + ' closed, reason = ' + event.reason + ', message = ' + event.message); }); }; /* Utils */ const fruitEmoji = { 'grapes': '\u{1F347}', 'watermelon': '\u{1F349}', 'melon': '\u{1F348}', 'tangerine': '\u{1F34A}', 'lemon': '\u{1F34B}', 'banana': '\u{1F34C}', 'pineapple': '\u{1F34D}', 'green apple': '\u{1F35F}', 'apple': '\u{1F34E}', 'pear': '\u{1F350}', 'peach': '\u{1F351}', 'cherries': '\u{1F352}', 'strawberry': '\u{1F353}' }; function addMessage(content, language) { const listItem = document.createElement("li"); if (language) { listItem.lang = language; } listItem.textContent = content; document.querySelector("#message-list").appendChild(listItem); }; function maybeSetFruit(message) { const fruit = message.toLowerCase(); if (fruit in fruitEmoji) { document.querySelector('#main').textContent = fruitEmoji[fruit]; } }; document.addEventListener('DOMContentLoaded', function() { if (navigator.presentation.receiver) { navigator.presentation.receiver.connectionList.then(list => { list.connections.map(connection => addConnection(connection)); list.addEventListener('connectionavailable', function(event) { addConnection(event.connection); }); }); } });
/* * Copyright (C) 2015 Stratio (http://stratio.com) * * 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. */ (function () { 'use strict'; angular .module('webApp') .controller('DriversListCtrl', DriversListCtrl); DriversListCtrl.$inject = ['$scope', 'EntityFactory', 'ModalService', 'UtilsService', '$state']; function DriversListCtrl($scope, EntityFactory, ModalService, UtilsService, $state) { /*jshint validthis: true*/ var vm = this; vm.deleteDriver = deleteDriver; vm.getAllDrivers = getAllDrivers; vm.createDriver = createDriver; vm.sortDrivers = sortDrivers; vm.tableReverse = false; vm.sortField = 'fileName'; vm.errorMessage = { type: 'error', text: '', internalTrace: '' }; vm.successMessage = { type: 'success', text: '', internalTrace: '' }; init(); ///////////////////////////////// function init() { getAllDrivers(); } function getAllDrivers() { EntityFactory.getAllDrivers().then(function (drivers) { vm.driversData = drivers; }); } function createDriver() { var controller = 'CreateEntityModalCtrl'; var templateUrl = "templates/modal/entity-creation-modal.tpl.html"; var resolve = { type: function () { return "DRIVER"; }, title: function () { return "_ENTITY_._CREATE_DRIVER_TITLE_"; }, info: function () { return "_DRIVER_INFO_"; }, text: function () { return "_DRIVER_TEXT_"; }, }; var modalInstance = ModalService.openModal(controller, templateUrl, resolve, '', 'lg'); return modalInstance.result.then(function () { getAllDrivers(); vm.successMessage.text = '_DRIVER_CREATE_OK_'; }); } function deleteDriver(fileName) { return deleteDriverConfirm('lg', fileName); } function deleteDriverConfirm(size, fileName) { var controller = 'DeleteEntityModalCtrl'; var templateUrl = "templates/modal/entity-delete-modal.tpl.html"; var resolve = { item: function () { return fileName; }, type: function () { return "DRIVER"; }, title: function () { return "_ENTITY_._DELETE_DRIVER_TITLE_"; } }; var modalInstance = ModalService.openModal(controller, templateUrl, resolve, '', size); return modalInstance.result.then(function (fileName) { var index = UtilsService.getArrayElementPosition(vm.driversData, 'fileName', fileName); vm.driversData.splice(index, 1); vm.successMessage.text = '_DRIVER_DELETE_OK_'; }); } function sortDrivers(fieldName) { if (fieldName == vm.sortField) { vm.tableReverse = !vm.tableReverse; } else { vm.tableReverse = false; vm.sortField = fieldName; } } } })();
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ import React from 'react'; import { Link } from 'dva/router'; import Exception from '../../components/Exception'; export default () => ( <Exception type="500" style={{ minHeight: 500, height: '80%' }} linkElement={Link} /> );
import app from 'common/electron/app'; import path from 'path'; /** * @return the theme's css path */ function getThemePath (name) { return path.join(app.getAppPath(), 'themes', name + '.css'); } /** * @return the style's css path */ function getStylePath (name) { return path.join(app.getAppPath(), 'styles', name + '.css'); } /** * @return the image's path */ function getImagePath (name) { return path.join(app.getAppPath(), 'images', name); } /** * Windows only. * @return the directory where the app is ran from */ function getCustomUserDataPath () { return path.join(path.dirname(app.getPath('exe')), 'data'); } /** * Windows only. * @return the path to Update.exe created by Squirrel.Windows */ function getSquirrelUpdateExePath () { return path.join(path.dirname(app.getPath('exe')), '..', 'Update.exe'); } export default { getThemePath, getStylePath, getImagePath, getCustomUserDataPath, getSquirrelUpdateExePath };
/* * Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> * Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> * Created By: * Maintained By: */ //= require can.jquery-all //= require models/cacheable (function(ns, can) { can.Model.Cacheable("CMS.Models.Document", { root_object : "document" , root_collection : "documents" , findAll : "GET /api/documents" , create : function(params) { var _params = { document : { title : params.document.title , description : params.document.description , link : params.document.link } }; return $.ajax({ type : "POST" , "url" : "/api/documents" , dataType : "json" , data : _params }); } , search : function(request, response) { return $.ajax({ type : "get" , url : "/api/documents" , dataType : "json" , data : {s : request.term} , success : function(data) { response($.map( data, function( item ) { return can.extend({}, item.document, { label: item.document.title ? item.document.title + (item.document.link_url ? " (" + item.document.link_url + ")" : "") : item.document.link_url , value: item.document.id }); })); } }); } }, { init : function () { this._super && this._super(); // this.bind("change", function(ev, attr, how, newVal, oldVal) { // var obj; // if(obj = CMS.Models.ObjectDocument.findInCacheById(this.id) && attr !== "id") { // obj.attr(attr, newVal); // } // }); var that = this; this.each(function(value, name) { if (value === null) that.attr(name, undefined); }); } }); can.Model.Cacheable("CMS.Models.ObjectDocument", { root_object : "object_document" , root_collection : "object_documents" , findAll: "GET /api/object_documents" , create: "POST /api/object_documents" , destroy : "DELETE /api/object_documents/{id}" }, { init : function() { var _super = this._super; function reinit() { var that = this; typeof _super === "function" && _super.call(this); this.attr("document", CMS.Models.get_instance( "Document", this.document_id || (this.document && this.document.id))); this.attr("documentable", CMS.Models.get_instance( this.documentable_type || (this.documentable && this.documentable.type), this.documentable_id || (this.documentable && this.documentable.id))); /*this.attr( "document" , CMS.Models.Document.findInCacheById(this.document_id) || new CMS.Models.Document(this.document && this.document.serialize ? this.document.serialize() : this.document)); */ this.each(function(value, name) { if (value === null) that.removeAttr(name); }); } this.bind("created", can.proxy(reinit, this)); reinit.call(this); } }); })(this, can);
/** * @license * Copyright 2020 The FOAM Authors. All Rights Reserved. * http://www.apache.org/licenses/LICENSE-2.0 */ foam.CLASS({ package: 'foam.nanos.jetty', name: 'JettyThreadPoolConfig', documentation: 'model of org.eclipse.jetty.server.ThreadPool', properties: [ { name: 'minThreads', class: 'Int', value: 8 }, { name: 'maxThreads', class: 'Int', value: 200 }, { name: 'idleTimeout', class: 'Int', value: 60000 } ] });
$.ajax({ url: './data/population.json', success: function (data) { var max = -Infinity; data = data.map(function (item) { max = Math.max(item[2], max); return { geoCoord: item.slice(0, 2), value: item[2] } }); data.forEach(function (item) { item.barHeight = item.value / max * 50 + 0.1 }); myChart.setOption({ title : { text: 'Gridded Population of the World (2000)', subtext: 'Data from Socioeconomic Data and Applications Center', sublink : 'http://sedac.ciesin.columbia.edu/data/set/gpw-v3-population-density/data-download#close', x:'center', y:'top', textStyle: { color: 'white' } }, tooltip: { formatter: '{b}' }, dataRange: { min: 0, max: max, text:['High','Low'], realtime: false, calculable : true, color: ['red','yellow','lightskyblue'] }, series: [{ type: 'map3d', mapType: 'world', baseLayer: { backgroundColor: 'rgba(0, 150, 200, 0.5)' }, data: [{}], itemStyle: { normal: { areaStyle: { color: 'rgba(0, 150, 200, 0.8)' }, borderColor: '#777' } }, markBar: { barSize: 0.6, data: data }, autoRotate: true, }] }); } });
/** * window.c.ProjectSuggestedContributions component * A Project-show page helper to show suggested amounts of contributions * * Example of use: * view: () => { * ... * m.component(c.ProjectSuggestedContributions, {project: project}) * ... * } */ import m from 'mithril'; import _ from 'underscore'; const projectSuggestedContributions = { view(ctrl, args) { const project = args.project(); const suggestionUrl = amount => `/projects/${project.project_id}/contributions/new?amount=${amount}`, suggestedValues = [10, 25, 50, 100]; return m('#suggestions', _.map(suggestedValues, amount => project ? m(`a[href="${suggestionUrl(amount)}"].card-reward.card-big.card-secondary.u-marginbottom-20`, [ m('.fontsize-larger', `R$ ${amount}`) ]) : '')); } }; export default projectSuggestedContributions;
import { get } from '../get' export function getSearchData(page, cityName, category, keyword) { const keywordStr = keyword ? '/' + keyword : '' const result = get('/api/search/' + page + '/' + cityName + '/' + category + keywordStr) return result }
// Copyright 2011 Splunk, 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. (function() { var Http = require('../../http'); var utils = require('../../utils'); var root = exports || this; var getHeaders = function(headersString) { var headers = {}; var headerLines = headersString.split("\n"); for(var i = 0; i < headerLines.length; i++) { if (utils.trim(headerLines[i]) !== "") { var headerParts = headerLines[i].split(": "); headers[headerParts[0]] = headerParts[1]; } } return headers; }; root.JQueryHttp = Http.extend({ init: function(isSplunk) { this._super(isSplunk); }, makeRequest: function(url, message, callback) { var that = this; var params = { url: url, type: message.method, headers: message.headers, data: message.body || "", timeout: message.timeout || 0, dataType: "json", success: utils.bind(this, function(data, error, res) { var response = { statusCode: res.status, headers: getHeaders(res.getAllResponseHeaders()) }; var complete_response = this._buildResponse(error, response, data); callback(complete_response); }), error: function(res, data, error) { var response = { statusCode: res.status, headers: getHeaders(res.getAllResponseHeaders()) }; if (data === "abort") { response.statusCode = "abort"; res.responseText = "{}"; } var json = JSON.parse(res.responseText); var complete_response = that._buildResponse(error, response, json); callback(complete_response); } }; return $.ajax(params); }, parseJson: function(json) { // JQuery does this for us return json; } }); })();
var fs = require('fs'); var PNG = require('../lib/png').PNG; var test = require('tape'); var noLargeOption = process.argv.indexOf("nolarge") >= 0; fs.readdir(__dirname + '/in/', function (err, files) { if (err) throw err; files = files.filter(function (file) { return (!noLargeOption || !file.match(/large/i)) && Boolean(file.match(/\.png$/i)); }); console.log("Converting images"); files.forEach(function (file) { var expectedError = false; if (file.match(/^x/)) { expectedError = true; } test('convert sync - ' + file, function (t) { t.timeoutAfter(1000 * 60 * 5); var data = fs.readFileSync(__dirname + '/in/' + file); try { var png = PNG.sync.read(data); } catch (e) { if (!expectedError) { t.fail('Unexpected error parsing..' + file + '\n' + e.message + "\n" + e.stack); } else { t.pass("completed"); } return t.end(); } if (expectedError) { t.fail("Sync: Error expected, parsed fine .. - " + file); return t.end(); } var outpng = new PNG(); outpng.gamma = png.gamma; outpng.data = png.data; outpng.width = png.width; outpng.height = png.height; outpng.pack() .pipe(fs.createWriteStream(__dirname + '/outsync/' + file) .on("finish", function () { t.pass("completed"); t.end(); })); }); test('convert async - ' + file, function (t) { t.timeoutAfter(1000 * 60 * 5); fs.createReadStream(__dirname + '/in/' + file) .pipe(new PNG()) .on('error', function (err) { if (!expectedError) { t.fail("Async: Unexpected error parsing.." + file + '\n' + err.message + '\n' + err.stack); } else { t.pass("completed"); } t.end(); }) .on('parsed', function () { if (expectedError) { t.fail("Async: Error expected, parsed fine .." + file); return t.end(); } this.pack() .pipe( fs.createWriteStream(__dirname + '/out/' + file) .on("finish", function () { t.pass("completed"); t.end(); })); }); }); }); });
var assert = require('assert'); var Q = require('q'); var R = require('..'); describe('pipeP', function() { function a(x) {return x + 'A';} function b(x) {return x + 'B';} it('handles promises', function() { var plusOne = function(a) {return a + 1;}; var multAsync = function(a, b) {return Q.when(a * b);}; return R.pipeP(multAsync, plusOne)(2, 3) .then(function(result) { assert.strictEqual(result, 7); }); }); it('returns a function with arity == leftmost argument', function() { function a2(x, y) { void y; return 'A2'; } function a3(x, y) { void y; return Q.when('A2'); } function a4(x, y) { void y; return 'A2'; } var f1 = R.pipeP(a, b); assert.strictEqual(f1.length, a.length); var f2 = R.pipeP(a2, b); assert.strictEqual(f2.length, a2.length); var f3 = R.pipeP(a3, b); assert.strictEqual(f3.length, a3.length); var f4 = R.pipeP(a4, b); assert.strictEqual(f4.length, a4.length); }); });
var _ = require('underscore'); /* A rule should contain explain and rule methods */ // TODO explain explain // TODO explain missing // TODO explain assert function assert (options, password) { return !!password && options.minLength <= password.length; } function explain(options) { if (options.minLength === 1) { return { message: 'Non-empty password required', code: 'nonEmpty' }; } return { message: 'At least %d characters in length', format: [options.minLength], code: 'lengthAtLeast' }; } module.exports = { validate: function (options) { if (!_.isObject(options)) { throw new Error('options should be an object'); } if (!_.isNumber(options.minLength) || _.isNaN(options.minLength)) { throw new Error('length expects minLength to be a non-zero number'); } return true; }, explain: explain, missing: function (options, password) { var explained = explain(options); explained.verified = !!assert(options, password); return explained; }, assert: assert };
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var gTestfile = 'regress-463259.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 463259; var summary = 'Do not assert: VALUE_IS_FUNCTION(cx, fval)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { (function(){ eval("(function(){ for (var j=0;j<4;++j) if (j==3) undefined(); })();"); })(); } catch(ex) { } jit(false); reportCompare(expect, actual, summary);
import { rectangle } from 'leaflet'; import boundsType from './types/bounds'; import Path from './Path'; export default class Rectangle extends Path { static propTypes = { bounds: boundsType.isRequired, }; componentWillMount() { super.componentWillMount(); const { bounds, map, ...props } = this.props; this.leafletElement = rectangle(bounds, props); } componentDidUpdate(prevProps) { if (this.props.bounds !== prevProps.bounds) { this.leafletElement.setBounds(this.props.bounds); } this.setStyleIfChanged(prevProps, this.props); } }
/* YUI 3.8.0pr2 (build 154) Copyright 2012 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add("dd-drop-plugin",function(e,t){var n=function(e){e.node=e.host,n.superclass.constructor.apply(this,arguments)};n.NAME="dd-drop-plugin",n.NS="drop",e.extend(n,e.DD.Drop),e.namespace("Plugin"),e.Plugin.Drop=n},"3.8.0pr2",{requires:["dd-drop"]});
declare module 'fast-memoize' { declare type Cache<K, V> = { get: (key: K) => V, set: (key: K, value: V) => void, has: (key: K) => boolean } declare type Options = { cache?: Cache<*, *>; serializer?: (...args: any[]) => any; strategy?: <T>(fn: T, options?: Options) => T; } declare module.exports: <T>(fn: T, options?: Options) => T; }
angular.module('ualib.imageCarousel', ['angular-carousel']) .constant('VIEW_IMAGES_URL', '//wwwdev2.lib.ua.edu/erCarousel/api/slides/active') .factory('imageCarouselFactory', ['$http', 'VIEW_IMAGES_URL', function imageCarouselFactory($http, url){ return { getData: function(){ return $http({method: 'GET', url: url, params: {}}); } }; }]) .controller('imageCarouselCtrl', ['$scope', '$q', 'imageCarouselFactory', function imageCarouselCtrl($scope, $q, imageCarouselFactory){ $scope.slides = null; function loadImages(slides, i, len, deferred){ i = i ? i : 0; len = len ? len : slides.length; deferred = deferred ? deferred : $q.defer(); if (len < 1){ deferred.resolve(slides); } else{ var image = new Image(); image.onload = function(){ slides[i].styles = 'url('+this.src+')'; slides[i].image = this; if (i+1 === len){ deferred.resolve(slides); } else { i++; loadImages(slides, i, len, deferred); } }; image.src = slides[i].image; } return deferred.promise; } imageCarouselFactory.getData() .success(function(data) { loadImages(data.slides).then(function(slides){ $scope.slides = slides; }); }) .error(function(data, status, headers, config) { console.log(data); }); }]) .directive('ualibImageCarousel', [ function() { return { restrict: 'AC', controller: 'imageCarouselCtrl', link: function(scope, elm, attrs, Ctrl){ var toggleLock = false; scope.isLocked = false; scope.pause = function(){ toggleLock = true; scope.isLocked = true; }; scope.play = function(){ toggleLock = false; scope.isLocked = false; }; scope.mouseToggle = function(){ if (!toggleLock){ scope.isLocked = !scope.isLocked; } }; } }; }]);
// Help functions /* * Return a string with all helper functions whose name contains the 'substring'; * if the 'searchDescription' is true, then also search the function description"); */ function getHelp(substring, searchDescription) { return framework.getJavaScriptHelp(".*(?i:" + substring + ").*", searchDescription); } framework.addJavaScriptHelp("help", "substring, fileName", "output all the helper functions whose name contains the given 'substring'"); function help(substring, fileName) { if (arguments.length > 1) { write(getHelp(substring, false), fileName); } else if (arguments.length > 0) { write(getHelp(substring, false)); } else { write(getHelp("", false)); } } framework.addJavaScriptHelp("apropos", "substring, fileName", "output all the helper functions whose name or description contains the given 'substring'"); function apropos(substring, fileName) { if (arguments.length > 1) { write(getHelp(substring, true), fileName); } else if (arguments.length > 0) { write(getHelp(substring, true)); } else { write(getHelp("", true)); } } framework.addJavaScriptHelp("helpRegex", "regex, fileName", "output all helper functions whose name matches 'regex'"); function helpRegex(regex, fileName) { if (arguments.length > 1) { write(framework.getJavaScriptHelp(regex, false), fileName); } else if (arguments.length > 0) { write(framework.getJavaScriptHelp(regex, false)); } }
FullCalendar.globalLocales.push(function () { 'use strict'; var it = { code: 'it', week: { dow: 1, // Monday is the first day of the week. doy: 4, // The week that contains Jan 4th is the first week of the year. }, buttonText: { prev: 'Prec', next: 'Succ', today: 'Oggi', month: 'Mese', week: 'Settimana', day: 'Giorno', list: 'Agenda', }, weekText: 'Sm', allDayText: 'Tutto il giorno', moreLinkText(n) { return '+altri ' + n }, noEventsText: 'Non ci sono eventi da visualizzare', }; return it; }());
/* @flow */ /*eslint-disable no-undef, no-unused-vars, no-console*/ import _, { compose, pipe, curry, filter, find, isNil, repeat, replace, zipWith } from "ramda"; import { describe, it } from 'flow-typed-test'; const ns: Array<number> = [1, 2, 3, 4, 5]; const ss: Array<string> = ["one", "two", "three", "four"]; const obj: { [k: string]: number } = { a: 1, c: 2 }; const objMixed: { [k: string]: mixed } = { a: 1, c: "d" }; const os: Array<{ [k: string]: * }> = [{ a: 1, c: "d" }, { b: 2 }]; const str: string = "hello world"; // Math { const partDiv: (a: number) => number = _.divide(6); const div: number = _.divide(6, 2); //$FlowExpectedError const div2: number = _.divide(6, true); } // String { const ss: Array<string | void> = _.match(/h/, "b"); describe('replace', () => { it('should supports replace by string', () => { const r1: string = replace(",", "|", "b,d,d"); const r2: string = replace(",")("|", "b,d,d"); const r3: string = replace(",")("|")("b,d,d"); const r4: string = replace(",", "|")("b,d,d"); }); it('should supports replace by RegExp', () => { const r1: string = replace(/[,]/, "|", "b,d,d"); const r2: string = replace(/[,]/)("|", "b,d,d"); const r3: string = replace(/[,]/)("|")("b,d,d"); const r4: string = replace(/[,]/, "|")("b,d,d"); }); it('should supports replace by RegExp with replacement fn', () => { const fn = (match: string, g1: string): string => g1; const r1: string = replace(/([,])d/, fn, "b,d,d"); const r2: string = replace(/([,])d/)(fn, "b,d,d"); const r3: string = replace(/([,])d/)(fn)("b,d,d"); const r4: string = replace(/([,])d/, fn)("b,d,d"); }); }); const ss2: Array<string> = _.split(",", "b,d,d"); const ss1: boolean = _.test(/h/, "b"); const s: string = _.trim("s"); const x: string = _.head("one"); const sss: string = _.concat("H", "E"); const sss1: string = _.concat("H")("E"); const ssss: string = _.drop(1, "EF"); const ssss1: string = _.drop(1)("E"); const ssss2: string = _.dropLast(1, "EF"); const ys: string = _.nth(2, "curry"); const ys1: string = _.nth(2)("curry"); } //Type { const x: boolean = _.is(Number, 1); const x1: boolean = isNil(1); // should refine type const x1a: ?{ a: number } = { a: 1 }; //$FlowExpectedError x1a.a; if (!isNil(x1a)) { x1a.a; } const x2: boolean = _.propIs(1, "num", { num: 1 }); }
'use strict'; exports.up = function (knex) { return knex.schema.createTable('migration_test_trx_1', function (t) { t.increments(); t.string('name'); }); }; exports.down = function (knex) { return knex.schema.dropTable('migration_test_trx_1'); };
/** * @author mrdoob / http://mrdoob.com/ * @author bhouston / http://exocortex.com/ */ ( function ( THREE ) { THREE.Raycaster = function ( origin, direction, near, far ) { this.ray = new THREE.Ray( origin, direction ); // normalized ray.direction required for accurate distance calculations if( this.ray.direction.lengthSq() > 0 ) { this.ray.direction.normalize(); } this.near = near || 0; this.far = far || Infinity; }; var sphere = new THREE.Sphere(); var localRay = new THREE.Ray(); var facePlane = new THREE.Plane(); var intersectPoint = new THREE.Vector3(); var matrixPosition = new THREE.Vector3(); var inverseMatrix = new THREE.Matrix4(); var descSort = function ( a, b ) { return a.distance - b.distance; }; var intersectObject = function ( object, raycaster, intersects ) { if ( object instanceof THREE.Particle ) { matrixPosition.getPositionFromMatrix( object.matrixWorld ); var distance = raycaster.ray.distanceToPoint( matrixPosition ); if ( distance > object.scale.x ) { return intersects; } intersects.push( { distance: distance, point: object.position, face: null, object: object } ); } else if ( object instanceof THREE.Mesh ) { // Checking boundingSphere distance to ray matrixPosition.getPositionFromMatrix( object.matrixWorld ); sphere.set( matrixPosition, object.geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() ); if ( ! raycaster.ray.isIntersectionSphere( sphere ) ) { return intersects; } // Checking faces var geometry = object.geometry; var vertices = geometry.vertices; var isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; var objectMaterials = isFaceMaterial === true ? object.material.materials : null; var side = object.material.side; var a, b, c, d; var precision = raycaster.precision; object.matrixRotationWorld.extractRotation( object.matrixWorld ); inverseMatrix.getInverse( object.matrixWorld ); localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { var face = geometry.faces[ f ]; var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material; if ( material === undefined ) continue; facePlane.setFromNormalAndCoplanarPoint( face.normal, vertices[face.a] ); var planeDistance = localRay.distanceToPlane( facePlane ); // bail if raycaster and plane are parallel if ( Math.abs( planeDistance ) < precision ) continue; // if negative distance, then plane is behind raycaster if ( planeDistance < 0 ) continue; // check if we hit the wrong side of a single sided face side = material.side; if( side !== THREE.DoubleSide ) { var planeSign = localRay.direction.dot( facePlane.normal ); if( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue; } // this can be done using the planeDistance from localRay because localRay wasn't normalized, but ray was if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) continue; intersectPoint = localRay.at( planeDistance, intersectPoint ); // passing in intersectPoint avoids a copy if ( face instanceof THREE.Face3 ) { a = vertices[ face.a ]; b = vertices[ face.b ]; c = vertices[ face.c ]; if ( ! THREE.Triangle.containsPoint( intersectPoint, a, b, c ) ) continue; } else if ( face instanceof THREE.Face4 ) { a = vertices[ face.a ]; b = vertices[ face.b ]; c = vertices[ face.c ]; d = vertices[ face.d ]; if ( ( ! THREE.Triangle.containsPoint( intersectPoint, a, b, d ) ) && ( ! THREE.Triangle.containsPoint( intersectPoint, b, c, d ) ) ) continue; } else { // This is added because if we call out of this if/else group when none of the cases // match it will add a point to the intersection list erroneously. throw Error( "face type not supported" ); } intersects.push( { distance: planeDistance, // this works because the original ray was normalized, and the transformed localRay wasn't point: raycaster.ray.at( planeDistance ), face: face, faceIndex: f, object: object } ); } } }; var intersectDescendants = function ( object, raycaster, intersects ) { var descendants = object.getDescendants(); for ( var i = 0, l = descendants.length; i < l; i ++ ) { intersectObject( descendants[ i ], raycaster, intersects ); } }; // THREE.Raycaster.prototype.precision = 0.0001; THREE.Raycaster.prototype.set = function ( origin, direction ) { this.ray.set( origin, direction ); // normalized ray.direction required for accurate distance calculations if( this.ray.direction.length() > 0 ) { this.ray.direction.normalize(); } }; THREE.Raycaster.prototype.intersectObject = function ( object, recursive ) { var intersects = []; if ( recursive === true ) { intersectDescendants( object, this, intersects ); } intersectObject( object, this, intersects ); intersects.sort( descSort ); return intersects; }; THREE.Raycaster.prototype.intersectObjects = function ( objects, recursive ) { var intersects = []; for ( var i = 0, l = objects.length; i < l; i ++ ) { intersectObject( objects[ i ], this, intersects ); if ( recursive === true ) { intersectDescendants( objects[ i ], this, intersects ); } } intersects.sort( descSort ); return intersects; }; }( THREE ) );
'use strict'; require('../../modules/es.weak-set'); require('../../modules/esnext.weak-set.from'); var WeakSet = require('../../internals/path').WeakSet; var weakSetfrom = WeakSet.from; module.exports = function from(source, mapFn, thisArg) { return weakSetfrom.call(typeof this === 'function' ? this : WeakSet, source, mapFn, thisArg); };
'use strict'; angular.module('sw.plugin.split', ['sw.plugins']) .factory('split', function ($q) { return { execute: execute }; function execute (url, swagger) { var deferred = $q.defer(); if (swagger && swagger.swagger && !swagger.tags) { var tags = {}; angular.forEach(swagger.paths, function (path, key) { var t = key.replace(/^\/?([^\/]+).*$/g, '$1'); tags[t] = true; angular.forEach(path, function (method) { if (!method.tags || !method.tags.length) { method.tags = [t]; } }); }); swagger.tags = []; Object.keys(tags).forEach(function (tag) { swagger.tags.push({name: tag}); }); } deferred.resolve(true); return deferred.promise; } }) .run(function (plugins, split) { plugins.add(plugins.BEFORE_PARSE, split); });
/** * @license Highcharts Gantt JS v7.2.0 (2019-09-03) * * CurrentDateIndicator * * (c) 2010-2019 Lars A. V. Cabrera * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.exports = factory; } else if (typeof define === 'function' && define.amd) { define('highcharts/modules/current-date-indicator', ['highcharts'], function (Highcharts) { factory(Highcharts); factory.Highcharts = Highcharts; return factory; }); } else { factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined); } }(function (Highcharts) { var _modules = Highcharts ? Highcharts._modules : {}; function _registerModule(obj, path, args, fn) { if (!obj.hasOwnProperty(path)) { obj[path] = fn.apply(null, args); } } _registerModule(_modules, 'parts-gantt/CurrentDateIndicator.js', [_modules['parts/Globals.js']], function (H) { /* * * * (c) 2016-2019 Highsoft AS * * Author: Lars A. V. Cabrera * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var addEvent = H.addEvent, Axis = H.Axis, PlotLineOrBand = H.PlotLineOrBand, merge = H.merge, wrap = H.wrap; var defaultConfig = { /** * Show an indicator on the axis for the current date and time. Can be a * boolean or a configuration object similar to * [xAxis.plotLines](#xAxis.plotLines). * * @sample gantt/current-date-indicator/demo * Current date indicator enabled * @sample gantt/current-date-indicator/object-config * Current date indicator with custom options * * @type {boolean|*} * @default true * @extends xAxis.plotLines * @excluding value * @product gantt * @apioption xAxis.currentDateIndicator */ currentDateIndicator: true, color: '#ccd6eb', width: 2, label: { /** * Format of the label. This options is passed as the fist argument to * [dateFormat](/class-reference/Highcharts#dateFormat) function. * * @type {string} * @default '%a, %b %d %Y, %H:%M' * @product gantt * @apioption xAxis.currentDateIndicator.label.format */ format: '%a, %b %d %Y, %H:%M', formatter: function (value, format) { return H.dateFormat(format, value); }, rotation: 0, style: { fontSize: '10px' } } }; /* eslint-disable no-invalid-this */ addEvent(Axis, 'afterSetOptions', function () { var options = this.options, cdiOptions = options.currentDateIndicator; if (cdiOptions) { cdiOptions = typeof cdiOptions === 'object' ? merge(defaultConfig, cdiOptions) : merge(defaultConfig); cdiOptions.value = new Date(); if (!options.plotLines) { options.plotLines = []; } options.plotLines.push(cdiOptions); } }); addEvent(PlotLineOrBand, 'render', function () { // If the label already exists, update its text if (this.label) { this.label.attr({ text: this.getLabelText(this.options.label) }); } }); wrap(PlotLineOrBand.prototype, 'getLabelText', function (defaultMethod, defaultLabelOptions) { var options = this.options; if (options.currentDateIndicator && options.label && typeof options.label.formatter === 'function') { options.value = new Date(); return options.label.formatter .call(this, options.value, options.label.format); } return defaultMethod.call(this, defaultLabelOptions); }); }); _registerModule(_modules, 'masters/modules/current-date-indicator.src.js', [], function () { }); }));
var dep = require('./dep'); dep('');
/** * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'magicline', 'it', { title: 'Inserisci paragrafo qui' } );
import React from "react"; import PropTypes from "prop-types"; import Box from "grommet/components/Box"; import Paragraph from "grommet/components/Paragraph"; import Label from "grommet/components/Label"; import FormLayer from "../components/FormLayer"; class LayerObjectFieldTemplate extends React.Component { constructor(props) { super(props); this.state = { layerActive: false }; } _onClick() { this.setState({ layerActive: true }); } render() { if (this.props.idSchema["$id"] == "root") { return <Box>{this.props.properties.map(prop => prop.content)}</Box>; } else { return ( <Box className="grommetux-form-field" direction="row" wrap={false}> { <FormLayer layerActive={this.state.layerActive} onClose={(() => { this.setState({ layerActive: false }); }).bind(this)} properties={this.props.properties.map(prop => prop.content)} /> } <Box flex={true}> <Box align="center"> <Label size="small" strong="none" uppercase={true}> {this.props.title} </Label> </Box> {this.props.description ? ( <Paragraph size="small">{this.props.description}</Paragraph> ) : null} </Box> </Box> ); } } } LayerObjectFieldTemplate.propTypes = { title: PropTypes.string, description: PropTypes.string, required: PropTypes.bool, idSchema: PropTypes.object, uiSchema: PropTypes.object, properties: PropTypes.object }; export default LayerObjectFieldTemplate;
var UserInformation_AccountStore = new Ext.data.Store({ fields:[ {name : 'Name'}, {name : 'ID'}, {name : 'Mail'}, {name : 'Roles'} ], reader : AccountReader }); var UserInformationItem = [ { fieldLabel : 'User ID', name : 'id', readOnly : true }, { fieldLabel : 'User Name', name : 'username', allowBlank : false, regex : /^[^"'\\><&]*$/, regexText : 'deny following char " < > \\ & \'' }, { id : 'UserInformation_Form_Password', fieldLabel : 'Password', name : 'passwd', inputType : 'password', listeners : { 'change': function() { if (this.getValue() == "") { Ext.getCmp('UserInformationManagement_Page').getTopToolbar().get('UserInformation_UpdateAccountBtn').setDisabled(false); Ext.getCmp("UserInformation_Form_reenter").allowBlank = true; } else { Ext.getCmp('UserInformationManagement_Page').getTopToolbar().get('UserInformation_UpdateAccountBtn').setDisabled(true); Ext.getCmp("UserInformation_Form_reenter").allowBlank = false; } } } }, { id : 'UserInformation_Form_reenter', fieldLabel : 'Re-enter', initialPassField : 'passwd', name : 'reenter', inputType : 'password', initialPassField: 'UserInformation_Form_Password', vtype : 'pwdvalid', listeners : { 'change': function() { if (Ext.getCmp("UserInformation_Form_Password").getValue() == "") { Ext.getCmp('UserInformationManagement_Page').getTopToolbar().get('UserInformation_UpdateAccountBtn').setDisabled(true); this.allowBlank = true; } else { Ext.getCmp('UserInformationManagement_Page').getTopToolbar().get('UserInformation_UpdateAccountBtn').setDisabled(false); this.allowBlank = false; } } } }, { fieldLabel : 'E-mail Address', name : 'email', vtype : 'email', allowBlank : false } ]; // the form is for UserInformation Page ezScrum.UserInformationForm = Ext.extend(ezScrum.layout.InfoForm, { id : 'UserInformation_Management_From', url : 'getUserData.do', modifyurl : 'updateAccount.do' , store : UserInformation_AccountStore, width:500, bodyStyle:'padding:50px', monitorValid : true, buttonAlign:'center', initComponent : function() { var config = { items : [UserInformationItem], buttons : [{ formBind : true, text : 'Submit', scope : this, handler : this.submit, disabled : true }] } Ext.apply(this, Ext.apply(this.initialConfig, config)); ezScrum.UserInformationForm.superclass.initComponent.apply(this, arguments); }, submit : function() { Ext.getCmp('UserInformationManagement_Page').doModify(); }, loadDataModel: function() { UserManagementMainLoadMaskShow(); Ext.Ajax.request({ scope : this, url : this.url, success: function(response) { UserInformation_AccountStore.loadData(response.responseXML); var record = UserInformation_AccountStore.getAt(0); this.setDataModel(record); UserManagementMainLoadMaskHide(); }, failure: function(response) { UserManagementMainLoadMaskHide(); Ext.example.msg('Server Error', 'Sorry, the connection is failure.'); } }); }, setDataModel: function(record) { this.getForm().reset(); this.getForm().setValues({ id : record.data['ID'], username: record.data['Name'], passwd : '', reenter : '', email : record.data['Mail'] }); }, doModify: function() { UserManagementMainLoadMaskShow(); Ext.Ajax.request({ scope : this, url : this.modifyurl, params : this.getForm().getValues(), success : function(response) { UserInformation_AccountStore.loadData(response.responseXML); var record = UserInformation_AccountStore.getAt(0); if (record) { Ext.example.msg('Update Account', 'Update Account Success'); } else { Ext.example.msg('Update Account', 'Update Account Failure'); } UserManagementMainLoadMaskHide(); }, failure:function(response){ UserManagementMainLoadMaskHide(); Ext.example.msg('Server Error', 'Sorry, the connection is failure.'); } }); } }); Ext.reg('UserInformationForm', ezScrum.UserInformationForm);
(function ($) { providers_small.mailru = { name: 'mail.ru', url: "javascript: $('#mail_ru_auth_login a').click();" }; openid.getBoxHTML__mailru = openid.getBoxHTML; openid.getBoxHTML = function (box_id, provider, box_size, index) { if (box_id == 'mailru') { var no_sprite = this.no_sprite; this.no_sprite = true; var result = this.getBoxHTML__mailru(box_id, provider, box_size, index); this.no_sprite = no_sprite; return result; } return this.getBoxHTML__mailru(box_id, provider, box_size, index); } Drupal.behaviors.openid_selector_mailru = { attach: function (context) { $('#mail_ru_auth_login').hide(); }} })(jQuery);
/* Class: Graphic.Ellipse Shape implementation of an ellipse. Author: Sébastien Gruhier, <http://www.xilinus.com> License: MIT-style license. See Also: <Shape> */ Graphic.Ellipse = Class.create(); Object.extend(Graphic.Ellipse.prototype, Graphic.Shape.prototype); // Keep parent initialize Graphic.Ellipse.prototype._shapeInitialize = Graphic.Shape.prototype.initialize; Object.extend(Graphic.Ellipse.prototype, { initialize: function(renderer) { this._shapeInitialize(renderer, "ellipse"); Object.extend(this.attributes, {cx: 0, cy: 0, rx: 0, ry: 0}) return this; }, getSize: function() { return {w: 2 * this.attributes.rx, h: 2 * this.attributes.ry} }, setSize: function(width, height) { var location = this.getLocation(); this._setAttributes({rx: width/2, ry: height/2}); this.setLocation(location.x, location.y); return this; }, getLocation: function() { return {x: this.attributes.cx - this.attributes.rx, y: this.attributes.cy - this.attributes.ry} }, setLocation: function(x, y) { this._setAttributes({cx: x + this.attributes.rx, cy: y + this.attributes.ry}); return this; } })
define(["ng", "lodash"], function(ng, _){ "use strict"; var DashboardVM = function DashboardVM($scope, $rootScope){ var _self = this; this.toggleHStretch = function(isOn){ _self.setOptions(options); }; this.updateOptions = function(options){ ng.extend(_self, options); }; this.resetOptions = function(){ _self.updateOptions(_self.attr); }; this.setAttr = function(attr){ _self.attr=attr; _self.updateOptions(attr); }; this.remove = function(target){ // _.remove(_self.items, {name: target}); delete _self.items[target]; console.debug("remove _self.items", _self.items); }; this.items = $scope.dashboardItems; // this.items = [ // { // name: "survival1", // title: "survival1", // content: "moving around" // }, // { // name: "hcl1", // title: "hcl1", // content: "moving around" // }, // { // name: "ttest1", // title: "ttest1", // content: "moving around" // }, // { // name: "limma1", // title: "limma1", // content: "moving around" // }, // { // name: "deseq1", // title: "deseq1", // content: "moving around" // }, // { // name: "nmf", // title: "nmf", // content: "moving around" // }, // { // name: "kmeans1", // title: "kmeans1", // content: "moving around" // } // ]; $scope.$on("ui:dashboard:addItem", function($event, data){ var exists = _.find(_self.items, {name: data.name}); if(exists){ $rootScope.$broadcast("ui:analysisLog.append", "info", "Cannot add analysis '" + data.name + "' to the dashboard. It is already there."); }else{ _self.items.$add(data); } }); $scope.$on("ui:dashboard:removeItem", function($event, data){ console.debug("on ui:dashboard:removeItem", $event, data); _self.remove(data.name); }); }; DashboardVM.$inject=["$scope", "$rootScope"]; DashboardVM.$name="DashboardVMController"; return DashboardVM; });
modules.define( 'spec', ['button', 'i-bem__dom', 'chai', 'jquery', 'BEMHTML'], function(provide, Button, BEMDOM, chai, $, BEMHTML) { var expect = chai.expect; describe('button_type_link', function() { var button; beforeEach(function() { button = buildButton({ block : 'button', mods : { type : 'link' }, url : '/' }); }); afterEach(function() { BEMDOM.destruct(button.domElem); }); describe('url', function() { it('should properly gets url', function() { button.domElem.attr('href').should.be.equal('/'); button.getUrl().should.be.equal('/'); }); it('should properly sets url', function() { button.setUrl('/bla'); button.domElem.attr('href').should.be.equal('/bla'); button.getUrl().should.be.equal('/bla'); }); }); describe('disabled', function() { it('should remove "href" attribute if disabled before init', function() { BEMDOM.destruct(button.domElem); // we need to destruct default button from beforeEach button = buildButton({ block : 'button', mods : { type : 'link', disabled : true }, url : '/' }); button.getUrl().should.be.equal('/'); expect(button.domElem.attr('href')).to.be.undefined; }); it('should update attributes properly', function() { button.setMod('disabled'); button.domElem.attr('aria-disabled').should.be.equal('true'); expect(button.domElem.attr('href')).to.be.undefined; button.delMod('disabled'); button.domElem.attr('href').should.be.equal('/'); expect(button.domElem.attr('aria-disabled')).to.be.undefined; }); }); function buildButton(bemjson) { return BEMDOM.init($(BEMHTML.apply(bemjson)) .appendTo('body')) .bem('button'); } }); provide(); });
// |jit-test| allow-oom; allow-unhandlable-oom gcparam("maxBytes", gcparam("gcBytes") + 4*1024); var max = 400; function f(b) { if (b) { f(b - 1); } else { g = { apply:function(x,y) { } }; } g.apply(null, arguments); } f(max - 1);
import Analyzer from 'parser/core/Analyzer'; import RESOURCE_TYPES from 'game/RESOURCE_TYPES'; class Insanity extends Analyzer { _insanityEvents = []; on_toPlayer_energize(event) { if (event.resourceChangeType === RESOURCE_TYPES.INSANITY.id) { this._insanityEvents = [ ...this._insanityEvents, event, ]; } } get events() { return this._insanityEvents; } } export default Insanity;
/*-------------------------------------------------------------------- Copyright (c) 2011 Local Projects. All rights reserved. Licensed under the Affero GNU GPL v3, see LICENSE for more details. --------------------------------------------------------------------*/ tc.gam.widgetVisibilityHandler = function(options) { var self = { currentHash: window.location.hash, previousHash: null }; self._setHash = function(hash) { if (hash === self.currentHash) { tc.jQ(window).trigger('hashchange'); } else { //This will trigger the 'hashchange' event because the hash is different window.location.hash = hash; } }; self._getHash = function() { return window.location.hash.substring(1, window.location.hash.length); }; self._goHome = function() { self._setHash('show,home'); }; self._triggerWidgetVisibilityEvent = function(action, widget, id) { tc.jQ(tc).trigger(action + '-project-widget', [widget, id]); }; self._onHashChange = function(event) { var action, widget; self.previousHash = self.currentHash; self.currentHash = self._getHash(); // For project-home hash, fire goHome. if (!self.currentHash || self.currentHash === 'project-home') { self._goHome(); } else { action = self.currentHash.split(',')[0]; widget = self.currentHash.split(',')[1]; id = self.currentHash.split(',')[2]; } tc.util.log('&&& hashchange: ' + action + ', ' + widget); self._triggerWidgetVisibilityEvent(action, widget, id); }; var bindEvents = function() { tc.jQ(window).bind('hashchange', self._onHashChange); }; var init = function() { bindEvents(); if (self.currentHash) { self._setHash(self.currentHash); } else { self._goHome(); } }; init(); return self; };
///<reference path="app.js" /> define(['Dexie', 'Dexie.Observable', './console'], function (Dexie, DexieObservable, console) { // Declare Dexie instance and explicitely apply the addon: var db = new Dexie("appdb2", { addons: [DexieObservable] }); // Define database schema db.version(1).stores({ contacts: '++id,first,last' }); // Populate ground data db.on('populate', function () { console.log("Populating data first time"); // Populate a contact db.contacts.add({ first: 'Arnold', last: 'Fitzgerald' }); }); // Open database db.open(); return db; });
'use strict'; module.exports = function (math) { var util = require('../../util/index'), BigNumber = math.type.BigNumber, collection = require('../../type/collection'), isNumber = util.number.isNumber, isBoolean = util['boolean'].isBoolean, isInteger = util.number.isInteger, isCollection = collection.isCollection; /** * Compute the factorial of a value * * Factorial only supports an integer value as argument. * For matrices, the function is evaluated element wise. * * Syntax: * * math.factorial(n) * * Examples: * * math.factorial(5); // returns 120 * math.factorial(3); // returns 6 * * See also: * * combinations, permutations * * @param {Number | BigNumber | Array | Matrix} n An integer number * @return {Number | BigNumber | Array | Matrix} The factorial of `n` */ math.factorial = function factorial (n) { var value, res; if (arguments.length != 1) { throw new math.error.ArgumentsError('factorial', arguments.length, 1); } if (isNumber(n)) { if (!isInteger(n) || n < 0) { throw new TypeError('Positive integer value expected in function factorial'); } value = n - 1; res = n; while (value > 1) { res *= value; value--; } if (res == 0) { res = 1; // 0! is per definition 1 } return res; } if (n instanceof BigNumber) { if (!(isPositiveInteger(n))) { throw new TypeError('Positive integer value expected in function factorial'); } var one = new BigNumber(1); value = n.minus(one); res = n; while (value.gt(one)) { res = res.times(value); value = value.minus(one); } if (res.equals(0)) { res = one; // 0! is per definition 1 } return res; } if (isBoolean(n)) { return 1; // factorial(1) = 1, factorial(0) = 1 } if (isCollection(n)) { return collection.deepMap(n, factorial); } throw new math.error.UnsupportedTypeError('factorial', math['typeof'](n)); }; /** * Test whether BigNumber n is a positive integer * @param {BigNumber} n * @returns {boolean} isPositiveInteger */ var isPositiveInteger = function(n) { return n.isInteger() && n.gte(0); }; };
/* */ "format cjs"; /** * Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer. * * @example * var res = res = source.sequenceEqual([1,2,3]); * var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; }); * 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42)); * 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; }); * @param {Observable} second Second observable sequence or array to compare. * @param {Function} [comparer] Comparer used to compare elements of both sequences. * @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer. */ observableProto.sequenceEqual = function (second, comparer) { var first = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var donel = false, doner = false, ql = [], qr = []; var subscription1 = first.subscribe(function (x) { var equal, v; if (qr.length > 0) { v = qr.shift(); try { equal = comparer(v, x); } catch (e) { o.onError(e); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (doner) { o.onNext(false); o.onCompleted(); } else { ql.push(x); } }, function(e) { o.onError(e); }, function () { donel = true; if (ql.length === 0) { if (qr.length > 0) { o.onNext(false); o.onCompleted(); } else if (doner) { o.onNext(true); o.onCompleted(); } } }); (isArrayLike(second) || isIterable(second)) && (second = observableFrom(second)); isPromise(second) && (second = observableFromPromise(second)); var subscription2 = second.subscribe(function (x) { var equal; if (ql.length > 0) { var v = ql.shift(); try { equal = comparer(v, x); } catch (exception) { o.onError(exception); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (donel) { o.onNext(false); o.onCompleted(); } else { qr.push(x); } }, function(e) { o.onError(e); }, function () { doner = true; if (qr.length === 0) { if (ql.length > 0) { o.onNext(false); o.onCompleted(); } else if (donel) { o.onNext(true); o.onCompleted(); } } }); return new CompositeDisposable(subscription1, subscription2); }, first); };
function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }
export const CREATE_COURSE = 'CREATE_COURSE';
/** * @file * <a href="https://travis-ci.org/Xotic750/has-to-string-tag-x" * title="Travis status"> * <img * src="https://travis-ci.org/Xotic750/has-to-string-tag-x.svg?branch=master" * alt="Travis status" height="18"> * </a> * <a href="https://david-dm.org/Xotic750/has-to-string-tag-x" * title="Dependency status"> * <img src="https://david-dm.org/Xotic750/has-to-string-tag-x.svg" * alt="Dependency status" height="18"/> * </a> * <a * href="https://david-dm.org/Xotic750/has-to-string-tag-x#info=devDependencies" * title="devDependency status"> * <img src="https://david-dm.org/Xotic750/has-to-string-tag-x/dev-status.svg" * alt="devDependency status" height="18"/> * </a> * <a href="https://badge.fury.io/js/has-to-string-tag-x" title="npm version"> * <img src="https://badge.fury.io/js/has-to-string-tag-x.svg" * alt="npm version" height="18"> * </a> * * hasToStringTag tests if @@toStringTag is supported. `true` if supported. * * <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2> * `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5 * methods that can be faithfully emulated with a legacy JavaScript engine. * * `es5-sham.js` monkey-patches other ES5 methods as closely as possible. * For these methods, as closely as possible to ES5 is not very close. * Many of these shams are intended only to allow code to be written to ES5 * without causing run-time errors in older engines. In many cases, * this means that these shams cause many ES5 methods to silently fail. * Decide carefully whether this is what you want. Note: es5-sham.js requires * es5-shim.js to be able to work properly. * * `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully. * * `es6.shim.js` provides compatibility shims so that legacy JavaScript engines * behave as closely as possible to ECMAScript 6 (Harmony). * * @version 1.1.0 * @author Xotic750 <Xotic750@gmail.com> * @copyright Xotic750 * @license {@link <https://opensource.org/licenses/MIT> MIT} * @module has-to-string-tag-x */ /* jslint maxlen:80, es6:true, white:true */ /* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, maxstatements:3, maxcomplexity:2 */ /* eslint strict: 1, max-statements: 1 */ /* global module */ ;(function () { // eslint-disable-line no-extra-semi 'use strict'; /** * Indicates if `Symbol.toStringTag`exists and is the correct type. * `true`, if it exists and is the correct type, otherwise `false`. * * @type boolean */ module.exports = require('has-symbol-support-x') && typeof Symbol.toStringTag === 'symbol'; }());
// Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-html-like-comments description: SingleLineHTMLOpenComment info: | Comment :: MultiLineComment SingleLineComment SingleLineHTMLOpenComment SingleLineHTMLCloseComment SingleLineDelimitedComment SingleLineHTMLOpenComment :: <!--SingleLineCommentCharsopt negative: phase: runtime type: Test262Error ---*/ var counter = 0; <!-- counter += 1; <!--the comment extends to these characters counter += 1; counter += 1;<!--the comment extends to these characters counter += 1; var x = 0; x = -1 <!--x; // Because this test concerns the interpretation of non-executable character // sequences within ECMAScript source code, special care must be taken to // ensure that executable code is evaluated as expected. // // Express the intended behavior by intentionally throwing an error; this // guarantees that test runners will only consider the test "passing" if // executable sequences are correctly interpreted as such. if (counter === 4 && x === -1) { throw new Test262Error(); }
// Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin description: > Set values with out of bounds negative target argument. info: | 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) %TypedArray%.prototype.copyWithin is a distinct function that implements the same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except that the this object's [[ArrayLength]] internal slot is accessed in place of performing a [[Get]] of "length" and the actual copying of values in step 12 must be performed in a manner that preserves the bit-level encoding of the source data. ... 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) ... 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let to be min(relativeTarget, len). ... includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0), [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); assert( compareArray( new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0), [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2), [2n, 3n, 4n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); assert( compareArray( new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2), [3n, 4n, 5n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); });
// 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-114 description: > Object.defineProperty - 'configurable' property in 'Attributes' is a Boolean object (8.10.5 step 4.b) ---*/ var obj = {}; Object.defineProperty(obj, "property", { configurable: new Boolean(true) }); var beforeDeleted = obj.hasOwnProperty("property"); delete obj.property; var afterDeleted = obj.hasOwnProperty("property"); assert.sameValue(beforeDeleted, true, 'beforeDeleted'); assert.sameValue(afterDeleted, false, 'afterDeleted');
// 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.3-2-25 description: > Object.getOwnPropertyDescriptor - argument 'P' is a number that converts to a string (value is 1e-7) ---*/ var obj = { "1e-7": 1 }; var desc = Object.getOwnPropertyDescriptor(obj, 1e-7); assert.sameValue(desc.value, 1, 'desc.value');
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow strict-local */ 'use strict'; import type {Node} from 'React'; import {ActivityIndicator, StyleSheet, View} from 'react-native'; import React, {Component} from 'react'; type State = {|animating: boolean|}; type Props = $ReadOnly<{||}>; type Timer = TimeoutID; class ToggleAnimatingActivityIndicator extends Component<Props, State> { _timer: Timer; constructor(props: Props) { super(props); this.state = { animating: true, }; } componentDidMount() { this.setToggleTimeout(); } componentWillUnmount() { clearTimeout(this._timer); } setToggleTimeout() { this._timer = setTimeout(() => { this.setState({animating: !this.state.animating}); this.setToggleTimeout(); }, 2000); } render(): Node { return ( <ActivityIndicator animating={this.state.animating} style={[styles.centering, {height: 80}]} size="large" /> ); } } const styles = StyleSheet.create({ centering: { alignItems: 'center', justifyContent: 'center', padding: 8, }, gray: { backgroundColor: '#cccccc', }, horizontal: { flexDirection: 'row', justifyContent: 'space-around', padding: 8, }, }); exports.displayName = (undefined: ?string); exports.category = 'UI'; exports.framework = 'React'; exports.title = 'ActivityIndicator'; exports.documentationURL = 'https://reactnative.dev/docs/activityindicator'; exports.description = 'Animated loading indicators.'; exports.examples = [ { title: 'Default (small, white)', render(): Node { return ( <ActivityIndicator style={[styles.centering, styles.gray]} color="white" /> ); }, }, { title: 'Gray', render(): Node { return ( <View> <ActivityIndicator style={[styles.centering]} /> <ActivityIndicator style={[styles.centering, styles.gray]} /> </View> ); }, }, { title: 'Custom colors', render(): Node { return ( <View style={styles.horizontal}> <ActivityIndicator color="#0000ff" /> <ActivityIndicator color="#aa00aa" /> <ActivityIndicator color="#aa3300" /> <ActivityIndicator color="#00aa00" /> </View> ); }, }, { title: 'Large', render(): Node { return ( <ActivityIndicator style={[styles.centering, styles.gray]} size="large" color="white" /> ); }, }, { title: 'Large, custom colors', render(): Node { return ( <View style={styles.horizontal}> <ActivityIndicator size="large" color="#0000ff" /> <ActivityIndicator size="large" color="#aa00aa" /> <ActivityIndicator size="large" color="#aa3300" /> <ActivityIndicator size="large" color="#00aa00" /> </View> ); }, }, { title: 'Start/stop', render(): Node { return <ToggleAnimatingActivityIndicator />; }, }, { title: 'Custom size', render(): Node { return ( <ActivityIndicator style={[styles.centering, {transform: [{scale: 1.5}]}]} size="large" /> ); }, }, { platform: 'android', title: 'Custom size (size: 75)', render(): Node { return <ActivityIndicator style={styles.centering} size={75} />; }, }, ];
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @providesModule takeSnapshot * @flow */ 'use strict'; const UIManager = require('UIManager'); const findNumericNodeHandle = require('findNumericNodeHandle'); /** * Capture an image of the screen, window or an individual view. The image * will be stored in a temporary file that will only exist for as long as the * app is running. * * The `view` argument can be the literal string `window` if you want to * capture the entire window, or it can be a reference to a specific * React Native component. * * The `options` argument may include: * - width/height (number) - the width and height of the image to capture. * - format (string) - either 'png' or 'jpeg'. Defaults to 'png'. * - quality (number) - the quality when using jpeg. 0.0 - 1.0 (default). * * Returns a Promise. * @platform ios */ function takeSnapshot( view?: 'window' | React$Element<any> | number, options?: { width?: number, height?: number, format?: 'png' | 'jpeg', quality?: number, }, ): Promise<any> { if (typeof view !== 'number' && view !== 'window') { view = findNumericNodeHandle(view) || 'window'; } // Call the hidden '__takeSnapshot' method; the main one throws an error to // prevent accidental backwards-incompatible usage. return UIManager.__takeSnapshot(view, options); } module.exports = takeSnapshot;
(function($, window, document) { var pluginName = 'fatNav', defaults = {}; function Plugin(options) { this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } $.extend(Plugin.prototype, { init: function() { var self = this; var $nav = this.$nav = $('.fat-nav'); var $hamburger = this.$hamburger = $('<a href="javascript:void(0)" class="hamburger"><div class="hamburger__icon"></div></a>'); this._bodyOverflow = $('body').css('overflow'); // Hack to prevent mobile safari scrolling the whole body when nav is open if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) { $nav.children().css({ 'height': '110%', 'transform': 'translateY(-5%)' }); } $('body').append($hamburger); $().add($hamburger).add($nav.find('a')).on('click', function(e) { self.toggleNav(); }); }, toggleNav: function() { var self = this; this.$nav.fadeToggle(400); self.toggleBodyOverflow(); $().add(this.$hamburger).add(this.$nav).toggleClass('active'); }, toggleBodyOverflow: function() { var self = this; var $body = $('body'); $body.toggleClass('no-scroll'); var isNavOpen = $body.hasClass('no-scroll'); // $body.width($body.width()); $body.css('overflow', isNavOpen ? 'hidden' : self._bodyOverflow); } }); if (typeof $[pluginName] === 'undefined') { $[pluginName] = function(options) { return new Plugin(this, options); }; } }(jQuery, window, document));
// package metadata file for Meteor.js 'use strict'; var packageName = 'gromo:jquery.scrollbar'; // https://atmospherejs.com/mediatainment/switchery var where = 'client'; // where to install: 'client' or 'server'. For both, pass nothing. Package.describe({ name: packageName, version: '0.2.10', // Brief, one-line summary of the package. summary: 'Cross-browser CSS customizable scrollbar with advanced features.', // URL to the Git repository containing the source code for this package. git: 'git@github.com:gromo/jquery.scrollbar.git' }); Package.onUse(function (api) { api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']); api.use('jquery', where); api.addFiles(['jquery.scrollbar.js', 'jquery.scrollbar.css'], where); }); Package.onTest(function (api) { api.use([packageName, 'sanjo:jasmine'], where); api.use(['webapp','tinytest'], where); api.addFiles('meteor/tests.js', where); // testing specific files });
var clientid = '4c3b2c1b-364c-4ceb-9416-8371dd4ebe3a'; if (/^#access_token=/.test(location.hash)) { location.assign('/Home/index?auto=1&ss=0' + '&cors=1' + '&client_id=' + clientid+ '&origins=https://webdir.online.lync.com/autodiscover/autodiscoverservice.svc/root'); } $('.loginForm').submit(function (event) { event.preventDefault(); if (location.hash == '') { location.assign('https://login.windows.net/common/oauth2/authorize?response_type=token' + '&client_id=' + clientid+ '&redirect_uri=http://healthcarenocc.azurewebsites.net/' + '&resource=https://webdir.online.lync.com'); } });
var vows = require('vows'), assert = require('assert'), path = require('path'), fs = require('fs'), exec = require('child_process').exec, base = path.join(__dirname, 'assets/badmodule/'), buildBase = path.join(base, 'build'), srcBase = path.join(base, 'src/foo'), rimraf = require('rimraf'); var tests = { 'clean build': { topic: function() { rimraf(path.join(buildBase, 'foo'), this.callback); }, 'should not have build dir and': { topic: function() { var self = this; fs.stat(path.join(buildBase, 'foo'), function(err) { self.callback(null, err); }); }, 'should not have build/foo': function(foo, err) { assert.isNotNull(err); assert.equal(err.code, 'ENOENT'); }, 'should build foo and': { topic: function() { var self = this, child; process.chdir(path.resolve(base, srcBase)); child = exec('../../../../../bin/shifter --no-global-config', function (error, stdout, stderr) { self.callback(null, { error: error, stderr: stderr }); }); }, 'should fail with an error code 1': function (topic) { assert.equal(topic.error.code, 1); }, 'should fail with an error message': function(topic) { assert.isNotNull(topic.stderr); } } } } }; vows.describe('building badmodule with UglifyJS via command line').addBatch(tests).export(module);
/* jshint multistr:true */ /* jshint -W040 */ 'use strict'; var envify = require('envify/custom'); var es3ify = require('es3ify'); var grunt = require('grunt'); var UglifyJS = require('uglify-js'); var uglifyify = require('uglifyify'); var derequire = require('derequire'); var collapser = require('bundle-collapser/plugin'); var SIMPLE_TEMPLATE = '/**\n\ * @PACKAGE@ v@VERSION@\n\ */'; var LICENSE_TEMPLATE = '/**\n\ * @PACKAGE@ v@VERSION@\n\ *\n\ * Copyright 2013-2014, Facebook, Inc.\n\ * All rights reserved.\n\ *\n\ * This source code is licensed under the BSD-style license found in the\n\ * LICENSE file in the root directory of this source tree. An additional grant\n\ * of patent rights can be found in the PATENTS file in the same directory.\n\ *\n\ */'; function minify(src) { return UglifyJS.minify(src, { fromString: true }).code; } // TODO: move this out to another build step maybe. function bannerify(src) { var version = grunt.config.data.pkg.version; var packageName = this.data.packageName || this.data.standalone; return LICENSE_TEMPLATE.replace('@PACKAGE@', packageName) .replace('@VERSION@', version) + '\n' + src; } function simpleBannerify(src) { var version = grunt.config.data.pkg.version; var packageName = this.data.packageName || this.data.standalone; return SIMPLE_TEMPLATE.replace('@PACKAGE@', packageName) .replace('@VERSION@', version) + '\n' + src; } // Our basic config which we'll add to to make our other builds var basic = { entries: [ './build/modules/React.js' ], outfile: './build/react.js', debug: false, standalone: 'React', transforms: [envify({NODE_ENV: 'development'})], plugins: [collapser], after: [es3ify.transform, derequire, simpleBannerify] }; var min = { entries: [ './build/modules/React.js' ], outfile: './build/react.min.js', debug: false, standalone: 'React', transforms: [envify({NODE_ENV: 'production'}), uglifyify], plugins: [collapser], after: [es3ify.transform, derequire, minify, bannerify] }; var transformer = { entries:[ './vendor/browser-transforms.js' ], outfile: './build/JSXTransformer.js', debug: false, standalone: 'JSXTransformer', transforms: [], plugins: [collapser], after: [es3ify.transform, derequire, simpleBannerify] }; var addons = { entries: [ './build/modules/ReactWithAddons.js' ], outfile: './build/react-with-addons.js', debug: false, standalone: 'React', packageName: 'React (with addons)', transforms: [envify({NODE_ENV: 'development'})], plugins: [collapser], after: [es3ify.transform, derequire, simpleBannerify] }; var addonsMin = { entries: [ './build/modules/ReactWithAddons.js' ], outfile: './build/react-with-addons.min.js', debug: false, standalone: 'React', packageName: 'React (with addons)', transforms: [envify({NODE_ENV: 'production'}), uglifyify], plugins: [collapser], after: [es3ify.transform, derequire, minify, bannerify] }; var withCodeCoverageLogging = { entries: [ './build/modules/React.js' ], outfile: './build/react.js', debug: true, standalone: 'React', transforms: [ envify({NODE_ENV: 'development'}), require('coverify') ], plugins: [collapser] }; module.exports = { basic: basic, min: min, transformer: transformer, addons: addons, addonsMin: addonsMin, withCodeCoverageLogging: withCodeCoverageLogging };
(function ($) { $.Redactor.opts.langs['ua'] = { html: 'Код', video: 'Відео', image: 'Зображення', table: 'Таблиця', link: 'Посилання', link_insert: 'Вставити посилання ...', link_edit: 'Edit link', unlink: 'Видалити посилання', formatting: 'Стилі', paragraph: 'Звичайний текст', quote: 'Цитата', code: 'Код', header1: 'Заголовок 1', header2: 'Заголовок 2', header3: 'Заголовок 3', header4: 'Заголовок 4', bold: 'Жирний', italic: 'Похилий', fontcolor: 'Колір тексту', backcolor: 'Заливка тексту', unorderedlist: 'Звичайний список', orderedlist: 'Нумерований список', outdent: 'Зменшити відступ', indent: 'Збільшити відступ', cancel: 'Скасувати', insert: 'Вставити', save: 'Зберегти', _delete: 'Видалити', insert_table: 'Вставити таблицю', insert_row_above: 'Додати рядок зверху', insert_row_below: 'Додати рядок знизу', insert_column_left: 'Додати стовпець ліворуч', insert_column_right: 'Додати стовпець праворуч', delete_column: 'Видалити стовпець', delete_row: 'Видалити рядок', delete_table: 'Видалити таблицю', rows: 'Рядки', columns: 'Стовпці', add_head: 'Додати заголовок', delete_head: 'Видалити заголовок', title: 'Підказка', image_view: 'Завантажити зображення', image_position: 'Обтікання текстом', none: 'ні', left: 'ліворуч', right: 'праворуч', image_web_link: 'Посилання на зображення', text: 'Текст', mailto: 'Ел. пошта', web: 'URL', video_html_code: 'Код відео ролика', file: 'Файл', upload: 'Завантажити', download: 'Завантажити', choose: 'Вибрати', or_choose: 'Або виберіть', drop_file_here: 'Перетягніть файл сюди', align_left: 'По лівому краю', align_center: 'По центру', align_right: 'По правому краю', align_justify: 'Вирівняти текст по ширині', horizontalrule: 'Горизонтальная лінійка', fullscreen: 'На весь екран', deleted: 'Закреслений', anchor: 'Anchor', link_new_tab: 'Open link in new tab', underline: 'Underline', alignment: 'Alignment', filename: 'Name (optional)' }; })( jQuery );
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // MIT License. See license.txt $.extend(frappe.model, { docinfo: {}, sync: function(r) { /* docs: extract docs, docinfo (attachments, comments, assignments) from incoming request and set in `locals` and `frappe.model.docinfo` */ var isPlain; if(!r.docs && !r.docinfo) r = {docs:r}; isPlain = $.isPlainObject(r.docs); if(isPlain) r.docs = [r.docs]; if(r.docs) { var last_parent_name = null; for(var i=0, l=r.docs.length; i<l; i++) { var d = r.docs[i]; frappe.model.add_to_locals(d); d.__last_sync_on = new Date(); if(d.doctype==="DocType") { frappe.meta.sync(d); } if(cur_frm && cur_frm.doctype==d.doctype && cur_frm.docname==d.name) { cur_frm.doc = d; } if(d.localname) { frappe.model.new_names[d.localname] = d.name; $(document).trigger('rename', [d.doctype, d.localname, d.name]); delete locals[d.doctype][d.localname]; // update docinfo to new dict keys if(i===0) { frappe.model.docinfo[d.doctype][d.name] = frappe.model.docinfo[d.doctype][d.localname]; frappe.model.docinfo[d.doctype][d.localname] = undefined; } } } if(cur_frm && isPlain) cur_frm.dirty(); } // set docinfo (comments, assign, attachments) if(r.docinfo) { if(r.docs) { var doc = r.docs[0]; } else { if(cur_frm) var doc = cur_frm.doc; } if(doc) { if(!frappe.model.docinfo[doc.doctype]) frappe.model.docinfo[doc.doctype] = {}; frappe.model.docinfo[doc.doctype][doc.name] = r.docinfo; } } return r.docs; }, add_to_locals: function(doc) { if(!locals[doc.doctype]) locals[doc.doctype] = {}; if(!doc.name && doc.__islocal) { // get name (local if required) if(!doc.parentfield) frappe.model.clear_doc(doc); doc.name = frappe.model.get_new_name(doc.doctype); if(!doc.parentfield) frappe.provide("frappe.model.docinfo." + doc.doctype + "." + doc.name); } locals[doc.doctype][doc.name] = doc; // add child docs to locals if(!doc.parentfield) { for(var i in doc) { var value = doc[i]; if($.isArray(value)) { for (var x=0, y=value.length; x < y; x++) { var d = value[x]; if(!d.parent) d.parent = doc.name; frappe.model.add_to_locals(d); } } } } } });
export const INCREMENT_COUNTER = 'INCREMENT_COUNTER' export const DECREMENT_COUNTER = 'DECREMENT_COUNTER'
var expect = require('chai').expect; var runner = require('../runner'); describe('nasm runner', function() { describe('.run', function() { it('should handle basic code evaluation (no libc)', function(done) { runner.run({ language: 'nasm', code: [ ' global _start', ' section .text', '_start:', ' mov rax, 1', ' mov rdi, 1', ' mov rsi, message', ' mov rdx, 25', ' syscall', ' mov eax, 60', ' xor rdi, rdi', ' syscall', 'message:', 'db "Hello, Netwide Assembler!", 25' ].join('\n') }, function(buffer) { expect(buffer.stdout).to.equal('Hello, Netwide Assembler!'); done(); }); }); it('should handle basic code evaluation (with libc)', function(done) { runner.run({ language: 'nasm', code: [ ' global main', ' extern puts', ' section .text', 'main:', ' mov rdi, message', ' call puts', ' ret', 'message:', 'db "Netwide Assembler together with LIBC! Let\'s Port Codewars From Rails to THIS! \\m/", 0' ].join('\n') }, function(buffer) { expect(buffer.stdout).to.equal('Netwide Assembler together with LIBC! Let\'s Port Codewars From Rails to THIS! \\m/\n'); done(); }); }); }); });
/** * error handling middleware loosely based off of the connect/errorHandler code. This handler chooses * to render errors using Jade / Express instead of the manual templating used by the connect middleware * sample. This may or may not be a good idea :-) * @param options {object} array of options **/ exports = module.exports = function errorHandler(options) { options = options || {}; // defaults var showStack = options.showStack || options.stack , showMessage = options.showMessage || options.message , dumpExceptions = options.dumpExceptions || options.dump , formatUrl = options.formatUrl; return function errorHandler(err, req, res, next) { res.statusCode = 500; if(dumpExceptions) console.error(err.stack); var app = res.app; if(err instanceof exports.NotFound) { res.render('errors/404', { locals: { title: '404 - Not Found' }, status: 404 }); } else { res.render('errors/500', { locals: { title: 'The Server Encountered an Error' , error: showStack ? err : undefined }, status: 500 }); } }; }; exports.NotFound = function(msg) { this.name = 'NotFound'; Error.call(this, msg); Error.captureStackTrace(this, arguments.callee); }
// 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. if (!process.versions.openssl) { console.error('Skipping because node compiled without OpenSSL.'); process.exit(0); } var common = require('../common'); var assert = require('assert'); var fs = require('fs'); var tls = require('tls'); var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); tls.createServer({ key: key, cert: cert }, function(conn) { conn.end(); this.close(); }).listen(0, function() { var options = { port: this.address().port, rejectUnauthorized: true }; tls.connect(options).on('error', common.mustCall(function(err) { assert.equal(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); assert.equal(err.message, 'unable to verify the first certificate'); this.destroy(); })); });
Kanboard.App = function() { this.controllers = {}; }; Kanboard.App.prototype.get = function(controller) { return this.controllers[controller]; }; Kanboard.App.prototype.execute = function() { for (var className in Kanboard) { if (className !== "App") { var controller = new Kanboard[className](this); this.controllers[className] = controller; if (typeof controller.execute === "function") { controller.execute(); } if (typeof controller.listen === "function") { controller.listen(); } if (typeof controller.focus === "function") { controller.focus(); } } } this.focus(); this.datePicker(); this.autoComplete(); this.tagAutoComplete(); }; Kanboard.App.prototype.focus = function() { // Auto-select input fields $(document).on('focus', '.auto-select', function() { $(this).select(); }); // Workaround for chrome $(document).on('mouseup', '.auto-select', function(e) { e.preventDefault(); }); }; Kanboard.App.prototype.datePicker = function() { var bodyElement = $("body"); var dateFormat = bodyElement.data("js-date-format"); var timeFormat = bodyElement.data("js-time-format"); var lang = bodyElement.data("js-lang"); $.datepicker.setDefaults($.datepicker.regional[lang]); $.timepicker.setDefaults($.timepicker.regional[lang]); // Datepicker $(".form-date").datepicker({ showOtherMonths: true, selectOtherMonths: true, dateFormat: dateFormat, constrainInput: false }); // Datetime picker $(".form-datetime").datetimepicker({ dateFormat: dateFormat, timeFormat: timeFormat, constrainInput: false }); }; Kanboard.App.prototype.tagAutoComplete = function() { $(".tag-autocomplete").select2({ tags: true }); }; Kanboard.App.prototype.autoComplete = function() { $(".autocomplete").each(function() { var input = $(this); var field = input.data("dst-field"); var extraFields = input.data("dst-extra-fields"); if ($('#form-' + field).val() === '') { input.parent().find("button[type=submit]").attr('disabled','disabled'); } input.autocomplete({ source: input.data("search-url"), minLength: 1, select: function(event, ui) { $("input[name=" + field + "]").val(ui.item.id); if (extraFields) { var fields = extraFields.split(','); for (var i = 0; i < fields.length; i++) { var fieldName = fields[i].trim(); $("input[name=" + fieldName + "]").val(ui.item[fieldName]); } } input.parent().find("button[type=submit]").removeAttr('disabled'); } }); }); }; Kanboard.App.prototype.hasId = function(id) { return !!document.getElementById(id); }; Kanboard.App.prototype.showLoadingIcon = function() { $("body").append('<span id="app-loading-icon">&nbsp;<i class="fa fa-spinner fa-spin"></i></span>'); }; Kanboard.App.prototype.hideLoadingIcon = function() { $("#app-loading-icon").remove(); };
/* * Should * Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */ module.exports = function(should, Assertion) { /** * Assert given object is NaN * @name NaN * @memberOf Assertion * @category assertion numbers * @example * * (10).should.not.be.NaN(); * NaN.should.be.NaN(); */ Assertion.add('NaN', function() { this.params = { operator: 'to be NaN' }; this.assert(this.obj !== this.obj); }); /** * Assert given object is not finite (positive or negative) * * @name Infinity * @memberOf Assertion * @category assertion numbers * @example * * (10).should.not.be.Infinity(); * NaN.should.not.be.Infinity(); */ Assertion.add('Infinity', function() { this.params = { operator: 'to be Infinity' }; this.is.a.Number() .and.not.a.NaN() .and.assert(!isFinite(this.obj)); }); /** * Assert given number between `start` and `finish` or equal one of them. * * @name within * @memberOf Assertion * @category assertion numbers * @param {number} start Start number * @param {number} finish Finish number * @param {string} [description] Optional message * @example * * (10).should.be.within(0, 20); */ Assertion.add('within', function(start, finish, description) { this.params = { operator: 'to be within ' + start + '..' + finish, message: description }; this.assert(this.obj >= start && this.obj <= finish); }); /** * Assert given number near some other `value` within `delta` * * @name approximately * @memberOf Assertion * @category assertion numbers * @param {number} value Center number * @param {number} delta Radius * @param {string} [description] Optional message * @example * * (9.99).should.be.approximately(10, 0.1); */ Assertion.add('approximately', function(value, delta, description) { this.params = { operator: 'to be approximately ' + value + " ±" + delta, message: description }; this.assert(Math.abs(this.obj - value) <= delta); }); /** * Assert given number above `n`. * * @name above * @alias Assertion#greaterThan * @memberOf Assertion * @category assertion numbers * @param {number} n Margin number * @param {string} [description] Optional message * @example * * (10).should.be.above(0); */ Assertion.add('above', function(n, description) { this.params = { operator: 'to be above ' + n, message: description }; this.assert(this.obj > n); }); /** * Assert given number below `n`. * * @name below * @alias Assertion#lessThan * @memberOf Assertion * @category assertion numbers * @param {number} n Margin number * @param {string} [description] Optional message * @example * * (0).should.be.below(10); */ Assertion.add('below', function(n, description) { this.params = { operator: 'to be below ' + n, message: description }; this.assert(this.obj < n); }); Assertion.alias('above', 'greaterThan'); Assertion.alias('below', 'lessThan'); };
import { run } from '@ember/runloop'; import { guidFor, setName } from 'ember-utils'; import { context } from 'ember-environment'; import EmberObject from '../../../lib/system/object'; import Namespace from '../../../lib/system/namespace'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; let originalLookup = context.lookup; let lookup; moduleFor( 'system/object/toString', class extends AbstractTestCase { beforeEach() { context.lookup = lookup = {}; } afterEach() { context.lookup = originalLookup; } ['@test toString() returns the same value if called twice'](assert) { let Foo = Namespace.create(); Foo.toString = function() { return 'Foo'; }; Foo.Bar = EmberObject.extend(); assert.equal(Foo.Bar.toString(), 'Foo.Bar'); assert.equal(Foo.Bar.toString(), 'Foo.Bar'); let obj = Foo.Bar.create(); assert.equal(obj.toString(), '<Foo.Bar:' + guidFor(obj) + '>'); assert.equal(obj.toString(), '<Foo.Bar:' + guidFor(obj) + '>'); assert.equal(Foo.Bar.toString(), 'Foo.Bar'); run(Foo, 'destroy'); } ['@test toString on a class returns a useful value when nested in a namespace'](assert) { let obj; let Foo = Namespace.create(); Foo.toString = function() { return 'Foo'; }; Foo.Bar = EmberObject.extend(); assert.equal(Foo.Bar.toString(), 'Foo.Bar'); obj = Foo.Bar.create(); assert.equal(obj.toString(), '<Foo.Bar:' + guidFor(obj) + '>'); Foo.Baz = Foo.Bar.extend(); assert.equal(Foo.Baz.toString(), 'Foo.Baz'); obj = Foo.Baz.create(); assert.equal(obj.toString(), '<Foo.Baz:' + guidFor(obj) + '>'); obj = Foo.Bar.create(); assert.equal(obj.toString(), '<Foo.Bar:' + guidFor(obj) + '>'); run(Foo, 'destroy'); } ['@test toString on a namespace finds the namespace in lookup'](assert) { let Foo = (lookup.Foo = Namespace.create()); assert.equal(Foo.toString(), 'Foo'); run(Foo, 'destroy'); } ['@test toString on a namespace finds the namespace in lookup'](assert) { let Foo = (lookup.Foo = Namespace.create()); let obj; Foo.Bar = EmberObject.extend(); assert.equal(Foo.Bar.toString(), 'Foo.Bar'); obj = Foo.Bar.create(); assert.equal(obj.toString(), '<Foo.Bar:' + guidFor(obj) + '>'); run(Foo, 'destroy'); } ['@test toString on a namespace falls back to modulePrefix, if defined'](assert) { let Foo = Namespace.create({ modulePrefix: 'foo' }); assert.equal(Foo.toString(), 'foo'); run(Foo, 'destroy'); } ['@test toString includes toStringExtension if defined'](assert) { let Foo = EmberObject.extend({ toStringExtension() { return 'fooey'; }, }); let foo = Foo.create(); let Bar = EmberObject.extend({}); let bar = Bar.create(); // simulate these classes being defined on a Namespace setName(Foo, 'Foo'); setName(Bar, 'Bar'); assert.equal( bar.toString(), '<Bar:' + guidFor(bar) + '>', 'does not include toStringExtension part' ); assert.equal( foo.toString(), '<Foo:' + guidFor(foo) + ':fooey>', 'Includes toStringExtension result' ); } } );
#!/usr/bin/env node 'use strict'; var fs = require('fs'), path = require('path'), exec = require('child_process').exec, chalk = require('chalk'), Table = require('cli-table'); var fileNames = [ 'abc', 'amazon', //'eloquentjavascript', //'es6-draft', 'es6-table', 'google', 'html-minifier', 'msn', 'newyorktimes', 'stackoverflow', 'wikipedia', 'es6' ]; fileNames = fileNames.sort().reverse(); var table = new Table({ head: ['File', 'Before', 'After', 'Savings', 'Time'], colWidths: [20, 25, 25, 20, 20] }); function toKb(size) { return (size / 1024).toFixed(2); } function redSize(size) { return chalk.red.bold(size) + chalk.white(' (' + toKb(size) + ' KB)'); } function greenSize(size) { return chalk.green.bold(size) + chalk.white(' (' + toKb(size) + ' KB)'); } function blueSavings(oldSize, newSize) { var savingsPercent = (1 - newSize / oldSize) * 100; var savings = (oldSize - newSize) / 1024; return chalk.cyan.bold(savingsPercent.toFixed(2)) + chalk.white('% (' + savings.toFixed(2) + ' KB)'); } function blueTime(time) { return chalk.cyan.bold(time) + chalk.white(' ms'); } function test(fileName, done) { if (!fileName) { console.log('\n' + table.toString()); return; } console.log('Processing...', fileName); var filePath = path.join('benchmarks/', fileName + '.html'); var minifiedFilePath = path.join('benchmarks/generated/', fileName + '.min.html'); var gzFilePath = path.join('benchmarks/generated/', fileName + '.html.gz'); var gzMinifiedFilePath = path.join('benchmarks/generated/', fileName + '.min.html.gz'); var command = path.normalize('./cli.js') + ' ' + filePath + ' -c benchmark.conf' + ' -o ' + minifiedFilePath; // Open and read the size of the original input fs.stat(filePath, function (err, stats) { if (err) { throw new Error('There was an error reading ' + filePath); } var originalSize = stats.size; exec('gzip --keep --force --best --stdout ' + filePath + ' > ' + gzFilePath, function () { // Open and read the size of the gzipped original fs.stat(gzFilePath, function (err, stats) { if (err) { throw new Error('There was an error reading ' + gzFilePath); } var gzOriginalSize = stats.size; // Begin timing after gzipped fixtures have been created var startTime = new Date(); exec('node ' + command, function () { // Open and read the size of the minified output fs.stat(minifiedFilePath, function (err, stats) { if (err) { throw new Error('There was an error reading ' + minifiedFilePath); } var minifiedSize = stats.size; var minifiedTime = new Date() - startTime; // Gzip the minified output exec('gzip --keep --force --best --stdout ' + minifiedFilePath + ' > ' + gzMinifiedFilePath, function () { // Open and read the size of the minified+gzipped output fs.stat(gzMinifiedFilePath, function (err, stats) { if (err) { throw new Error('There was an error reading ' + gzMinifiedFilePath); } var gzMinifiedSize = stats.size; var gzMinifiedTime = new Date() - startTime; table.push([ [fileName, '+ gzipped'].join('\n'), [redSize(originalSize), redSize(gzOriginalSize)].join('\n'), [greenSize(minifiedSize), greenSize(gzMinifiedSize)].join('\n'), [blueSavings(originalSize, minifiedSize), blueSavings(gzOriginalSize, gzMinifiedSize)].join('\n'), [blueTime(minifiedTime), blueTime(gzMinifiedTime)].join('\n') ]); done(); }); }); }); }); }); }); }); } (function run() { test(fileNames.pop(), run); })();
var name = "Wanderer"; var collection_type = 0; var is_secret = 0; var desc = "Visited 503 new locations."; var status_text = "Gosh, where HAVEN'T you traveled? Your peregrinations have earned you this footworn-but-carefree Wanderer badge."; var last_published = 1348803094; var is_shareworthy = 1; var url = "wanderer"; var category = "exploring"; var url_swf = "\/c2.glitch.bz\/achievements\/2011-09-18\/wanderer_1316414516.swf"; var url_img_180 = "\/c2.glitch.bz\/achievements\/2011-09-18\/wanderer_1316414516_180.png"; var url_img_60 = "\/c2.glitch.bz\/achievements\/2011-09-18\/wanderer_1316414516_60.png"; var url_img_40 = "\/c2.glitch.bz\/achievements\/2011-09-18\/wanderer_1316414516_40.png"; function on_apply(pc){ } var conditions = { 8 : { type : "group_count", group : "locations_visited", value : "503" }, }; function onComplete(pc){ // generated from rewards var multiplier = pc.buffs_has('gift_of_gab') ? 1.2 : pc.buffs_has('silvertongue') ? 1.05 : 1.0; multiplier += pc.imagination_get_achievement_modifier(); if (/completist/i.exec(this.name)) { var level = pc.stats_get_level(); if (level > 4) { multiplier *= (pc.stats_get_level()/4); } } pc.stats_add_xp(round_to_5(1000 * multiplier), true); pc.stats_add_favor_points("lem", round_to_5(200 * multiplier)); if(pc.buffs_has('gift_of_gab')) { pc.buffs_remove('gift_of_gab'); } else if(pc.buffs_has('silvertongue')) { pc.buffs_remove('silvertongue'); } } var rewards = { "xp" : 1000, "favor" : { "giant" : "lem", "points" : 200 } }; // generated ok (NO DATE)
export default class ModelAccessor { constructor() { this.value = 10 } get highCount() { return this.value + 100 } set highCount(v) { this.value = v - 100 } get doubleHigh() { return this.highCount * 2 } incr() { this.value++ } }
import { Template } from 'meteor/templating'; Template.messageAction.helpers({ isButton() { return this.type === 'button'; }, areButtonsHorizontal() { return Template.parentData(1).button_alignment === 'horizontal'; }, jsActionButtonClassname(processingType) { return `js-actionButton-${ processingType || 'sendMessage' }`; }, });
import fs from 'fs'; import url from 'url'; import path from 'path'; import mime from 'mime-types'; import gulp from 'gulp'; import createServerTask from './tasks/server'; import consoleArguments from './console-arguments'; import { adminBundle } from './admin-bundle.tasks'; import { dashboardBundle } from './dashboard-bundle.tasks'; import { mediaBundle } from './media-bundle.tasks'; import { translatorBundle } from './translator-bundle.tasks'; const BUNDLES = [adminBundle, dashboardBundle, mediaBundle, translatorBundle]; const writeToResponse = (req, res, bundlePaths) => { const formattedUrl = url.parse(req.url); for (const bundlePath of bundlePaths) { const filePath = path.normalize(bundlePath + formattedUrl.pathname); try { const stat = fs.statSync(filePath); if (stat && stat.isFile()) { const rstream = fs.createReadStream(filePath); const extension = path.extname(filePath); const contentType = mime.lookup(extension); res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': stat.size }); rstream.pipe(res); return; } } catch (e) { // Does not exist } } return new Error(`Local file for ${req.url} not found`); }; const handleRequest = (req, res, next) => { if (writeToResponse(req, res, BUNDLES.map(item => item.config.distPath))) { // Nothing we can write to the stream, fallback to the default behavior return next(); }; }; const startLocalTask = createServerTask({ config: { ui: false, ghostMode: false, open: false, reloadOnRestart: true, notify: true, proxy: { target: consoleArguments.backendProxy }, middleware: BUNDLES.map(bundle => { return { route: bundle.config.publicPath, handle: handleRequest } }) } }); export const buildOnChange = (done) => { for (const bundle of BUNDLES) { const srcPath = bundle.config.srcPath; const jsAssets = srcPath + 'js/**/!(*.spec).js'; gulp.watch(jsAssets, bundle.tasks.scripts); if (bundle.tasks.bundle) { const jsNextAssets = srcPath + 'jsnext/**/!(*.spec).js'; gulp.watch(jsNextAssets, bundle.tasks.bundle); } const styleAssets = srcPath + 'scss/**/*.scss'; gulp.watch(styleAssets, bundle.tasks.cssOptimized); if (bundle.tasks.cssNextOptimized) { const styleNextAssets = srcPath + 'scssnext/**/*.scss'; gulp.watch(styleNextAssets, bundle.tasks.cssNextOptimized); } } done(); }; export function testOnChange(done) { for (const bundle of BUNDLES) { if (bundle.tasks.eslint) { const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}jsnext/**/*.js`, bundle.tasks.eslint); } if (bundle.tasks.stylelint) { const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}scssnext/**/*.scss`, bundle.tasks.stylelint); } } done(); } export default startLocalTask;
'use strict'; describe('Service: Initiatives', function () { // instantiate service var Initiatives, Timeout, cfg, $httpBackend, $rootScope, tPromise; // load the service's module beforeEach(module('sumaAnalysis')); beforeEach(inject(function (_$rootScope_, _$httpBackend_, _initiatives_, $q, $timeout) { $rootScope = _$rootScope_; $httpBackend = _$httpBackend_; Initiatives = _initiatives_; tPromise = $q.defer(); Timeout = $timeout; cfg = { timeoutPromise: tPromise, timeout: 180000 }; })); it('should make an AJAX call', function (done) { $httpBackend.whenGET('lib/php/initiatives.php') .respond([{}, {}]); Initiatives.get(cfg).then(function (result) { expect(result.length).to.equal(2); done(); }); $httpBackend.flush(); }); it('should respond with error message on failure', function (done) { $httpBackend.whenGET('lib/php/initiatives.php') .respond(500, {message: 'Error'}); Initiatives.get(cfg).then(function (result) { }, function (result) { expect(result).to.deep.equal({ message: 'Error', code: 500 }); done(); }); $httpBackend.flush(); }); it('should return error with promiseTimeout true on aborted http request', function (done) { // simulate aborted request $httpBackend.whenGET('lib/php/initiatives.php') .respond(0, {message: 'Error'}); Initiatives.get(cfg).then(function (result) { }, function (result) { expect(result).to.deep.equal({ message: 'Initiatives.get Timeout', code: 0, promiseTimeout: true }); done(); }); $httpBackend.flush(); }); it('should return error without promiseTimeout on http timeout', function (done) { $httpBackend.whenGET('lib/php/initiatives.php') .respond([{}, {}]); Initiatives.get(cfg).then(function (result) { }, function (result) { expect(result).to.deep.equal({ message: 'Initiatives.get Timeout', code: 0 }); done(); }); Timeout.flush(); }); });
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* Tabulator v4.0.2 (c) Oliver Folkerd */ var HtmlTableImport = function HtmlTableImport(table) { this.table = table; //hold Tabulator object this.fieldIndex = []; this.hasIndex = false; }; HtmlTableImport.prototype.parseTable = function () { var self = this, element = self.table.element, options = self.table.options, columns = options.columns, headers = element.getElementsByTagName("th"), rows = element.getElementsByTagName("tbody")[0].getElementsByTagName("tr"), data = [], newTable; self.hasIndex = false; self.table.options.htmlImporting.call(this.table); //check for tablator inline options self._extractOptions(element, options); if (headers.length) { self._extractHeaders(headers, rows); } else { self._generateBlankHeaders(headers, rows); } //iterate through table rows and build data set for (var index = 0; index < rows.length; index++) { var row = rows[index], cells = row.getElementsByTagName("td"), item = {}; //create index if the dont exist in table if (!self.hasIndex) { item[options.index] = index; } for (var i = 0; i < cells.length; i++) { var cell = cells[i]; if (typeof this.fieldIndex[i] !== "undefined") { item[this.fieldIndex[i]] = cell.innerHTML; } } //add row data to item data.push(item); } //create new element var newElement = document.createElement("div"); //transfer attributes to new element var attributes = element.attributes; // loop through attributes and apply them on div for (var i in attributes) { if (_typeof(attributes[i]) == "object") { newElement.setAttribute(attributes[i].name, attributes[i].value); } } // replace table with div element element.parentNode.replaceChild(newElement, element); options.data = data; self.table.options.htmlImported.call(this.table); // // newElement.tabulator(options); this.table.element = newElement; }; //extract tabluator attribute options HtmlTableImport.prototype._extractOptions = function (element, options) { var attributes = element.attributes; for (var index in attributes) { var attrib = attributes[index]; var name; if ((typeof attrib === "undefined" ? "undefined" : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { name = attrib.name.replace("tabulator-", ""); for (var key in options) { if (key.toLowerCase() == name) { options[key] = this._attribValue(attrib.value); } } } } }; //get value of attribute HtmlTableImport.prototype._attribValue = function (value) { if (value === "true") { return true; } if (value === "false") { return false; } return value; }; //find column if it has already been defined HtmlTableImport.prototype._findCol = function (title) { var match = this.table.options.columns.find(function (column) { return column.title === title; }); return match || false; }; //extract column from headers HtmlTableImport.prototype._extractHeaders = function (headers, rows) { for (var index = 0; index < headers.length; index++) { var header = headers[index], exists = false, col = this._findCol(header.textContent), width, attributes; if (col) { exists = true; } else { col = { title: header.textContent.trim() }; } if (!col.field) { col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); } width = header.getAttribute("width"); if (width && !col.width) { col.width = width; } //check for tablator inline options attributes = header.attributes; // //check for tablator inline options this._extractOptions(header, col); for (var i in attributes) { var attrib = attributes[i], name; if ((typeof attrib === "undefined" ? "undefined" : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { name = attrib.name.replace("tabulator-", ""); col[name] = this._attribValue(attrib.value); } } this.fieldIndex[index] = col.field; if (col.field == this.table.options.index) { this.hasIndex = true; } if (!exists) { this.table.options.columns.push(col); } } }; //generate blank headers HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { for (var index = 0; index < headers.length; index++) { var header = headers[index], col = { title: "", field: "col" + index }; this.fieldIndex[index] = col.field; var width = header.getAttribute("width"); if (width) { col.width = width; } this.table.options.columns.push(col); } }; Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport);
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- function DumpArray(a) { var undef_start = -1; for (var i = 0; i < a.length; i++) { if (a[i] == undefined) { if (undef_start == -1) { undef_start = i; } } else { if (undef_start != -1) { WScript.Echo(undef_start + "-" + (i-1) + " = undefined"); undef_start = -1; } WScript.Echo(i + " = " + a[i]); } } } DumpArray([]); DumpArray([ 0 ]); DumpArray([ 0, 1, 2, 3, 4, 5, 6 ,7 ,8, 9]); DumpArray([,,,0,,,1,,,2,,,3,,,4,,,5,,,6,,,7,,,8,,,9,,,]); var s0 = ""; for (var i = 0; i < 100; i++) { s0 += ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"; } DumpArray(eval("[" + s0 + "1]")); var s1 = ""; for (var i = 0; i < 30; i++) { s1 += s0; } DumpArray(eval("[" + s1 + "1]")); var s2 = ""; for (var i = 0; i < 10; i++) { s2 += s1; } DumpArray(eval("[" + s2 + "1]"));
$_L(["$wt.widgets.Layout"],"$wt.layout.FillLayout",["$wt.graphics.Point","$wt.layout.FillData"],function(){ c$=$_C(function(){ this.type=256; this.marginWidth=0; this.marginHeight=0; this.spacing=0; $_Z(this,arguments); },$wt.layout,"FillLayout",$wt.widgets.Layout); $_K(c$, function(){ $_R(this,$wt.layout.FillLayout,[]); }); $_K(c$, function(type){ $_R(this,$wt.layout.FillLayout,[]); this.type=type; },"~N"); $_V(c$,"computeSize", function(composite,wHint,hHint,flushCache){ var children=composite.getChildren(); var count=children.length; var maxWidth=0; var maxHeight=0; for(var i=0;i<count;i++){ var child=children[i]; var w=wHint; var h=hHint; if(count>0){ if(this.type==256&&wHint!=-1){ w=Math.max(0,Math.floor((wHint-(count-1)*this.spacing)/count)); }if(this.type==512&&hHint!=-1){ h=Math.max(0,Math.floor((hHint-(count-1)*this.spacing)/count)); }}var size=this.computeChildSize(child,w,h,flushCache); maxWidth=Math.max(maxWidth,size.x); maxHeight=Math.max(maxHeight,size.y); } var width=0; var height=0; if(this.type==256){ width=count*maxWidth; if(count!=0)width+=(count-1)*this.spacing; height=maxHeight; }else{ width=maxWidth; height=count*maxHeight; if(count!=0)height+=(count-1)*this.spacing; }width+=this.marginWidth*2; height+=this.marginHeight*2; if(wHint!=-1)width=wHint; if(hHint!=-1)height=hHint; return new $wt.graphics.Point(width,height); },"$wt.widgets.Composite,~N,~N,~B"); $_M(c$,"computeChildSize", function(control,wHint,hHint,flushCache){ var data=control.getLayoutData(); if(data==null){ data=new $wt.layout.FillData(); control.setLayoutData(data); }var size=null; if(wHint==-1&&hHint==-1){ size=data.computeSize(control,wHint,hHint,flushCache); }else{ var trimX; var trimY; if($_O(control,$wt.widgets.Scrollable)){ var rect=(control).computeTrim(0,0,0,0); trimX=rect.width; trimY=rect.height; }else{ trimX=trimY=control.getBorderWidth()*2; }var w=wHint==-1?wHint:Math.max(0,wHint-trimX); var h=hHint==-1?hHint:Math.max(0,hHint-trimY); size=data.computeSize(control,w,h,flushCache); }return size; },"$wt.widgets.Control,~N,~N,~B"); $_V(c$,"flushCache", function(control){ var data=control.getLayoutData(); if(data!=null)(data).flushCache(); return true; },"$wt.widgets.Control"); $_M(c$,"getName", function(){ var string=this.getClass().getName(); var index=string.lastIndexOf('.'); if(index==-1)return string; return string.substring(index+1,string.length); }); $_V(c$,"layout", function(composite,flushCache){ var rect=composite.getClientArea(); var children=composite.getChildren(); var count=children.length; if(count==0)return; var width=rect.width-this.marginWidth*2; var height=rect.height-this.marginHeight*2; if(this.type==256){ width-=(count-1)*this.spacing; var x=rect.x+this.marginWidth; var extra=width%count; var y=rect.y+this.marginHeight; var cellWidth=Math.floor(width/count); for(var i=0;i<count;i++){ var child=children[i]; var childWidth=cellWidth; if(i==0){ childWidth+=Math.floor(extra/2); }else{ if(i==count-1)childWidth+=Math.floor((extra+1)/2); }child.setBounds(x,y,childWidth,height); x+=childWidth+this.spacing; } }else{ height-=(count-1)*this.spacing; var x=rect.x+this.marginWidth; var cellHeight=Math.floor(height/count); var y=rect.y+this.marginHeight; var extra=height%count; for(var i=0;i<count;i++){ var child=children[i]; var childHeight=cellHeight; if(i==0){ childHeight+=Math.floor(extra/2); }else{ if(i==count-1)childHeight+=Math.floor((extra+1)/2); }child.setBounds(x,y,width,childHeight); y+=childHeight+this.spacing; } }},"$wt.widgets.Composite,~B"); $_V(c$,"toString", function(){ var string=this.getName()+"{"; string+="type="+((this.type==512)?"SWT.VERTICAL":"SWT.HORIZONTAL")+" "; if(this.marginWidth!=0)string+="marginWidth="+this.marginWidth+" "; if(this.marginHeight!=0)string+="marginHeight="+this.marginHeight+" "; if(this.spacing!=0)string+="spacing="+this.spacing+" "; string=string.trim(); string+="}"; return string; }); });
var path = require("path"); module.exports = { entry: "./public/App.js", output: { filename: "bundle.js", path: path.resolve(__dirname, "public") } };
$(document).ready(function(){ // removing some column headers when there is at least one product if ( $('#lines tbody tr.product').length > 0 ) { $('#lines').addClass('with-product'); $('body').addClass('with-product'); } if ( $('#lines tbody tr.ticket').length > 0 ) { $('#lines').addClass('with-ticket'); $('body').addClass('with-ticket'); } window.print(); // update the parent window's content if ( window.opener != undefined && typeof window.opener.li === 'object' ) window.opener.li.initContent(); // print again if ( $('#options #print-again').length > 0 ) window.location = $('#options #print-again a').prop('href'); // close if ( $('#options #close').length > 0 && $('#options #print-again').length == 0 ) window.close(); });
'use strict'; const common = require('../common.js'); const bench = common.createBenchmark(main, { pieces: [1, 4, 16], pieceSize: [1, 16, 256], withTotalLength: [0, 1], n: [1024] }); function main(conf) { const n = +conf.n; const size = +conf.pieceSize; const pieces = +conf.pieces; const list = new Array(pieces); list.fill(Buffer.allocUnsafe(size)); const totalLength = conf.withTotalLength ? pieces * size : undefined; bench.start(); for (var i = 0; i < n * 1024; i++) { Buffer.concat(list, totalLength); } bench.end(n); }
function test() { return (function foo(){}).name === 'foo' && (function(){}).name === ''; } if (!test()) throw new Error("Test failed");