text
stringlengths
2
6.14k
// Load global config and gulp import config from '../foley.json' import gulp from 'gulp' // Specific task modules import jasmine from 'gulp-jasmine' gulp.task('jasmine', function () { return gulp.src(config.paths.spec + '**/*[sS]pec.js') // gulp-jasmine works on filepaths so you can't have any plugins before it .pipe(jasmine()) })
var fast = require('../'), underscore = require('underscore'), lodash = require('lodash'), history = require('../test/history'), utils = require('./utils'); var fns = utils.fns('item', 'return item < 1000'); var input = []; for (var i = 0; i < 1000; i++) { input.push(i); } exports['Array::every()'] = function () { return input.every(fns()); }; exports['fast.every()'] = function () { return fast.every(input, fns()); }; exports['underscore.every()'] = function () { return underscore.every(input, fns()); }; exports['lodash.every()'] = function () { return lodash.every(input, fns()); };
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: Math.LOG2E is approximately 1.4426950408889634 es5id: 15.8.1.4_A1 description: Comparing Math.LOG2E with 1.4426950408889634 includes: - math_precision.js - math_isequal.js ---*/ // CHECK#1 if (!isEqual(Math.LOG2E, 1.4426950408889634)) { $ERROR('#1: \'Math.LOG2E is not approximatley equal to 1.4426950408889634\''); }
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); const ConstDependency = require("./dependencies/ConstDependency"); const UnsupportedFeatureWarning = require("./UnsupportedFeatureWarning"); const ParserHelpers = exports; ParserHelpers.addParsedVariableToModule = function(parser, name, expression) { if(!parser.state.current.addVariable) return false; var deps = []; parser.parse(expression, { current: { addDependency: function(dep) { dep.userRequest = name; deps.push(dep); } }, module: parser.state.module }); parser.state.current.addVariable(name, expression, deps); return true; }; ParserHelpers.toConstantDependency = function toConstantDependency(value) { return function constantDependency(expr) { var dep = new ConstDependency(JSON.stringify(value), expr.range); dep.loc = expr.loc; this.state.current.addDependency(dep); return true; }; }; ParserHelpers.evaluateToString = function evaluateToString(value) { return function stringExpression(expr) { return new BasicEvaluatedExpression().setString(value).setRange(expr.range); }; }; ParserHelpers.expressionIsUnsupported = function expressionIsUnsupported(message) { return function unsupportedExpression(expr) { var dep = new ConstDependency("(void 0)", expr.range); dep.loc = expr.loc; this.state.current.addDependency(dep); if(!this.state.module) return; this.state.module.warnings.push(new UnsupportedFeatureWarning(this.state.module, message)); return true; }; };
const __NEXT_DROP_CLIENT_FILE__ = "__NEXT_DROP_CLIENT_FILE__ mock_timestamp";
import posts from 'appkit/models/posts'; var PostsRoute = Ember.Route.extend({ model: function() { return posts; } }); export default PostsRoute;
'use strict'; const Model = require('trails-model'); /** * @module Survey * @description Model describing a Survey */ module.exports = class Survey extends Model { static config (app, Sequelize) { return { options: { classMethods: { associate: (models) => { models.Survey.belongsTo(models.SurveyStatus, { foreignKey: { allowNull: false } }); models.Survey.belongsTo(models.QuestionType, { foreignKey: { allowNull: false } }); models.Survey.hasMany(models.Question, { foreignKey: { allowNull: false } }); models.Survey.belongsToMany(models.Region, {through: 'surveyregion'}); models.Survey.belongsToMany(models.Office, {through: 'surveyoffice'}); } } } }; } static schema (app, Sequelize) { return { name: { type: Sequelize.STRING, allowNull: false }, startDate: { type: Sequelize.DATE, allowNull: true }, endDate: { type: Sequelize.DATE, allowNull: true }, categorySort: { type: Sequelize.BOOLEAN, defaultValue: false }, regionLimit: { type: Sequelize.BOOLEAN, defaultValue: false } }; } };
import React from 'react'; import { Text, View, Image } from 'react-native'; import KeyboardSpacer from 'react-native-keyboard-spacer'; import Button from '../../components/Button'; import GenericTextInput, { InputWrapper } from '../../components/GenericTextInput'; import images from '../../config/images'; import styles from './styles'; const SignIn = (props) => { const { updateState, signIn, createAccount, error, confirmPasswordVisible } = props; return ( <View style={styles.container}> <View style={styles.header}> <Image style={styles.logo} source={images.logo} /> <Text style={styles.headerText}>React Native Meteor</Text> <Text style={styles.subHeaderText}>Boilerplate</Text> </View> <InputWrapper> <GenericTextInput placeholder="email address" onChangeText={(email) => updateState({ email })} /> <GenericTextInput placeholder="password" onChangeText={(password) => updateState({ password })} secureTextEntry borderTop /> {confirmPasswordVisible ? <GenericTextInput placeholder="confirm password" onChangeText={(confirmPassword) => updateState({ confirmPassword })} secureTextEntry borderTop /> : null} </InputWrapper> <View style={styles.error}> <Text style={styles.errorText}>{error}</Text> </View> <View style={styles.buttons}> <Button text="Sign In" onPress={signIn} /> <Button text="Create Account" onPress={createAccount} /> </View> <KeyboardSpacer /> </View> ); }; SignIn.propTypes = { updateState: React.PropTypes.func, signIn: React.PropTypes.func, createAccount: React.PropTypes.func, error: React.PropTypes.string, confirmPasswordVisible: React.PropTypes.bool, }; export default SignIn;
// Generated by CoffeeScript 1.6.2 var EventEmitter, Parser, ReadableTrackingBuffer, TYPE, tokenParsers, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; ReadableTrackingBuffer = require('../tracking-buffer/tracking-buffer').ReadableTrackingBuffer; EventEmitter = require('events').EventEmitter; TYPE = require('./token').TYPE; tokenParsers = {}; tokenParsers[TYPE.COLMETADATA] = require('./colmetadata-token-parser'); tokenParsers[TYPE.DONE] = require('./done-token-parser').doneParser; tokenParsers[TYPE.DONEINPROC] = require('./done-token-parser').doneInProcParser; tokenParsers[TYPE.DONEPROC] = require('./done-token-parser').doneProcParser; tokenParsers[TYPE.ENVCHANGE] = require('./env-change-token-parser'); tokenParsers[TYPE.ERROR] = require('./infoerror-token-parser').errorParser; tokenParsers[TYPE.INFO] = require('./infoerror-token-parser').infoParser; tokenParsers[TYPE.LOGINACK] = require('./loginack-token-parser'); tokenParsers[TYPE.ORDER] = require('./order-token-parser'); tokenParsers[TYPE.RETURNSTATUS] = require('./returnstatus-token-parser'); tokenParsers[TYPE.RETURNVALUE] = require('./returnvalue-token-parser'); tokenParsers[TYPE.ROW] = require('./row-token-parser'); /* Buffers are thrown at the parser (by calling addBuffer). Tokens are parsed from the buffer until there are no more tokens in the buffer, or there is just a partial token left. If there is a partial token left over, then it is kept until another buffer is added, which should contain the remainder of the partial token, along with (perhaps) more tokens. The partial token and the new buffer are concatenated, and the token parsing resumes. */ Parser = (function(_super) { __extends(Parser, _super); function Parser(debug, colMetadata, tdsVersion) { this.debug = debug; this.colMetadata = colMetadata; this.tdsVersion = tdsVersion; this.buffer = new ReadableTrackingBuffer(new Buffer(0), 'ucs2'); this.position = 0; } Parser.prototype.addBuffer = function(buffer) { this.buffer.add(buffer); this.position = this.buffer.position; while (this.nextToken()) { 'NOOP'; } return this.buffer.position = this.position; }; Parser.prototype.isEnd = function() { return this.buffer.empty(); }; Parser.prototype.nextToken = function() { var error, token, type; try { type = this.buffer.readUInt8(); if (tokenParsers[type]) { token = tokenParsers[type](this.buffer, this.colMetadata, this.tdsVersion); if (token) { this.debug.token(token); this.position = this.buffer.position; if (token.event) { this.emit(token.event, token); } switch (token.name) { case 'COLMETADATA': this.colMetadata = token.columns; } return true; } else { return false; } } else { throw new Error("Unrecognised token " + type + " at offset " + this.buffer.position); } } catch (_error) { error = _error; if ((error != null ? error.error : void 0) === 'oob') { return false; } else { throw error; } } }; return Parser; })(EventEmitter); exports.Parser = Parser;
var x = function (foo) { for (var _len = arguments.length, bar = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { bar[_key - 1] = arguments[_key]; } console.log(bar); }; var y = function (foo) { var x = function z(bar) { bar[1] = 5; }; }; var b = function (x, y) { for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } console.log(args[0]); args.pop(); console.log(args[1]); }; var z = function (foo) { for (var _len3 = arguments.length, bar = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { bar[_key3 - 1] = arguments[_key3]; } var x = function () { bar[1] = 5; }; }; var a = function (foo) { for (var _len4 = arguments.length, bar = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { bar[_key4 - 1] = arguments[_key4]; } return bar.join(","); }; var b = function (foo) { var join = "join"; for (var _len5 = arguments.length, bar = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { bar[_key5 - 1] = arguments[_key5]; } return bar[join]; }; var b = function () { for (var _len6 = arguments.length, bar = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { bar[_key6] = arguments[_key6]; } return bar.len; }; var b = function (foo) { return (arguments.length <= 1 ? 0 : arguments.length - 1) * 2; }; var b = function (foo, baz) { return arguments.length <= 2 ? 0 : arguments.length - 2; }; function x() { for (var _len7 = arguments.length, rest = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { rest[_key7] = arguments[_key7]; } rest[0] = 0; } function swap() { for (var _len8 = arguments.length, rest = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { rest[_key8] = arguments[_key8]; } var _ref = [rest[1], rest[0]]; rest[0] = _ref[0]; rest[1] = _ref[1]; } function forIn() { for (var _len9 = arguments.length, rest = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { rest[_key9] = arguments[_key9]; } for (rest[0] in this) { foo(rest[0]); } } function inc() { for (var _len10 = arguments.length, rest = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { rest[_key10] = arguments[_key10]; } ++rest[0]; } function dec() { for (var _len11 = arguments.length, rest = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { rest[_key11] = arguments[_key11]; } --rest[0]; } function del() { for (var _len12 = arguments.length, rest = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { rest[_key12] = arguments[_key12]; } delete rest[0]; } function method() { for (var _len13 = arguments.length, rest = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) { rest[_key13] = arguments[_key13]; } rest[0](); } function newExp() { for (var _len14 = arguments.length, rest = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) { rest[_key14] = arguments[_key14]; } new rest[0](); } // In addition to swap() above because at some point someone tried checking // grandparent path for isArrayExpression() to deopt. function arrayDestructure() { for (var _len15 = arguments.length, rest = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) { rest[_key15] = arguments[_key15]; } var _x = x; var _x2 = babelHelpers.slicedToArray(_x, 1); rest[0] = _x2[0]; } function forOf() { for (var _len16 = arguments.length, rest = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) { rest[_key16] = arguments[_key16]; } var _iterator = babelHelpers.createForOfIteratorHelper(this), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { rest[0] = _step.value; ; } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } } function postfixIncrement() { for (var _len17 = arguments.length, rest = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) { rest[_key17] = arguments[_key17]; } rest[0]++; } function postfixDecrement() { for (var _len18 = arguments.length, rest = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) { rest[_key18] = arguments[_key18]; } rest[0]--; }
import mockery from 'mockery' import m from 'module' import english from '../App/I18n/english.json' import {keys, replace, forEach} from 'ramda' // inject __DEV__ as it is not available when running through the tests global.__DEV__ = true // We enable mockery and leave it on. mockery.enable() // Silence the warnings when *real* modules load... this is a change from // the norm. We want to opt-in instead of opt-out because not everything // will be mocked. mockery.warnOnUnregistered(false) // Mock any libs that get called in here // I'm looking at you react-native-router-flux, reactotron etc! mockery.registerMock('reactotron-react-native', {}) mockery.registerMock('reactotron-redux', {}) mockery.registerMock('reactotron-apisauce', {}) mockery.registerMock('react-native-animatable', {View: 'Animatable.View'}) mockery.registerMock('react-native-vector-icons/Ionicons', {}) mockery.registerMock('react-native-router-flux', {Actions: {'myScreen': () => {}}, ActionConst: {RESET: 'reset'}}) // Mock i18n as it uses react native stuff // This mock returns the interpolated text from the english.json file in App/I18n // If you are not using '../App/I18n/english.json' for your I18n values, simply replace import english // with the import at the top of this file from '../App/I18n/english.json' with the I18n json file you // want to use, such as "import french from '../App/I18n/fr.json'" and set 'let value = french[key]` mockery.registerMock('react-native-i18n', { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } }) // Mock all images for React Native const originalLoader = m._load m._load = (request, parent, isMain) => { if (request.match(/.jpeg|.jpg|.png|.gif$/)) { return { uri: request } } return originalLoader(request, parent, isMain) }
'use strict' var test = require('tape') var KBucket = require('../') test('throws TypeError if contact has not property id', function (t) { t.throws(function () { (new KBucket()).add(null) }, /^TypeError: contact.id is not a Buffer$/) t.end() }) test('throws TypeError if contact.id is not a Buffer', function (t) { t.throws(function () { (new KBucket()).add({ id: 'foo' }) }, /^TypeError: contact.id is not a Buffer$/) t.end() }) test('adding a contact places it in root node', function (t) { var kBucket = new KBucket() var contact = { id: new Buffer('a') } kBucket.add(contact) t.same(kBucket.root.contacts, [ contact ]) t.end() }) test('adding an existing contact does not increase number of contacts in root node', function (t) { var kBucket = new KBucket() var contact = { id: new Buffer('a') } kBucket.add(contact) kBucket.add({ id: new Buffer('a') }) t.same(kBucket.root.contacts.length, 1) t.end() }) test('adding same contact moves it to the end of the root node (most-recently-contacted end)', function (t) { var kBucket = new KBucket() var contact = { id: new Buffer('a') } kBucket.add(contact) t.same(kBucket.root.contacts.length, 1) kBucket.add({ id: new Buffer('b') }) t.same(kBucket.root.contacts.length, 2) t.true(kBucket.root.contacts[0] === contact) // least-recently-contacted end kBucket.add(contact) t.same(kBucket.root.contacts.length, 2) t.true(kBucket.root.contacts[1] === contact) // most-recently-contacted end t.end() }) test('adding contact to bucket that can\'t be split results in calling "ping" callback', function (t) { t.plan(3 /* numberOfNodesToPing */ + 2) var kBucket = new KBucket({ localNodeId: new Buffer([ 0x00, 0x00 ]) }) kBucket.on('ping', function (contacts, replacement) { t.same(contacts.length, kBucket.numberOfNodesToPing) // console.dir(kBucket.root.right.contacts[0]) for (var i = 0; i < kBucket.numberOfNodesToPing; ++i) { // the least recently contacted end of the node should be pinged t.true(contacts[i] === kBucket.root.right.contacts[i]) } t.same(replacement, { id: new Buffer([ 0x80, j ]) }) t.end() }) for (var j = 0; j < kBucket.numberOfNodesPerKBucket + 1; ++j) { kBucket.add({ id: new Buffer([ 0x80, j ]) }) // make sure all go into "far away" node } }) test('should generate event "added" once', function (t) { t.plan(1) var kBucket = new KBucket() var contact = { id: new Buffer('a') } kBucket.on('added', function (newContact) { t.same(newContact, contact) }) kBucket.add(contact) kBucket.add(contact) t.end() }) test('should generate event "added" when adding to a split node', function (t) { t.plan(2) var kBucket = new KBucket({ localNodeId: new Buffer('') // need non-random localNodeId for deterministic splits }) for (var i = 0; i < kBucket.numberOfNodesPerKBucket + 1; ++i) { kBucket.add({ id: new Buffer('' + i) }) } t.same(kBucket.root.contacts, null) var contact = { id: new Buffer('a') } kBucket.on('added', function (newContact) { t.same(newContact, contact) }) kBucket.add(contact) t.end() })
/*global describe, it*/ 'use strict'; var assert = require('assert'); describe('XH Generator', function () { it('can be imported without blowing up', function () { var app = require('../app'); assert(app !== undefined); }); });
module.exports = { 'test' : [ 'scsslint', 'concat:test', 'mochacli', ], 'default': [ 'test', 'concat:dist', 'sassdoc' ] };
const DrawCard = require('../../drawcard.js'); class TheRedViper extends DrawCard { setupCardAbilities(ability) { this.persistentEffect({ condition: () => this.isAttacking(), match: card => card.isDefending() && card.getType() === 'character' && card.getNumberOfIcons() < 2, targetController: 'any', effect: ability.effects.doesNotContributeStrength() }); } } TheRedViper.code = '06095'; module.exports = TheRedViper;
'use strict'; // Users service used for communicating with the users REST endpoint angular.module('users').factory('Users', ['$resource', function($resource) { return $resource('users', {}, { update: { method: 'PUT' } }); } ]); angular.module('users').factory('UserPreferences', [ function () { var factory = {}; factory.getUserPreferences = function () { var userPreferences = { sources: [ { id: 'fda', name: 'FDA Drugs', chosen: true } ], searchTerms: ["Clarithromycin"] }; return userPreferences; }; return factory; } ]);
/*globals module exports resource require BObject BArray*/ /*jslint undef: true, strict: true, white: true, newcap: true, browser: true, indent: 4 */ "use strict"; /** * @memberOf cocos * @namespace */ var TMXOrientation = /** @lends cocos.TMXOrientation */{ /** * Orthogonal orientation * @constant */ TMXOrientationOrtho: 1, /** * Hexagonal orientation * @constant */ TMXOrientationHex: 2, /** * Isometric orientation * @constant */ TMXOrientationIso: 3 }; module.exports = TMXOrientation;
/** * Created by ywu on 15/7/16. */ module.exports = { //Red: '#F44336', //Pink: '#E91E63', Red: '#FF5252', Pink: '#FF4081', Purple: '#9C27B0', DeepPurple: '#67AB7', Indigo: '#3F51B5', Blue: '#2196F3', LightBlue: '#03A9F4', Cyan: '#00BCD4', Teal: '#009688', Green: '#4CAF50', LightGreen: '#8BC34A', Lime: '#CDDC39', Yellow: '#FFEB3B', Amber: '#FFC107', Orange: '#FF9800', DeepOrange: '#FF5722', Brown: '#795548', Grey: '#9E9E9E', BlueGrey: '#607D8B', Transparent: 'rgba(0,0,0,0)', Silver: '#EAEAEA', // opacity plain button background // RGB values RGBIndigo: '63,81,181', };
'use strict'; angular.module("ngLocale", [], ["$provide", function ($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu" ], "MONTH": [ "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" ], "SHORTDAY": [ "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agt", "Sep", "Okt", "Nov", "Des" ], "fullDate": "EEEE, dd MMMM yyyy", "longDate": "d MMMM yyyy", "medium": "d MMM yyyy HH:mm:ss", "mediumDate": "d MMM yyyy", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Rp", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "in", "pluralCat": function (n) { return PLURAL_CATEGORY.OTHER; } }); }]);
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; /** * The list AppCollections operation response. */ class AppCollectionListResult extends Array { /** * Create a AppCollectionListResult. * @member {string} [nextLink] When the results are paged, the nextLink is * the URI for the next page of results. This property is empty when there * are no additional pages. */ constructor() { super(); } /** * Defines the metadata of AppCollectionListResult * * @returns {object} metadata of AppCollectionListResult * */ mapper() { return { required: false, serializedName: 'AppCollectionListResult', type: { name: 'Composite', className: 'AppCollectionListResult', modelProperties: { value: { required: false, serializedName: '', type: { name: 'Sequence', element: { required: false, serializedName: 'AppCollectionElementType', type: { name: 'Composite', className: 'AppCollection' } } } }, nextLink: { required: false, serializedName: 'nextLink', type: { name: 'String' } } } } }; } } module.exports = AppCollectionListResult;
// Generated by CoffeeScript 1.8.0 (function() { module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON("package.json"), bump: { options: { part: "patch" }, files: ["package.json"] } }); grunt.loadNpmTasks("grunt-bumpx"); grunt.registerTask("git-tag", "Tags a release in git", function() { var child, done, exec, releaseVersion; exec = require("child_process").exec; done = this.async(); releaseVersion = grunt.template.process("<%= pkg.version %>"); return child = exec("git commit -am \"v" + releaseVersion + "\" ; git tag v" + releaseVersion + " && git push --tags origin master", function(error, stdout, stderr) { if (error != null) { console.log("Error running git tag: " + error); } return done(error == null); }); }); grunt.registerTask("release", ["git-tag"]); }; }).call(this);
////////////////////////////////////////////////////////////////////////////////// // // ////////////////////////////////////////////////////////////////////////////////// /** * Handle the rendering loop * * @class This class handle the rendering loop * * @param {THREE.World} world the world to display (optional) */ tQuery.Loop = function() { // internally if world present do that this._hooks = []; this._lastTime = null; }; // make it pluginable tQuery.pluginsInstanceOn(tQuery.Loop); /** * destructor */ tQuery.Loop.prototype.destroy = function() { this.stop(); } ////////////////////////////////////////////////////////////////////////////////// // // ////////////////////////////////////////////////////////////////////////////////// /** * start looping * * @returns {tQuery.Loop} chained API */ tQuery.Loop.prototype.start = function() { if( this._timerId ) this.stop(); this._timerId = requestAnimationFrame( this._onAnimationFrame.bind(this) ); // for chained API return this; } /** * stop looping * * @returns {tQuery.Loop} chained API */ tQuery.Loop.prototype.stop = function() { cancelAnimationFrame(this._timerId); this._timerId = null; // for chained API return this; } tQuery.Loop.prototype._onAnimationFrame = function() { // loop on request animation loop // - it has to be at the begining of the function // - see details at http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating this._timerId = requestAnimationFrame( this._onAnimationFrame.bind(this) ); // update time values var now = tQuery.now()/1000; if( !this._lastTime ) this._lastTime = now - 1/60; var delta = now - this._lastTime; this._lastTime = now; // run all the hooks - from lower priority to higher - in order of registration for(var priority = 0; priority <= this._hooks.length; priority++){ if( this._hooks[priority] === undefined ) continue; var callbacks = this._hooks[priority].slice(0) for(var i = 0; i < callbacks.length; i++){ callbacks[i](delta, now); } } } ////////////////////////////////////////////////////////////////////////////////// // Handle the hooks // ////////////////////////////////////////////////////////////////////////////////// tQuery.Loop.prototype.PRE_RENDER = 20; tQuery.Loop.prototype.ON_RENDER = 50; tQuery.Loop.prototype.POST_RENDER = 80; /** * hook a callback at a given priority * * @param {Number} priority for this callback * @param {Function} callback the function which will be called function(time){} * @returns {Function} the callback function. usefull for this._$callback = loop.hook(this._callback.bind(this)) * and later loop.unhook(this._$callback) */ tQuery.Loop.prototype.hook = function(priority, callback) { // handle parameters if( typeof priority === 'function' ){ callback = priority; priority = this.PRE_RENDER; } this._hooks[priority] = this._hooks[priority] || []; console.assert(this._hooks[priority].indexOf(callback) === -1) this._hooks[priority].push(callback); return callback; } /** * unhook a callback at a given priority * * @param {Number} priority for this callback * @param {Function} callback the function which will be called function(time){} * @returns {tQuery.Loop} chained API */ tQuery.Loop.prototype.unhook = function(priority, callback) { // handle parameters if( typeof priority === 'function' ){ callback = priority; priority = this.PRE_RENDER; } var index = this._hooks[priority].indexOf(callback); console.assert(index !== -1); this._hooks[priority].splice(index, 1); this._hooks[priority].length === 0 && delete this._hooks[priority] // for chained API return this; } // bunch of shortcut // - TODO should it be in a plugin ? tQuery.Loop.prototype.hookPreRender = function(callback){ return this.hook(this.PRE_RENDER, callback); }; tQuery.Loop.prototype.hookOnRender = function(callback){ return this.hook(this.ON_RENDER, callback); }; tQuery.Loop.prototype.hookPostRender = function(callback){ return this.hook(this.POST_RENDER, callback); }; tQuery.Loop.prototype.unhookPreRender = function(callback){ return this.unhook(this.PRE_RENDER, callback); }; tQuery.Loop.prototype.unhookOnRender = function(callback){ return this.unhook(this.ON_RENDER, callback); }; tQuery.Loop.prototype.unhookPostRender = function(callback){ return this.unhook(this.POST_RENDER, callback); };
export default function ({ types: t }) { let JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/; let visitor = require("babel-helper-builder-react-jsx")({ pre(state) { let tagName = state.tagName; let args = state.args; if (t.react.isCompatTag(tagName)) { args.push(t.stringLiteral(tagName)); } else { args.push(state.tagExpr); } }, post(state, pass) { state.callee = pass.get("jsxIdentifier"); } }); visitor.Program = function (path, state) { let { file } = state; let id = state.opts.pragma || "React.createElement"; for (let comment of (file.ast.comments: Array<Object>)) { let matches = JSX_ANNOTATION_REGEX.exec(comment.value); if (matches) { id = matches[1]; if (id === "React.DOM") { throw file.buildCodeFrameError(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12"); } else { break; } } } state.set("jsxIdentifier", id.split(".").map((name) => t.identifier(name)).reduce(function (object, property) { return t.memberExpression(object, property); })); }; return { inherits: require("babel-plugin-syntax-jsx"), visitor }; }
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('atari', 'assets/sprites/atari130xe.png'); } var atari; function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#2d2d2d'; atari = game.add.sprite(0, 100, 'atari'); game.physics.arcade.enable(atari); atari.body.velocity.x = 50; game.input.onDown.add(big, this); } function update() { } function big() { atari.scale.set(2); } function render() { }
/*! * Copyright 2002 - 2013 Webdetails, a Pentaho company. All rights reserved. * * This software was developed by Webdetails and is provided under the terms * of the Mozilla Public License, Version 2.0, or any later version. You may not use * this file except in compliance with the license. If you need a copy of the license, * please go to http://mozilla.org/MPL/2.0/. The Initial Developer is Webdetails. * * Software distributed under the Mozilla Public License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to * the license for the specific language governing your rights and limitations. */ /*================================================== * Default Unit *================================================== */ SimileAjax.NativeDateUnit = new Object(); SimileAjax.NativeDateUnit.makeDefaultValue = function() { return new Date(); }; SimileAjax.NativeDateUnit.cloneValue = function(v) { return new Date(v.getTime()); }; SimileAjax.NativeDateUnit.getParser = function(format) { if (typeof format == "string") { format = format.toLowerCase(); } return (format == "iso8601" || format == "iso 8601") ? SimileAjax.DateTime.parseIso8601DateTime : SimileAjax.DateTime.parseGregorianDateTime; }; SimileAjax.NativeDateUnit.parseFromObject = function(o) { return SimileAjax.DateTime.parseGregorianDateTime(o); }; SimileAjax.NativeDateUnit.toNumber = function(v) { return v.getTime(); }; SimileAjax.NativeDateUnit.fromNumber = function(n) { return new Date(n); }; SimileAjax.NativeDateUnit.compare = function(v1, v2) { var n1, n2; if (typeof v1 == "object") { n1 = v1.getTime(); } else { n1 = Number(v1); } if (typeof v2 == "object") { n2 = v2.getTime(); } else { n2 = Number(v2); } return n1 - n2; }; SimileAjax.NativeDateUnit.earlier = function(v1, v2) { return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2; }; SimileAjax.NativeDateUnit.later = function(v1, v2) { return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2; }; SimileAjax.NativeDateUnit.change = function(v, n) { return new Date(v.getTime() + n); };
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.messages = exports.ruleName = undefined; exports.default = function (actual) { return function (root, result) { var validOptions = (0, _utils.validateOptions)(result, ruleName, { actual: actual }); if (!validOptions) { return; } root.walkRules(function (rule) { // Ignore rules whose selector is just `:root` if (rule.selector.toLowerCase().trim() === ":root") { return; } rule.walkDecls(function (decl) { if (decl.prop.substr(0, 2) !== "--") { return; } (0, _utils.report)({ message: messages.rejected, node: decl, result: result, ruleName: ruleName }); }); }); }; }; var _utils = require("../../utils"); var ruleName = exports.ruleName = "custom-property-no-outside-root"; var messages = exports.messages = (0, _utils.ruleMessages)(ruleName, { rejected: "Unexpected custom property" });
$.fbuilder.controls[ 'fSectionBreak' ] = function(){}; $.extend( $.fbuilder.controls[ 'fSectionBreak' ].prototype, $.fbuilder.controls[ 'ffields' ].prototype, { title:"Section Break", ftype:"fSectionBreak", userhelp:"A description of the section goes here.", show:function() { return '<div class="fields '+this.csslayout+' section_breaks" id="field'+this.form_identifier+'-'+this.index+'"><div class="section_break" id="'+this.name+'" ></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>'; } } );
(function( $ ) {$(function() {$('.hsb_beacon_colour').wpColorPicker();});})( jQuery );
export const Util = { mix: (a, b, alpha) => { return a + (b - a) * alpha; }, isInt: (n) => { return Number(n) === n && n % 1 === 0; }, isFloat: (n) => { return n === Number(n) && n % 1 !== 0; }, clearLog: () => { const $debug = $('.debug'); $debug.html(''); }, log: function(...args) { const $debug = $('.debug'); let s = ''; for (let arg of args) { if (Util.isFloat(arg)) { arg = formatFloat(arg); } s += arg + ' '; } s += '<br/>'; $debug.append(s); }, createAttributeMatrix: function(geo, maxInstances) { geo.addAttribute( 'a_mv0', new THREE.InstancedBufferAttribute(new Float32Array(maxInstances * 4), 4, 1, true) ); geo.addAttribute( 'a_mv1', new THREE.InstancedBufferAttribute(new Float32Array(maxInstances * 4), 4, 1, true) ); geo.addAttribute( 'a_mv2', new THREE.InstancedBufferAttribute(new Float32Array(maxInstances * 4), 4, 1, true) ); geo.addAttribute( 'a_mv3', new THREE.InstancedBufferAttribute(new Float32Array(maxInstances * 4), 4, 1, true) ); }, updateAttributeMatrix: function(geo, matrix, index) { const a_mv = []; a_mv.push(geo.getAttribute('a_mv0')); a_mv.push(geo.getAttribute('a_mv1')); a_mv.push(geo.getAttribute('a_mv2')); a_mv.push(geo.getAttribute('a_mv3')); for (let k = 0; k < a_mv.length; k++) { a_mv[k].setXYZW(index, matrix.elements[k * 4 + 0], matrix.elements[k * 4 + 1], matrix.elements[k * 4 + 2], matrix.elements[k * 4 + 3]); a_mv[k].needsUpdate = true; } }, download: function(name, data) { const uri = 'data:Application/octet-stream,' + encodeURIComponent(data); const link = document.createElement("a"); link.download = name; link.href = uri; link.click(); }, };
/* * jQuery Plugin: Options Handler of the DateTime picker jQuery plugin for Admin Page Framework. * */ (function ($) { $.fn.setDateTimePickerOptions = function( sID, aOptions1 ) { if ( ! $.fn.aDateTimePickerOptions ) $.fn.aDateTimePickerOptions = {}; var sID = sID.replace( /__\d+_/, '___' ); // remove the section index. The g modifier is not used so it will replace only the first occurrence. $.fn.aDateTimePickerOptions[ sID ] = aOptions1; }; $.fn.getDateTimePickerOptions = function( sID ) { var sID = sID.replace( /__\d+_/, '___' ); // remove the section index return ( typeof $.fn.aDateTimePickerOptions[ sID ] === undefined ) ? null : $.fn.aDateTimePickerOptions[ sID ]; } }(jQuery));
var page_troubleshoot = [ [ "Diagnostic Sketch", "page__g_l_c_ddiags.html", null ] ];
/** * External dependencies */ var expect = require( 'chai' ).expect; /** * Internal dependencies */ var buildUrl = require( '../build-url' ); describe( '#buildUrl()', function() { it( 'should accept a path without existing query parameters', function() { var url = buildUrl( '/path', 'terms' ); expect( url ).to.equal( '/path?s=terms' ); } ); it( 'should return only the path, even if a full URL is passed', function() { var url = buildUrl( 'https://wordpress.com/path#hash', 'terms' ); expect( url ).to.equal( '/path?s=terms#hash' ); } ); it( 'should preserve existing query parameters', function() { var url = buildUrl( '/path?param=1', 'terms' ); expect( url ).to.equal( '/path?param=1&s=terms' ); } ); it( 'should override the previous search term', function() { var url = buildUrl( '/path?s=terms', 'newterms' ); expect( url ).to.equal( '/path?s=newterms' ); } ); it( 'should remove the previous search term if not searching', function() { var url = buildUrl( '/path?s=terms', '' ); expect( url ).to.equal( '/path' ); } ); it( 'should replace encoded spaces with `+`', function() { var url = buildUrl( '/path', 'new terms' ); expect( url ).to.equal( '/path?s=new+terms' ); } ); } );
(function ($) { /** * Attaches double-click behavior to toggle full path of Krumo elements. */ Drupal.behaviors.devel = { attach: function (context, settings) { // Add hint to footnote $('.krumo-footnote .krumo-call').once().before('<img style="vertical-align: middle;" title="Click to expand. Double-click to show path." src="' + settings.basePath + 'misc/help.png"/>'); var krumo_name = []; var krumo_type = []; function krumo_traverse(el) { krumo_name.push($(el).html()); krumo_type.push($(el).siblings('em').html().match(/\w*/)[0]); if ($(el).closest('.krumo-nest').length > 0) { krumo_traverse($(el).closest('.krumo-nest').prev().find('.krumo-name')); } } $('.krumo-child > div:first-child', context).dblclick( function(e) { if ($(this).find('> .krumo-php-path').length > 0) { // Remove path if shown. $(this).find('> .krumo-php-path').remove(); } else { // Get elements. krumo_traverse($(this).find('> a.krumo-name')); // Create path. var krumo_path_string = ''; for (var i = krumo_name.length - 1; i >= 0; --i) { // Start element. if ((krumo_name.length - 1) == i) krumo_path_string += '$' + krumo_name[i]; if (typeof krumo_name[(i-1)] !== 'undefined') { if (krumo_type[i] == 'Array') { krumo_path_string += "["; if (!/^\d*$/.test(krumo_name[(i-1)])) krumo_path_string += "'"; krumo_path_string += krumo_name[(i-1)]; if (!/^\d*$/.test(krumo_name[(i-1)])) krumo_path_string += "'"; krumo_path_string += "]"; } if (krumo_type[i] == 'Object') krumo_path_string += '->' + krumo_name[(i-1)]; } } $(this).append('<div class="krumo-php-path" style="font-family: Courier, monospace; font-weight: bold;">' + krumo_path_string + '</div>'); // Reset arrays. krumo_name = []; krumo_type = []; } } ); } }; })(jQuery); ; (function ($) { Drupal.behaviors.textarea = { attach: function (context, settings) { $('.form-textarea-wrapper.resizable', context).once('textarea', function () { var staticOffset = null; var textarea = $(this).addClass('resizable-textarea').find('textarea'); var grippie = $('<div class="grippie"></div>').mousedown(startDrag); grippie.insertAfter(textarea); function startDrag(e) { staticOffset = textarea.height() - e.pageY; textarea.css('opacity', 0.25); $(document).mousemove(performDrag).mouseup(endDrag); return false; } function performDrag(e) { textarea.height(Math.max(32, staticOffset + e.pageY) + 'px'); return false; } function endDrag(e) { $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); textarea.css('opacity', 1); } }); } }; })(jQuery); ;
/** * Cookie plugin 1.0 * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}}; ; /** * @file * Attaches behaviors for the Contextual module. */ (function ($) { Drupal.contextualLinks = Drupal.contextualLinks || {}; /** * Attaches outline behavior for regions associated with contextual links. */ Drupal.behaviors.contextualLinks = { attach: function (context) { $('div.contextual-links-wrapper', context).once('contextual-links', function () { var $wrapper = $(this); var $region = $wrapper.closest('.contextual-links-region'); var $links = $wrapper.find('ul.contextual-links'); var $trigger = $('<a class="contextual-links-trigger" href="#" />').text(Drupal.t('Configure')).click( function () { $links.stop(true, true).slideToggle(100); $wrapper.toggleClass('contextual-links-active'); return false; } ); // Attach hover behavior to trigger and ul.contextual-links. $trigger.add($links).hover( function () { $region.addClass('contextual-links-region-active'); }, function () { $region.removeClass('contextual-links-region-active'); } ); // Hide the contextual links when user clicks a link or rolls out of the .contextual-links-region. $region.bind('mouseleave click', Drupal.contextualLinks.mouseleave); $region.hover( function() { $trigger.addClass('contextual-links-trigger-active'); }, function() { $trigger.removeClass('contextual-links-trigger-active'); } ); // Prepend the trigger. $wrapper.prepend($trigger); }); } }; /** * Disables outline for the region contextual links are associated with. */ Drupal.contextualLinks.mouseleave = function () { $(this) .find('.contextual-links-active').removeClass('contextual-links-active') .find('ul.contextual-links').hide(); }; })(jQuery); ;
define(['viewcontainer', 'focusManager', 'queryString', 'connectionManager', 'events'], function (viewcontainer, focusManager, queryString, connectionManager, events) { var currentView; var dispatchPageEvents; viewcontainer.setOnBeforeChange(function (newView, isRestored, options) { var lastView = currentView; if (lastView) { var beforeHideResult = dispatchViewEvent(lastView, 'viewbeforehide', null, true); if (!beforeHideResult) { // todo: cancel } } if (!newView.initComplete) { newView.initComplete = true; var eventDetail = getViewEventDetail(newView, options, false); if (options.controllerFactory) { // Use controller method var controller = new options.controllerFactory(newView, eventDetail.detail.params); } if (!options.controllerFactory || dispatchPageEvents) { dispatchViewEvent(newView, 'viewinit'); } } dispatchViewEvent(newView, 'viewbeforeshow', isRestored); }); function onViewChange(view, options, isRestore) { var viewType = options.type; var lastView = currentView; if (lastView) { dispatchViewEvent(lastView, 'viewhide'); } currentView = view; var eventDetail = getViewEventDetail(view, options, isRestore); if (!isRestore) { if (options.autoFocus !== false) { focusManager.autoFocus(view); } } else { if (view.activeElement && document.body.contains(view.activeElement) && focusManager.isCurrentlyFocusable(view.activeElement)) { focusManager.focus(view.activeElement); } else { focusManager.autoFocus(view); } } view.dispatchEvent(new CustomEvent('viewshow', eventDetail)); if (dispatchPageEvents) { view.dispatchEvent(new CustomEvent('pageshow', eventDetail)); } } function dispatchViewEvent(view, eventName, isRestored, isCancellable) { var eventResult = view.dispatchEvent(new CustomEvent(eventName, { detail: { type: view.getAttribute('data-type'), isRestored: isRestored }, bubbles: true, cancelable: isCancellable || false })); if (dispatchPageEvents) { view.dispatchEvent(new CustomEvent(eventName.replace('view', 'page'), { detail: { type: view.getAttribute('data-type'), isRestored: isRestored }, bubbles: true, cancelable: false })); } return eventResult; } function getViewEventDetail(view, options, isRestore) { var url = options.url; var state = options.state; var index = url.indexOf('?'); var params = index == -1 ? {} : queryString.parse(url.substring(index + 1)); return { detail: { type: view.getAttribute('data-type'), params: params, isRestored: isRestore, state: options.state, // The route options options: options.options || {} }, bubbles: true, cancelable: false }; } function resetCachedViews() { // Reset all cached views whenever the skin changes viewcontainer.reset(); } document.addEventListener('skinunload', resetCachedViews); events.on(connectionManager, 'localusersignedin', resetCachedViews); events.on(connectionManager, 'localusersignedout', resetCachedViews); function tryRestoreInternal(viewcontainer, options, resolve, reject) { if (options.cancel) { return; } viewcontainer.tryRestoreView(options).then(function (view) { onViewChange(view, options, true); resolve(); }, reject); } function ViewManager() { var self = this; self.loadView = function (options) { var lastView = currentView; // Record the element that has focus if (lastView) { lastView.activeElement = document.activeElement; } if (options.cancel) { return; } viewcontainer.loadView(options).then(function (view) { onViewChange(view, options); }); }; self.tryRestoreView = function (options) { return new Promise(function (resolve, reject) { if (options.cancel) { return; } // Record the element that has focus if (currentView) { currentView.activeElement = document.activeElement; } tryRestoreInternal(viewcontainer, options, resolve, reject); }); }; self.dispatchPageEvents = function (value) { dispatchPageEvents = value; }; } return new ViewManager(); });
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.some = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ /** * array-some * Array#some ponyfill for older browsers * (Ponyfill: A polyfill that doesn't overwrite the native method) * * https://github.com/twada/array-some * * Copyright (c) 2015 Takuto Wada * Licensed under the MIT license. * http://twada.mit-license.org/ */ 'use strict'; module.exports = function some (ary, callback, thisArg) { if (ary.some) { return ary.some(callback, thisArg); } for (var i = 0; i < ary.length; i+=1) { if (callback.call(thisArg, ary[i], i, ary)) { return true; } } return false; }; },{}]},{},[1])(1) });
describe('Basic requirements of ShogunClient', function() { describe('Libraries are loaded & available in testsuite', function() { describe('ExtJS', function() { it('is defined', function() { expect(Ext).not.to.be(undefined); }); }); describe('OpenLayers', function() { it('is defined', function() { expect(ol).not.to.be(undefined); }); }); describe('GeoExt', function() { it('is defined', function() { expect(GeoExt).not.to.be(undefined); }); }); }); describe('The Ext.loader is correctly configured', function() { it('is enabled', function () { var isEnabled = Ext.Loader.getConfig('enabled'); expect(isEnabled).to.be(true); }); it('has a path configured for BasiGX', function () { var paths = Ext.Loader.getConfig('paths'); expect('BasiGX' in paths).to.be(true); expect(paths['BasiGX']).not.to.be(undefined); }); }); });
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller'; import Ember from 'ember'; import PatientSubmodule from 'hospitalrun/mixins/patient-submodule'; export default AbstractEditController.extend(PatientSubmodule, { cancelAction: 'closeModal', findPatientVisits: false, invoiceController: Ember.inject.controller('invoices'), newPayment: false, expenseAccountList: Ember.computed.alias('invoiceController.expenseAccountList'), patientList: Ember.computed.alias('invoiceController.patientList'), _finishUpdate(message, title) { this.send('closeModal'); this.displayAlert(title, message); }, currentPatient: function() { let type = this.get('model.paymentType'); if (type === 'Deposit') { return this.get('model.patient'); } else { return this.get('model.invoice.patient'); } }.property('model.patient', 'model.paymentType', 'model.invoice.patient'), title: function() { let isNew = this.get('model.isNew'); let type = this.get('model.paymentType'); if (isNew) { return `Add ${type}`; } else { return `Edit ${type}`; } }.property('model.isNew', 'model.paymentType'), selectPatient: function() { let isNew = this.get('model.isNew'); let type = this.get('model.paymentType'); return (isNew && type === 'Deposit'); }.property('model.isNew', 'model.paymentType'), beforeUpdate() { if (this.get('model.isNew')) { this.set('newPayment', true); } else { this.set('newPayment', false); } let patient = this.get('currentPatient'); this.set('model.charityPatient', patient.get('patientType') === 'Charity'); return Ember.RSVP.resolve(); }, afterUpdate() { this.get('model').save().then(function(record) { if (this.get('newPayment') === true) { let patient = this.get('currentPatient'); patient.get('payments').then(function(payments) { payments.addObject(record); patient.save().then(function() { if (record.get('paymentType') === 'Deposit') { let message = `A deposit of ${record.get('amount')} was added for patient ${patient.get('displayName')}`; this._finishUpdate(message, 'Deposit Added'); } else { let invoice = this.get('model.invoice'); invoice.addPayment(record); invoice.save().then(function() { let message = `A payment of ${record.get('amount')} was added to invoice ${invoice.get('id')}`; this._finishUpdate(message, 'Payment Added'); }.bind(this)); } }.bind(this)); }.bind(this)); } else { this.send('closeModal'); } }.bind(this)); } });
'use strict'; var nconf = require('nconf'); var async = require('async'); var S = require('string'); var user = require('../../user'); var posts = require('../../posts'); var plugins = require('../../plugins'); var meta = require('../../meta'); var accountHelpers = require('./helpers'); var helpers = require('../helpers'); var pagination = require('../../pagination'); var messaging = require('../../messaging'); var translator = require('../../translator'); var profileController = module.exports; profileController.get = function (req, res, callback) { var lowercaseSlug = req.params.userslug.toLowerCase(); if (req.params.userslug !== lowercaseSlug) { if (res.locals.isAPI) { req.params.userslug = lowercaseSlug; } else { return res.redirect(nconf.get('relative_path') + '/user/' + lowercaseSlug); } } var page = Math.max(1, parseInt(req.query.page, 10) || 1); var itemsPerPage = 10; var start = (page - 1) * itemsPerPage; var stop = start + itemsPerPage - 1; var userData; async.waterfall([ function (next) { accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, next); }, function (_userData, next) { if (!_userData) { return callback(); } userData = _userData; req.session.uids_viewed = req.session.uids_viewed || {}; if (req.uid !== parseInt(userData.uid, 10) && (!req.session.uids_viewed[userData.uid] || req.session.uids_viewed[userData.uid] < Date.now() - 3600000)) { user.incrementUserFieldBy(userData.uid, 'profileviews', 1); req.session.uids_viewed[userData.uid] = Date.now(); } async.parallel({ hasPrivateChat: function (next) { messaging.hasPrivateChat(req.uid, userData.uid, next); }, posts: function (next) { posts.getPostSummariesFromSet('uid:' + userData.theirid + ':posts', req.uid, start, stop, next); }, signature: function (next) { posts.parseSignature(userData, req.uid, next); }, aboutme: function (next) { if (userData.aboutme) { plugins.fireHook('filter:parse.aboutme', userData.aboutme, next); } else { next(); } }, }, next); }, function (results, next) { if (parseInt(meta.config['reputation:disabled'], 10) === 1) { delete userData.reputation; } userData.posts = results.posts.posts.filter(function (p) { return p && parseInt(p.deleted, 10) !== 1; }); userData.hasPrivateChat = results.hasPrivateChat; userData.aboutme = translator.escape(results.aboutme); userData.nextStart = results.posts.nextStart; userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username }]); userData.title = userData.username; var pageCount = Math.ceil(userData.postcount / itemsPerPage); userData.pagination = pagination.create(page, pageCount, req.query); if (!parseInt(userData.profileviews, 10)) { userData.profileviews = 1; } var plainAboutMe = userData.aboutme ? S(userData.aboutme).decodeHTMLEntities().stripTags().s : ''; res.locals.metaTags = [ { name: 'title', content: userData.fullname || userData.username, }, { name: 'description', content: plainAboutMe, }, { property: 'og:title', content: userData.fullname || userData.username, }, { property: 'og:description', content: plainAboutMe, }, ]; if (userData.picture) { res.locals.metaTags.push( { property: 'og:image', content: userData.picture, noEscape: true, }, { property: 'og:image:url', content: userData.picture, noEscape: true, } ); } userData.selectedGroup = userData.groups.find(function (group) { return group && group.name === userData.groupTitle; }); plugins.fireHook('filter:user.account', { userData: userData, uid: req.uid }, next); }, function (results) { res.render('account/profile', results.userData); }, ], callback); };
/** * * @author Chris Barnett * */ if (typeof OpenGeoportal === 'undefined') { OpenGeoportal = {}; } else if (typeof OpenGeoportal !== "object") { throw new Error("OpenGeoportal already exists and is not an object"); } /** * Widgets constructor this object determines how to render controls * common across the application * */ OpenGeoportal.Widgets = function Widgets() { this.template = OpenGeoportal.ogp.template; // * this.appendButton = function(parent$, buttonId, buttonLabel, clickHandler) { // var that = this; var html = this.template.genericButton({ buttonId : buttonId, buttonLabel : buttonLabel }); jQuery(html).appendTo(parent$).hide(); var button$ = jQuery("#" + buttonId); button$.button({ create : function(event, ui) { jQuery(this).show(); } }).on("click", clickHandler); return button$; }; // * * * this.prependButton = function(parent$, buttonId, buttonLabel, clickHandler) { var html = this.template.genericButton({ buttonId : buttonId, buttonLabel : buttonLabel }); jQuery(html).prependTo(parent$).hide(); var button$ = jQuery("#" + buttonId); button$.button({ create : function(event, ui) { jQuery(this).show(); } }).on("click", clickHandler); return button$; }; // * * this.genericModalDialog = function(customMessage, dialogTitle) { var divId = "genericModalDialog" + jQuery('.genericModalDialog').size(); var div = '<div id="' + divId + '" class="dialog genericModalDialog">'; div += customMessage; div += '</div>'; jQuery('#dialogs').append(div); jQuery('#' + divId).dialog({ zIndex : 2999, title : dialogTitle, resizable : true, modal : true, minWidth : 415, autoOpen : false }); return jQuery('#' + divId).dialog('open'); }; // used in geoCommonsExport.js...anywhere else? * this.dialogTemplate = function dialogTemplate(dialogDivId, dialogContent, dialogTitle, buttonsObj) { if (typeof jQuery('#' + dialogDivId)[0] === 'undefined') { var dialogDiv = '<div id="' + dialogDivId + '" class="dialog"> \n'; dialogDiv += dialogContent; dialogDiv += '</div>\n'; jQuery('#dialogs').append(dialogDiv); jQuery("#" + dialogDivId).dialog({ zIndex : 3000, autoOpen : false, width : 'auto', title : dialogTitle, resizable : true, buttons : buttonsObj }); } else { // replace dialog text/controls & open the instance of 'dialog' that // already exists jQuery("#" + dialogDivId).html(dialogContent); jQuery("#" + dialogDivId).dialog("option", "buttons", buttonsObj); } jQuery("#" + dialogDivId).dialog('open'); }; this.iframeDownload = function(iframeClass, iframeSrc) { var newIframe = this.template.iframeDownload({ iframeClass : iframeClass, iframeSrc : iframeSrc }); var iframe$ = jQuery(newIframe).appendTo('#iframes'); var timeout = 1 * 120 * 1000;// allow 2 minute for download before // iframe // is removed jQuery(document).on("iframeload", iframe$, function() { setTimeout(function() { iframe$.remove(); }, timeout); }); }; };
'use strict'; module.exports = function(spec) { var that = require('./base')(spec); spec.hubs = element.all(by.linkUiSref('hub-list')).first(); spec.contacts = element.all(by.linkUiSref('contact-list')).first(); spec.operators = element.all(by.linkUiSref('operator-list')).first(); spec.users = element.all(by.linkUiSref('user-list')).first(); spec.loginLink = $("#openLoginPrompt"); spec.logoutLink = $("#logout"); spec.isActive = function(link) { return spec.hasClasses(spec.parent(link), ['active']); }; that.toHubs = function () { return spec.hubs.click(); }; that.toContacts = function () { return spec.contacts.click(); }; that.toOperators = function () { return spec.operators.click(); }; that.toUsers = function () { return spec.users.click(); }; that.isHubsActive = function() { return spec.isActive(spec.hubs); }; that.isContactsActive = function() { return spec.isActive(spec.contacts); }; that.isOperatorsActive = function() { return spec.isActive(spec.operators); }; that.isUsersActive = function() { return spec.isActive(spec.users); }; that.openLoginModal = function() { expect(that.canLogin()).toBe(true); spec.loginLink.click(); }; that.logout = function() { expect(that.canLogout()).toBe(true); spec.logoutLink.click(); }; that.canLogout = function() { return spec.isDisplayed(spec.logoutLink); }; that.canLogin = function() { return spec.isDisplayed(spec.loginLink); }; return that; };
/* * Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting. * * Copyright (C) 2015 John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAID | DELIVER PROJECT, Task Order 4. * * This program 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. * * This program 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/>. */ services.factory('DemographicEstimateCategories', function ($resource) { return $resource('/demographic/estimate/categories.json', {}, {}); }); services.factory('DemographicEstimateCategory', function ($resource) { return $resource('/demographic/estimate/category/:id.json', {}, {}); }); services.factory('SaveDemographicEstimateCategory', function ($resource) { return $resource('/demographic/estimate/category/save.json', {}, update); }); services.factory('FacilityDemographicEstimates', function ($resource) { return $resource('/demographic/estimate/facilities.json', {}, {}); }); services.factory('SaveFacilityDemographicEstimates', function ($resource) { return $resource('/demographic/estimate/facilities.json', {}, update); }); services.factory('DistrictDemographicEstimates', function ($resource) { return $resource('/demographic/estimate/districts.json', {}, {}); }); services.factory('SaveDistrictDemographicEstimates', function ($resource) { return $resource('/demographic/estimate/districts.json', {}, update); }); services.factory('DemographicEstimatePrograms', function($resource){ return $resource('/demographics/programs.json', {}, {}); }); services.factory('UserSupervisoryRights', function($resource){ return $resource('/users/supervisory/rights.json', {},{}); }); services.factory('FinalizeFacilityDemographicEstimates', function($resource){ return $resource('/demographic/estimate/finalize/facilities.json', {}, update); }); services.factory('UndoFinalizeFacilityDemographicEstimates', function($resource){ return $resource('/demographic/estimate/undo-finalize/facilities.json', {}, update); }); services.factory('FinalizeDistrictDemographicEstimates', function($resource){ return $resource('/demographic/estimate/finalize/districts.json', {}, update); }); services.factory('UndoFinalizeDistrictDemographicEstimates', function($resource){ return $resource('/demographic/estimate/undo-finalize/districts.json', {}, update); });
// checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var Errors; (function (Errors) { var Base = (function () { function Base() { } return Base; })(); var Derived = (function (_super) { __extends(Derived, _super); function Derived() { _super.apply(this, arguments); } return Derived; })(Base); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { _super.apply(this, arguments); } return Derived2; })(Derived); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { _super.apply(this, arguments); } return OtherDerived; })(Base); var r1 = foo2(function (x) { return null; }); var r1a = [function (x) { return ['']; }, function (x) { return null; }]; var r1b = [function (x) { return null; }, function (x) { return ['']; }]; var r2arg = function (x) { return function (r) { return null; }; }; var r2arg2 = function (x) { return function (r) { return null; }; }; var r2 = foo7(r2arg); var r2a = [r2arg2, r2arg]; var r2b = [r2arg, r2arg2]; var r3arg = function (x, y) { return function (r) { return null; }; }; var r3arg2 = function (x, y) { return function (r) { return null; }; }; var r3 = foo8(r3arg); var r3a = [r3arg2, r3arg]; var r3b = [r3arg, r3arg2]; var r4arg = function () { var x = []; for (var _i = 0; _i < (arguments.length - 0); _i++) { x[_i] = arguments[_i + 0]; } return null; }; var r4arg2 = function () { var x = []; for (var _i = 0; _i < (arguments.length - 0); _i++) { x[_i] = arguments[_i + 0]; } return null; }; var r4 = foo10(r4arg); var r4a = [r4arg2, r4arg]; var r4b = [r4arg, r4arg2]; var r5arg = function (x, y) { return null; }; var r5arg2 = function (x, y) { return null; }; var r5 = foo11(r5arg); var r5a = [r5arg2, r5arg]; var r5b = [r5arg, r5arg2]; var r6arg = function (x, y) { return null; }; var r6arg2 = function (x, y) { return null; }; var r6 = foo12(r6arg); var r6a = [r6arg2, r6arg]; var r6b = [r6arg, r6arg2]; var r7arg = function (x) { return null; }; var r7arg2 = function (x) { return 1; }; var r7 = foo15(r7arg); var r7a = [r7arg2, r7arg]; var r7b = [r7arg, r7arg2]; var r7arg3 = function (x) { return 1; }; var r7c = foo15(r7arg3); var r7d = [r7arg2, r7arg3]; var r7e = [r7arg3, r7arg2]; var r8arg = function (x) { return null; }; var r8 = foo16(r8arg); var r9arg = function (x) { return null; }; var r9 = foo17(r9arg); })(Errors || (Errors = {})); var WithGenericSignaturesInBaseType; (function (WithGenericSignaturesInBaseType) { var r2arg2 = function (x) { return ['']; }; var r2 = foo2(r2arg2); var r3arg2 = function (x) { return null; }; var r3 = foo3(r3arg2); })(WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {}));
var assign = require('object-assign'); var Mixpanel = require('mixpanel'); var uuid = require('node-uuid'); var fs = require('fs'); var path = require('path'); var util = require('./Util'); var settings; try { settings = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'settings.json'), 'utf8')); } catch (err) { settings = {}; } var token = process.env.NODE_ENV === 'development' ? settings['mixpanel-dev'] : settings.mixpanel; if (!token) { token = 'none'; } var mixpanel = Mixpanel.init(token); if (localStorage.getItem('metrics.enabled') === null) { localStorage.setItem('metrics.enabled', true); } var Metrics = { enabled: function () { return localStorage.getItem('metrics.enabled') === 'true'; }, setEnabled: function (enabled) { localStorage.setItem('metrics.enabled', !!enabled); }, track: function (name, data) { data = data || {}; if (!name) { return; } if (localStorage.getItem('metrics.enabled') !== 'true') { return; } var id = localStorage.getItem('metrics.id'); if (!id) { localStorage.setItem('metrics.id', uuid.v4()); } var os; if(util.isWindows()) { os = navigator.userAgent; } else { os = navigator.userAgent.match(/Mac OS X (\d+_\d+_\d+)/)[1].replace(/_/g, '.'); } mixpanel.track(name, assign({ distinct_id: id, version: util.packagejson().version, 'Operating System Version': os, beta: !!settings.beta }, data)); }, }; module.exports = Metrics;
// The purpose of this script is to fit a first-order // harmonic model to a time series of MODSI EVI data. // The linear regression reducer is used to estimate // harmonic terms and a long-term trend in the data. // Load the input collection and select the EVI band. var c = ee.ImageCollection('MODIS/006/MOD13A1').select('EVI'); // A function to compute the independent variables (namely a // first-order Fourier model plus a linear model) based on // the scene start time extracted from the image metadata. // The linear regression reducer (below) expects to see images // with all the independent values followed by all the dependent // values. In this case, all the independent variables are // derived purely from image metadata, and thus are constant // across pixels. function addIndependentVariables(image) { // Get start time from image metadata. var date = ee.Date(image.get('system:time_start')); var phase = date.getFraction('year').multiply(2 * Math.PI); var sin = phase.sin(); var cos = phase.cos(); var time = date.difference(ee.Date('2000-01-01'), 'year'); // Assemble the four independent variables as image bands. var independent = ee.Image([sin, cos, time, 1]).double(); // Add 'EVI' from the input image as the last band. return independent.addBands(image); } // Perform the linear regression, which returns an array-valued // image, and then expand that back out to a four-band image // for later convenience. var regression = c.map(addIndependentVariables) // Reduce the collection. .reduce(ee.Reducer.linearRegression(4)) // Select the coefficients (array) band from the output. .select('coefficients') // 2D -> 1D by keeping the 0-axis. .arrayProject([0]) // 1D -> multi-band image; supply band names with a list. .arrayFlatten([['sin', 'cos', 'slope', 'offset']]) // Scale the result. .divide(10000); // Pull out the three bands we're going to visualize. var sin = regression.select('sin'); var cos = regression.select('cos'); var slope = regression.select('slope'); var offset = regression.select('offset'); // Do some math to turn the first-order Fourier model into // hue, saturation, and value in the range[0,1]. var sat = cos.hypot(sin).multiply(2.5); var hue = sin.atan2(cos).unitScale(-Math.PI, Math.PI); var val = offset.multiply(1.5); // Make a background of dark blue, for cartographic effect. var background = ee.Image(1).visualize({palette: '000022'}); Map.addLayer(background, {}, 'background'); // Turn the HSV data into an RGB image and add it to the map. var seasonality = ee.Image.cat(hue, sat, val).hsvToRgb(); Map.addLayer(seasonality, {}, 'Seasonality'); // Display decreasing EVI in red, increasing in blue and offset in green. var trendVis = { bands: ['slope', 'offset', 'slope'], min: 0, max: [-0.005, 1, 0.005] }; Map.addLayer(regression, trendVis, 'Trend'); // Visualize the images as they look on screen: var seasonalityExportImage = ee.ImageCollection([ background, seasonality.multiply(255).byte().rename(['vis-red', 'vis-green', 'vis-blue']) ]).mosaic(); var trendExportImage = ee.ImageCollection([ background, regression.visualize(trendVis) ]).mosaic(); // Export with maps Mercator projection at 10 km scale. var exportRegion = ee.Geometry.Rectangle([-180, -70, 180, 79], null, false); var exportParams = {scale: 10000, region: exportRegion, crs: 'EPSG:3857'}; Export.image(seasonalityExportImage, 'Global_pheno', exportParams); Export.image(trendExportImage, 'Global_trend', exportParams);
var id = "d9"; // Replace with reporting mechanism function hook(id, result, message){}; if (document.title === "PASS") hook(id, "pass"); else if (document.title === "FAIL") hook(id, "fail", "Test "+id+" failed");
//// [interfaceClassMerging2.ts] interface Foo { interfaceFooMethod(): this; interfaceFooProperty: this; } class Foo { classFooProperty: this; classFooMethod(): this { return this; } } interface Bar { interfaceBarMethod(): this; interfaceBarProperty: this; } class Bar extends Foo { classBarProperty: this; classBarMethod(): this { return this; } } var bar = new Bar(); bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod(); var foo = new Foo(); foo = bar; //// [interfaceClassMerging2.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Foo = (function () { function Foo() { } Foo.prototype.classFooMethod = function () { return this; }; return Foo; }()); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { return _super.apply(this, arguments) || this; } Bar.prototype.classBarMethod = function () { return this; }; return Bar; }(Foo)); var bar = new Bar(); bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod(); var foo = new Foo(); foo = bar;
// Karma configuration // Generated on Sat Oct 25 2014 17:11:56 GMT-0200 (BRST) var dotenv = require('dotenv'); var exec = require('child_process').exec; exec('node bin/hook.js'); dotenv.load(); module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['browserify', 'traceur', 'mocha', 'sinon-chai'], // list of files / patterns to load in the browser files: [ 'node_modules/underscore/underscore-min.js', 'node_modules/clappr/dist/clappr.js', 'test/**/*spec.js' ], // list of files to exclude exclude: [ ], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { './index.js': ['traceur'], 'src/**/*.js': ['traceur'], 'test/**/*.js': ['traceur', 'browserify'] }, traceurPreprocessor: { options: { sourceMap: true } }, browserify: { debug: true, transform: ['es6ify'], prebundle: function(bundle) { bundle.external('base_object'); bundle.external('underscore'); }, }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in the output (reporters and logs) colors: true, // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['Chrome'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); };
/** * 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 Ember from 'ember'; import { moduleForComponent, test } from 'ember-qunit'; moduleForComponent('progress-widget', 'ProgressWidgetComponent', { unit: true }); test('Percentage is updated on value change', function() { var component = this.subject({ value: 0 }); this.$(); equal(component.get('percentage'), '0%', 'Progress is at 0%'); Ember.run(function() { component.set('value', 50); }); equal(component.get('percentage'), '50%', 'Progress is at 50%'); });
/** * Created by Julian/Wolke on 07.11.2016. */ let Command = require('../../structures/command'); let argParser = require('../../structures/argumentParser'); let AsciiTable = require('ascii-table'); class GetPermission extends Command { constructor({t, mod}) { super(); this.cmd = 'gp'; this.cat = 'permission'; this.needGuild = true; this.t = t; this.accessLevel = 0; this.p = mod.getMod('pm'); //TODO add option for users to view all perms that affect them in the current channel, optionally allow select channel/user } run(msg) { let messageSplit = msg.content.split(' ').splice(1); let args = argParser.parse(messageSplit, {boolean: ['r', 'c', 'u']}); let start = this.parseStart(args); if (args.r) { this.getPerms(msg, 'role', start); } else if (args.c) { this.getPerms(msg, 'channel', start); } else if (args.u) { this.getPerms(msg, 'user', start); } else { this.getPerms(msg, 'guild', start); } } parseStart(args) { if (args._.length > 0) { try { let start = parseInt(args._[0]); if (isNaN(start) || start < 1) { return 0; } return start - 1; } catch (e) { return 0; } } else { return 0; } } async getPerms(msg, type, start) { let Perms; try { Perms = await this.p.getPermDB(msg); } catch (e) { if (e.t) { return msg.channel.createMessage(this.t(e.t, {lngs: msg.lang})); } return msg.channel.createMessage(this.t('generic.error', {lngs: msg.lang})); } let table = new AsciiTable(); table.setHeading(this.t('gp.table.id', {lngs: msg.lang}), this.t('gp.table.id', {lngs: msg.lang}), this.t('gp.table.name', {lngs: msg.lang}), this.t('gp.table.type', {lngs: msg.lang}), this.t('gp.table.cat', {lngs: msg.lang}), this.t('gp.table.perm', {lngs: msg.lang}), this.t('gp.table.use', {lngs: msg.lang})); let filteredPerms = Perms.filter((val) => val.type === type); if (filteredPerms.length === 0) { return msg.channel.createMessage(this.t('gp.no-cat', {lngs: msg.lang, cat: type})); } if (filteredPerms.length / 8 <= start) { return msg.channel.createMessage(this.t('gp.page-does-not-exist', {lngs: msg.lang})); } for (let i = start * 8; i < filteredPerms.length; i++) { if (filteredPerms[i].type === 'channel') { let channel = rem.getChannel(filteredPerms[i].id); let name = channel ? channel.name : 'deleted'; name = name.length > 50 ? name.substring(0, 50) + '...' : name; table.addRow(i + 1, filteredPerms[i].id, name, filteredPerms[i].type, filteredPerms[i].cat, filteredPerms[i].perm, filteredPerms[i].use); } else if (filteredPerms[i].type === 'user') { let user = rem.users.find(u => u.id === filteredPerms[i].id); table.addRow(i + 1, filteredPerms[i].id, user ? `${user.username}#${user.discriminator}` : 'deleted', filteredPerms[i].type, filteredPerms[i].cat, filteredPerms[i].perm, filteredPerms[i].use); } else if (filteredPerms[i].type === 'role') { let role = msg.channel.guild.roles.find(r => r.id === filteredPerms[i].id); table.addRow(i + 1, filteredPerms[i].id, role ? role.name : 'deleted', filteredPerms[i].type, filteredPerms[i].cat, filteredPerms[i].perm, filteredPerms[i].use); } else { table.addRow(i + 1, filteredPerms[i].id, 'Guild', filteredPerms[i].type, filteredPerms[i].cat, filteredPerms[i].perm, filteredPerms[i].use); } if (i === start * 8 + 7) break; } let tableString = '```' + table.toString() + '```'; // console.log(tableString.length); // console.log(tableString); tableString = (filteredPerms.length > 8 ? `${this.t('generic.page', {lngs: msg.lang})}: [${start + 1}/${Math.floor((filteredPerms.length / 8) - 0.01) + 1}]` : '') + tableString; msg.channel.createMessage(tableString); } } module.exports = GetPermission;
/* * Copyright 2016 The Closure Compiler Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'require util/checkstringargs util/polyfill'; $jscomp.polyfill('String.prototype.codePointAt', function(orig) { if (orig) return orig; /** * Returns the UTF-16 codepoint at the given index. * * <p>Polyfills the instance method String.prototype.codePointAt(). * * @this {string} * @param {number} position * @return {number|undefined} The codepoint. */ var polyfill = function(position) { // NOTE: this is taken from v8's harmony-string.js StringCodePointAt 'use strict'; var string = $jscomp.checkStringArgs(this, null, 'codePointAt'); var size = string.length; // Make 'position' a number (non-number coerced to NaN and then or to zero). position = Number(position) || 0; if (!(position >= 0 && position < size)) { return void 0; } // Truncate 'position' to an integer. position = position | 0; var first = string.charCodeAt(position); if (first < 0xD800 || first > 0xDBFF || position + 1 === size) { return first; } var second = string.charCodeAt(position + 1); if (second < 0xDC00 || second > 0xDFFF) { return first; } return (first - 0xD800) * 0x400 + second + 0x2400; }; return polyfill; }, 'es6-impl', 'es3');
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-pan`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'pan'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000000" strokeWidth="2" d="M8.5,5.5 L12,2 L15.5,5.5 M22,12 L2,12 M5.5,8.5 L2,12 L5.5,15.5 M18.5,15.5 L22,12 L18.5,8.5 M12,22 L12,2 M8.5,18.5 L12,22 L15.5,18.5"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Pan'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
/** * Copyright 2015 Workfront * * 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. */ /** * @author Hovhannes Babayan <bhovhannes at gmail dot com> * @author Sassoun Derderian <citizen.sas at gmail dot com> */ var Api = require('./Api'), _instance; /** * @name ApiFactory * @memberOf Workfront * @namespace */ module.exports = { /** * Returns an Api instance. Creates a new one if no instance exists.<br/> * One can use this if Api is intended to be used as singleton. * @memberOf Workfront.ApiFactory * @param {Object} config An object with the following keys:<br/> * <code>url</code> {String} - Required. An url to Workfront server (for example: http://localhost:8080)<br/> * <code>version</code> {String} - Optional. Which version of api to use. At the moment of writing can be 1.0, 2.0, 3.0, 4.0. Pass 'internal' to use Workfront internal API (this is the latest version, maybe unstable) * @param {Boolean} [returnNewInstance] If true, always creates a new instance * @return {Api} */ getInstance: function(config, returnNewInstance) { if (returnNewInstance) { return new Api(config); } else { if (!_instance) { if (typeof config !== 'object') { throw new Error('Please provide configuration as an object.'); } _instance = new Api(config); } return _instance; } }, /** * Removes previously created Api instance. * @memberOf Workfront.ApiFactory */ deleteInstance: function() { _instance = undefined; } };
import {useCallback, useLayoutEffect} from '#preact'; import {useAmpContext} from './context'; /** * Notifies Resources (if present) of a rerender in the component. * Every functional component **must** use this helper. */ export function useResourcesNotify() { const {notify} = useAmpContext(); useLayoutEffect(() => { if (notify) { notify(); } }); } /** * @param {{current: ?}|function()} ref * @param {!Element} value */ function setRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref) { ref.current = value; } } /** * Combines refs to pass into `ref` prop. * @param {!Array<*>} refs * @return {function(Element):function()} */ export function useMergeRefs(refs) { return useCallback( (element) => { for (let i = 0; i < refs.length; i++) { setRef(refs[i], element); } }, // refs is an array, but ESLint cannot statically verify it // eslint-disable-next-line react-hooks/exhaustive-deps refs ); }
/*! * Bootstrap-select v1.12.2 (http://silviomoreto.github.io/bootstrap-select) * * Copyright (c) 2013-2015 bootstrap-select * * 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. */ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){a.fn.selectpicker.defaults={noneSelectedText:"Hiçbiri seçilmedi",noneResultsText:"Hiçbir sonuç bulunamadı {0}",countSelectedText:function(a,b){return"{0} öğe seçildi"},maxOptionsText:function(a,b){return[1==a?"Limit aşıldı (maksimum {n} sayıda öğe )":"Limit aşıldı (maksimum {n} sayıda öğe)","Grup limiti aşıldı (maksimum {n} sayıda öğe)"]},selectAllText:"Tümünü Seç",deselectAllText:"Seçiniz",multipleSeparator:", "}}(a)});
// Copyright 2014 Samsung Electronics Co., Ltd. // // 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. assert(Number.hasOwnProperty("NEGATIVE_INFINITY"));
// Farsi jQuery.extend( jQuery.fn.pickadate.defaults, { monthsFull: [ 'ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], monthsShort: [ 'ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر' ], weekdaysFull: [ 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه' ], weekdaysShort: [ 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه' ], today: 'امروز', clear: 'پاک کردن', close: 'بستن', format: 'yyyy mmmm dd', formatSubmit: 'yyyy/mm/dd', labelMonthNext: 'ماه بعدی', labelMonthPrev: 'ماه قبلی' });
/// 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.4.4.22-9-c-i-21", path: "TestCases/chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-9-c-i-21.js", description: "Array.prototype.reduceRight - element to be retrieved is inherited accessor property without a get function on an Array-like object", test: function testcase() { var testResult = false; function callbackfn(prevVal, curVal, idx, obj) { if (idx === 1) { testResult = (typeof curVal === "undefined"); } } var proto = { 0: 0, 2: 2 }; Object.defineProperty(proto, "1", { set: function () { }, configurable: true }); var Con = function () { }; Con.prototype = proto; var child = new Con(); child.length = 3; Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); return testResult; }, precondition: function prereq() { return fnExists(Array.prototype.reduceRight) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects(); } });
/// 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.4.4.21-4-15", path: "TestCases/chapter15/15.4/15.4.4/15.4.4.21/15.4.4.21-4-15.js", description: "Array.prototype.reduce - calling with no callbackfn is the same as passing undefined for callbackfn", test: function testcase() { var obj = { 10: 10 }; var lengthAccessed = false; var loopAccessed = false; Object.defineProperty(obj, "length", { get: function () { lengthAccessed = true; return 20; }, configurable: true }); Object.defineProperty(obj, "0", { get: function () { loopAccessed = true; return 10; }, configurable: true }); try { Array.prototype.reduce.call(obj); return false; } catch (ex) { return (ex instanceof TypeError) && lengthAccessed && !loopAccessed; } }, precondition: function prereq() { return fnExists(Array.prototype.reduce) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects(); } });
/*! * OS.js - JavaScript Operating System * * Copyright (c) 2011-2015, Anders Evenrud <andersevenrud@gmail.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. 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. * * 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. * * @author Anders Evenrud <andersevenrud@gmail.com> * @licence Simplified BSD License */ (function(API, Utils, VFS) { 'use strict'; window.OSjs = window.OSjs || {}; OSjs.Core = OSjs.Core || {}; ///////////////////////////////////////////////////////////////////////////// // DEMO STORAGE ///////////////////////////////////////////////////////////////////////////// /** * Storage */ var DefaultStorage = function() { if ( !OSjs.Compability.localStorage ) { throw new Error('Your browser does not support localStorage :('); } this.prefix = 'OS.js-v2/DemoHandler/'; }; DefaultStorage.prototype.set = function(o) { console.debug('DefaultStorage::set()', o); for ( var i in o ) { if ( o.hasOwnProperty(i) ) { localStorage.setItem(this.prefix + i, JSON.stringify(o[i])); } } }; DefaultStorage.prototype.get = function() { var ret = {}; for ( var i in localStorage ) { if ( localStorage.hasOwnProperty(i) ) { if ( i.indexOf(this.prefix) === 0 ) { ret[i.replace(this.prefix, '')] = JSON.parse(localStorage[i]) || null; } } } return ret; }; ///////////////////////////////////////////////////////////////////////////// // DEMO HANDLER ///////////////////////////////////////////////////////////////////////////// /** * Demo handler - Uses localStorage for sessions, for testing purposes */ var DemoHandler = function() { OSjs.Core._Handler.apply(this, arguments); this.storage = new DefaultStorage(); }; DemoHandler.prototype = Object.create(OSjs.Core._Handler.prototype); /** * Demo initialization */ DemoHandler.prototype.init = function(callback) { console.info('OSjs::DemoHandler::init()'); if ( window.location.href.match(/^file\:\/\//) ) { callback({ id: 0, username: 'demo', name: 'Local Server', groups: ['demo'] }); } // Use the 'demo' user var self = this; this.login('demo', 'demo', function(userData) { self.settings.load(self.storage.get()); // IMPORTANT self.onLogin(userData, function() { callback(); }); }); }; /** * Demo login. Just an example */ DemoHandler.prototype.login = function(username, password, callback) { console.info('OSjs::DemoHandler::login()', username); var opts = {username: username, password: password}; this.callAPI('login', opts, function(response) { if ( response.result ) { // This contains an object with user data callback(response.result); } else { callback(false, response.error ? ('Error while logging in: ' + response.error) : 'Invalid login'); } }, function(error) { callback(false, 'Login error: ' + error); }); }; DemoHandler.prototype.saveSettings = function(callback) { var settings = this.settings.get(); console.debug('OSjs::Handlers::DemoHandler::saveSettings()', settings); this.storage.set(settings); callback.call(this, true); }; // // Exports // OSjs.Core.Handler = DemoHandler; })(OSjs.API, OSjs.Utils, OSjs.VFS);
// This file was procedurally generated from the following sources: // - src/async-generators/yield-spread-obj.case // - src/async-generators/default/async-class-expr-static-method.template /*--- description: Use yield value in a object spread position (Static async generator method as a ClassExpression element) esid: prod-AsyncGeneratorMethod features: [object-spread, async-iteration] flags: [generated, async] includes: [compareArray.js] info: | ClassElement : static MethodDefinition MethodDefinition : AsyncGeneratorMethod Async Generator Function Definitions AsyncGeneratorMethod : async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } Spread Properties PropertyDefinition[Yield]: (...) ...AssignmentExpression[In, ?Yield] ---*/ var callCount = 0; var C = class { static async *gen() { callCount += 1; yield { ...yield, y: 1, ...yield yield, }; }} var gen = C.gen; var iter = gen(); iter.next(); iter.next({ x: 42 }); iter.next({ x: 'lol' }); var item = iter.next({ y: 39 }); item.then(({ done, value }) => { assert.sameValue(value.x, 42); assert.sameValue(value.y, 39); assert.sameValue(Object.keys(value).length, 2); assert.sameValue(done, false); }).then($DONE, $DONE); assert.sameValue(callCount, 1);
Vaultier.PasswordFieldComponent = Ember.Component.extend({ layoutName: 'Layout/PasswordField', actions: { generatePassword: function() { var randomPassword = Utils.Security.generatePassword(); this.set('value',randomPassword); } } });
var _ = require('underscore'); var cdb = require('cartodb.js'); /** * View for an individual access toggler. */ module.exports = cdb.core.View.extend({ tagName: 'span', events: { 'mouseover .js-toggler.is-disabled': '_onHoverDisabledToggler', 'mouseout .js-toggler': '_closeTooltip', 'mouseleave .js-toggler': '_closeTooltip', 'change .js-input': '_onChangeInput' }, initialize: function() { _.each(['model', 'permission', 'hasAccess', 'canChangeAccess', 'toggleAccess', 'label'], function(name) { if (_.isUndefined(this.options[name])) throw new Error(name + ' is required'); }, this); }, render: function() { this.clearSubViews(); this.$el.html( cdb.templates.getTemplate('common/dialogs/change_privacy/share/permission_toggler')({ cid: this.cid, hasAccess: this.options.hasAccess(), canChangeAccess: this.options.canChangeAccess(), label: this.options.label }) ); return this; }, _onChangeInput: function() { this.options.toggleAccess(); }, _onHoverDisabledToggler: function(ev) { var aclItem = this.options.permission.findRepresentableAclItem(this.model); if (!aclItem.isOwn(this.model)) { this._tooltipView().showTipsy(); } }, _closeTooltip: function() { this._tooltipView().hideTipsy(); }, _tooltipView: function(el) { if (!this._tooltip) { this._tooltip = this._newTooltipView(); this.addView(this._tooltip); } return this._tooltip; }, _newTooltipView: function(el) { return new cdb.common.TipsyTooltip({ el: this.$('.js-toggler'), trigger: 'manual', title: this._inheritedAccessTooltipText.bind(this) }); }, _inheritedAccessTooltipText: function() { var aclItem = this.options.permission.findRepresentableAclItem(this.model); var type = aclItem.get('type'); switch(type) { case 'group': return 'Access is inherited from group ' + aclItem.get('entity').get('name'); case 'org': return 'Access is inherited from organization'; default: cdb.log.error('Trying to display inherited access for an unrecognized type ' + type) return '' } } });
describe("", function () { var rootEl; beforeEach(function () { rootEl = browser.rootEl; browser.get("build/docs/examples/example-ngModelOptions-directive-blur/index.html"); }); var model = element(by.binding('user.name')); var input = element(by.model('user.name')); var other = element(by.model('user.data')); it('should allow custom events', function () { input.sendKeys(' Doe'); input.click(); expect(model.getText()).toEqual('John'); other.click(); expect(model.getText()).toEqual('John Doe'); }); it('should $rollbackViewValue when model changes', function () { input.sendKeys(' Doe'); expect(input.getAttribute('value')).toEqual('John Doe'); input.sendKeys(protractor.Key.ESCAPE); expect(input.getAttribute('value')).toEqual('John'); other.click(); expect(model.getText()).toEqual('John'); }); });
function showResourceVersion(form) { var url=$('resource_versions').value; location.href=url; form.submit; } function showCompareVersions(form) { var url=$('compare_versions').value; location.href=url; form.submit; } // *************** Resource Upload Validation ***************** function validateResourceFields(is_new_file, resource_name, is_managed) { // only make this test if that's a new SOP if(is_new_file) { var respond_to_content_blobs = resource_name=='model' ? true :false; if (!validateUploadFormFields(respond_to_content_blobs, resource_name)) return (false); } // other tests are applicable to both editing and creating new SOP if($(resource_name + '_title').value.length == 0) { alert("Please specify the title!"); $(resource_name + '_title').focus(); return(false); } if (is_managed){ if (!checkProjectExists(resource_name)) { return (false); } // check if no tokens remain in the attributions autocompleter // (only do this if the fold with attributions is expanded) if($('attributions_fold_content').style.display == "block" && autocompleters[attributions_autocompleter_id].getRecognizedSelectedIDs() != "") { alert('You didn\'t press "Add" link to add items in the attributions autocomplete field.'); $('attributions_autocomplete_input').focus(); return(false); } clickLink($('preview_permission')); } else{ // filename and title set - can submit $(resource_name + '_submit_btn').disabled = true; $(resource_name + '_submit_btn').value = (is_new_file==true ? "Creating..." : "Updating..."); $(resource_name + '_submit_btn').form.submit(); } } function addTempLink(){ $('new_temporary_link_form').show(); $('new_temporary_link_form').select('.hidden_destroy_field')[0].setValue('false'); $("add_a_temporary_link").hide(); $('temp_link').select(); } function checkProjectExists(prefix) { el=prefix+"_project_ids"; if ($F(el).length < 1) { alert("Please specify at least one project"); return (false); } return(true); } function flipSaveEnable(){ if ($('redbox_workflow_submit_btn').hidden == true) { $('redbox_workflow_submit_btn').hidden = false; } else { $('redbox_workflow_submit_btn').hidden = true; } } function createOrUpdateResourceInRedBox(is_new_file, resource_name){ // filename and title set - can submit $('redbox_workflow_submit_btn').disabled = true; $('redbox_workflow_submit_btn').value = (is_new_file=='true' ? "Creating..." : "Updating..."); var form0 = $('redbox_workflow_submit_btn').form; form0.submit(); RedBox.close(); } function createOrUpdateResource(is_new_file, resource_name){ // filename and title set - can submit $(resource_name + '_submit_btn').disabled = true; $(resource_name + '_submit_btn').value = (is_new_file=='true' ? "Creating..." : "Updating..."); $(resource_name + '_submit_btn').form.submit(); RedBox.close(); } function validateUploadFormFields(respond_to_content_blobs, resource_name) { if (respond_to_content_blobs) { if ($('pending_files').children.length == 0 && $(resource_name + "_image_image_file") == null) { alert("Please specify at least a file to upload or provide a URL."); return (false); } else if ($('pending_files').children.length == 0 && $(resource_name + "_image_image_file") != null && $(resource_name + "_image_image_file").value == '' && $('previous_version_image') == null) { alert("Please specify at least a file/image to upload or provide a URL."); return (false); } } else { if ($(resource_name + '_data').value.length == 0 && $(resource_name + '_data_url').value.length == 0) { alert("Please specify at least a file to upload or provide a URL."); $(resource_name + '_data').focus(); return (false); } } return (true); } function validateUploadNewVersion(respond_to_content_blobs, resource_name){ if (!validateUploadFormFields(respond_to_content_blobs, resource_name)) return (false); $('new_version_submit_btn').disabled = true; $('new_version_submit_btn').value = "Uploading ..."; $('new_version_submit_btn').form.submit(); return (true); }
/* * COPY: Copy files and folders */ module.exports = { /* * TARGET: Copies fonts */ installFonts: { files: [{ expand: true, flatten: true, src: [ '<%= path.src.npm %>/font-awesome/fonts/*' ], filter: 'isFile', dest: '<%= path.dest.fonts %>/' }, { expand: true, flatten: true, cwd: '<%= path.src.npm %>/source-sans-pro', src: 'WOFF?(2)/OTF/SourceSansPro-@(It|Regular|Semibold).otf.woff?(2)', dest: '<%= path.dest.fonts %>', rename: function (dest, src) { "use strict"; return dest + '/' + src.replace(/\.otf(\.woff2?)$/, '$1'); } }] }, /* * TARGET: Copies CKEditor files */ installCkeditor1: { files: [ { // Copy all CKEditor files expand: true, cwd: '<%= path.src.lib %>/ckeditor', src: [ 'plugins/**', 'skins/**', 'styles.js' ], dest: '<%= path.dest.js %>/ckeditor' }, { // Copy our empty config file src: '<%= path.src.js %>/ckeditor-config.js', dest: '<%= path.dest.js %>/ckeditor/config.js' }, { // Copy style to css folder src: '<%= path.src.lib %>/ckeditor/contents.css', dest: '<%= path.dest.css %>/ckeditor-contents.css' }, { // Copy CKEditor locale expand: true, flatten: true, src: '<%= path.src.lib %>/ckeditor/lang/*.js', dest: '<%= path.dest.js %>/locale/ckeditor' } ] }, /* * TARGET: Copies modified ckeditor.js */ installCkeditor2: { // process doesn't work on file level, so we need a new target src: '<%= path.src.lib %>/ckeditor/ckeditor.js', dest: '<%= path.dest.js %>/ckeditor/ckeditor.js', options: { process: function (cont) { 'use strict'; return cont.replace(/(CKEDITOR\.getUrl\()"lang\/"(\+a\+"\.js"\))/, '$1"../locale/ckeditor/"$2'); } } }, };
'use strict'; var React = require('react'); module.exports = React.createClass({ displayName: 'Area', propTypes: { path: React.PropTypes.string, fill: React.PropTypes.string }, getDefaultProps:function() { return { fill: '#3182bd' }; }, render:function() { return ( React.createElement("path", { className: "rd3-areachart-area", d: this.props.path, fill: this.props.fill, onMouseOver: this.props.handleMouseOver, onMouseLeave: this.props.handleMouseLeave} ) ); } });
define(['pex/fx/FXStage', 'lib/text!pex/fx/FXAA.glsl'], function(FXStage, FXAAGLSL) { FXStage.prototype.fxaa = function(options) { options = options || {}; var outputSize = this.getOutputSize(options.width, options.height); var rt = this.getRenderTarget(outputSize.width, outputSize.height, options.depth, options.bpp); rt.bind(); var source = this.getSourceTexture(); source.bind(); var program = this.getShader(FXAAGLSL); program.use(); program.uniforms.rtWidth(source.width); program.uniforms.rtHeight(source.height); this.drawFullScreenQuad(outputSize.width, outputSize.height, null, program); rt.unbind(); return this.asFXStage(rt, 'fxaa'); } })
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- WScript.LoadScriptFile("util.js"); function oneTest(a) { a[1] = 0.54; a[5] = 10; WScript.Echo(a[5]); if (Object.getOwnPropertyDescriptor(a, 100000) != undefined) { WScript.Echo('FAIL'); } try { var pro = Float32Array.prototype; WScript.Echo(pro.toString()); WScript.Echo("prototype is"); printObj(pro); } catch(e) { WScript.Echo("constructor is"); printObj(Float32Array); } WScript.Echo("object is"); printObj(a); a[20] =20; a.foo ='bar'; WScript.Echo("object after expando is"); printObj(a); WScript.Echo(""); } WScript.Echo("test1"); var test1 = new Float32Array(9); oneTest(test1); WScript.Echo("test2"); var test2 = new Float32Array(0); oneTest(test2); WScript.Echo("test3"); var arrayBuffer = new ArrayBuffer(32); var test3 = new Float32Array(arrayBuffer); oneTest(test3); WScript.Echo("test4"); var test4 = new Float32Array(arrayBuffer, 4); oneTest(test4); WScript.Echo("test5"); var test5 = new Float32Array(arrayBuffer, 4, 6); oneTest(test5); WScript.Echo("test6"); var mybuffer = test1.buffer; WScript.Echo(mybuffer); var test6 = new Float32Array(mybuffer); oneTest(test6); WScript.Echo("test7"); var test7 = new Float32Array(test1.buffer, 4); oneTest(test7); WScript.Echo("test8"); var test8 = new Float32Array(test1.buffer, 4, 6); oneTest(test8); var arr = [1,2,3,4,5,6,7,8,9,10,11,12]; WScript.Echo("test9"); var test9 = new Float32Array(arr); oneTest(test9); WScript.Echo("test9.1"); printObj(test1); test9.set(test1); oneTest(test9); WScript.Echo("test9.2"); test9.set(test5); oneTest(test9); WScript.Echo("test10"); var test10 = new Float32Array({}); oneTest(test10); WScript.Echo("test11"); var test11 = new Float32Array('abcdefg'); oneTest(test11); WScript.Echo("test11.1"); var test111 = new Float32Array(new String('abcdefg')); oneTest(test111); WScript.Echo("test12"); var test12 = new Float32Array(0); oneTest(test12); WScript.Echo("test13"); var test13 = new Float32Array(arrayBuffer, 0); oneTest(test13); WScript.Echo("test14"); try { var test14 = new Float32Array(arrayBuffer, 0, 0); oneTest(test14); } catch(e) { WScript.Echo("succeed with catching" + e); } WScript.Echo("test15"); try { var test15 = new Float32Array(arrayBuffer, 0, 40); oneTest(test15); } catch(e) { WScript.Echo("succeed with catching" + e); } WScript.Echo("test16"); try { var test16 = new Float32Array(arrayBuffer, 40, 4); oneTest(test16); } catch(e) { WScript.Echo("succeed with catching" + e); } printObj(test5); WScript.Echo("test17"); var test17 = test5.subarray(0); printObj(test17); WScript.Echo("test18"); var test18 = test5.subarray(4); printObj(test18); WScript.Echo("test19"); var test19 = test5.subarray(0, 3); printObj(test19); WScript.Echo("test20"); WScript.Echo(Float32Array.prototype[10]); WScript.Echo(Float32Array.prototype[-1]); WScript.Echo(Float32Array.prototype[2]); Float32Array.prototype[2] = 10; WScript.Echo(Float32Array.prototype[2]); WScript.Echo("test21"); testSetWithInt(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); testSetWithFloat(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); testSetWithObj(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); WScript.Echo("test21 JIT"); testSetWithInt(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); testSetWithFloat(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); testSetWithObj(-1, 2, new Float32Array(3), new Float32Array(3), new Float32Array(3)); WScript.Echo("test22"); testIndexValueForSet(new Float32Array(5)); WScript.Echo("test22 JIT"); testIndexValueForSet(new Float32Array(5));
var TapConsumer = require('./tap_consumer'); function BrowserTapConsumer(socket, tapConsumer) { tapConsumer = tapConsumer || new TapConsumer(); var stream = tapConsumer.stream; socket.on('tap', function(msg) { if (!stream.writable) { return; } stream.write(msg + '\n'); if (msg.match(/^#\s+ok\s*$/) || msg.match(/^#\s+fail\s+[0-9]+\s*$/)) { stream.end(); } }); return tapConsumer; } module.exports = BrowserTapConsumer;
/* */ "format register"; import {Metadata} from 'aurelia-metadata'; import {ValueConverter} from './value-converter'; export {EventManager} from './event-manager'; export {ObserverLocator} from './observer-locator'; export {ValueConverter} from './value-converter'; export {calcSplices} from './array-change-records'; export * from './binding-modes'; export {Parser} from './parser'; export {BindingExpression} from './binding-expression'; export {ListenerExpression} from './listener-expression'; export {NameExpression} from './name-expression'; export {CallExpression} from './call-expression'; export {DirtyChecker} from './dirty-checking'; Metadata.configure.classHelper('valueConverter', ValueConverter);
/* * CHART * Chart */ var oDefaults = { oDefaultData: { areaOpacity: 0.6, colors: ['#33cccc', '#CC0000', '#FF7400', '#FF0084', '#4096EE', '#B02B2C', '#D15600', '#C3D9FF', '#CDEB8B', '#36393D'], chartArea: { left: 50, top: 50, height: 300, width: 700, backgroundColor: '#fbfbfb', }, backgroundColor: { fill: '#fbfbfb', stroke: '#ececec', strokeWidth: 3, }, width: 850, height: 400, lineWidth: 3, pointSize: 10, vAxis: { gridlines:{ color: '#ececec', } }, hAxis: { gridlines:{ color: '#ececec', } }, legend: { position: 'top' }, }, sType: 'area', oParams: {}, fSource: GCore.NULL, }; var GChart = function() { var gThis = this; gThis._Constructor = function() { gThis.oOptions = $.extend(true, GCore.Duplicate(gThis.m_oOptions.oDefaultData, true), gThis.m_oOptions.oParams); gThis.Update(); $(window).bind('hashchange', function() { gThis.Update(); }); }; gThis.Update = function() { if(location.hash.length){ var url = gThis.m_oOptions.fSource + ',' + location.hash.substr(1); }else{ var url = gThis.m_oOptions.fSource; } var jsonData = $.ajax({ url: url, dataType:"json", async: false }).responseText; var data = new google.visualization.DataTable(jsonData); var sId = $(gThis).attr('id'); if(gThis.m_oOptions.sType == 'area'){ gThis.oChart = new google.visualization.AreaChart(document.getElementById(sId)); } if(gThis.m_oOptions.sType == 'pie'){ gThis.oChart = new google.visualization.PieChart(document.getElementById(sId)); } gThis.oChart.draw(data, gThis.oOptions); }; gThis._Constructor(); }; new GPlugin('GChart', oDefaults, GChart);
/** * @fileoverview Prevent usage of unknown DOM property * @author Yannick Croissant */ 'use strict'; var versionUtil = require('../util/version'); // ------------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------------ var UNKNOWN_MESSAGE = 'Unknown property \'{{name}}\' found, use \'{{standardName}}\' instead'; var DOM_ATTRIBUTE_NAMES = { 'accept-charset': 'acceptCharset', class: 'className', for: 'htmlFor', 'http-equiv': 'httpEquiv' }; var SVGDOM_ATTRIBUTE_NAMES = { 'clip-path': 'clipPath', 'fill-opacity': 'fillOpacity', 'font-family': 'fontFamily', 'font-size': 'fontSize', 'marker-end': 'markerEnd', 'marker-mid': 'markerMid', 'marker-start': 'markerStart', 'stop-color': 'stopColor', 'stop-opacity': 'stopOpacity', 'stroke-dasharray': 'strokeDasharray', 'stroke-linecap': 'strokeLinecap', 'stroke-opacity': 'strokeOpacity', 'stroke-width': 'strokeWidth', 'text-anchor': 'textAnchor', 'xlink:actuate': 'xlinkActuate', 'xlink:arcrole': 'xlinkArcrole', 'xlink:href': 'xlinkHref', 'xlink:role': 'xlinkRole', 'xlink:show': 'xlinkShow', 'xlink:title': 'xlinkTitle', 'xlink:type': 'xlinkType', 'xml:base': 'xmlBase', 'xml:lang': 'xmlLang', 'xml:space': 'xmlSpace' }; var DOM_PROPERTY_NAMES = [ // Standard 'acceptCharset', 'accessKey', 'allowFullScreen', 'allowTransparency', 'autoComplete', 'autoFocus', 'autoPlay', 'cellPadding', 'cellSpacing', 'charSet', 'classID', 'className', 'colSpan', 'contentEditable', 'contextMenu', 'crossOrigin', 'dateTime', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'hrefLang', 'htmlFor', 'httpEquiv', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup', 'noValidate', 'onBlur', 'onChange', 'onClick', 'onContextMenu', 'onCopy', 'onCut', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPaste', 'onScroll', 'onSubmit', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onWheel', 'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap', // Non standard 'autoCapitalize', 'autoCorrect', 'autoSave', 'itemProp', 'itemScope', 'itemType', 'itemRef', 'itemID' ]; // ------------------------------------------------------------------------------ // Helpers // ------------------------------------------------------------------------------ /** * Checks if a node matches the JSX tag convention. * @param {Object} node - JSX element being tested. * @returns {boolean} Whether or not the node name match the JSX tag convention. */ var tagConvention = /^[a-z][^-]*$/; function isTagName(node) { if (tagConvention.test(node.parent.name.name)) { // http://www.w3.org/TR/custom-elements/#type-extension-semantics return !node.parent.attributes.some(function(attrNode) { return ( attrNode.type === 'JSXAttribute' && attrNode.name.type === 'JSXIdentifier' && attrNode.name.name === 'is' ); }); } return false; } /** * Get the standard name of the attribute. * @param {Object} context The current rule context. * @param {String} name - Name of the attribute. * @returns {String} The standard name of the attribute. */ function getStandardName(context, name) { if (DOM_ATTRIBUTE_NAMES[name]) { return DOM_ATTRIBUTE_NAMES[name]; } // Also check for SVG attribute for React <15 if (!versionUtil.test(context, '15.0.0') && SVGDOM_ATTRIBUTE_NAMES[name]) { return SVGDOM_ATTRIBUTE_NAMES[name]; } var i; var found = DOM_PROPERTY_NAMES.some(function(element, index) { i = index; return element.toLowerCase() === name; }); return found ? DOM_PROPERTY_NAMES[i] : null; } // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ module.exports = function(context) { var sourceCode = context.getSourceCode(); return { JSXAttribute: function(node) { var name = sourceCode.getText(node.name); var standardName = getStandardName(context, name); if (!isTagName(node) || !standardName) { return; } context.report({ node: node, message: UNKNOWN_MESSAGE, data: { name: name, standardName: standardName }, fix: function(fixer) { return fixer.replaceText(node.name, standardName); } }); } }; }; module.exports.schema = [];
d3.csv('energy-production.csv').then(data => { // manipulate the data into stacked series const stack = d3 .stack() .keys(Object.keys(data[0]).filter(k => k !== 'Country')); const seriesData = stack(data); const color = d3 .scaleOrdinal(d3.schemeCategory10) .domain(seriesData.map(s => s.key)); const legend = d3 .legendColor() .shapeWidth(80) .labelWrap(80) .orient('horizontal') .scale(color); const barSeries = fc .autoBandwidth(fc.seriesSvgBar()) .orient('horizontal') .align('left') .crossValue(d => d.data.Country) .mainValue(d => d[1]) .baseValue(d => d[0]); const repeat = fc .seriesSvgRepeat() .series(barSeries) .decorate(selection => { selection .selectAll('g.bar') .attr('fill', (data, index) => color(seriesData[index].key)); }); const xExtent = fc .extentLinear() .accessors([a => a.map(d => d[1])]) .pad([0, 1]) .padUnit('domain'); const chart = fc .chartCartesian(d3.scaleLinear(), d3.scaleBand()) .xDomain(xExtent(seriesData)) .yDomain(data.map(d => d.Country)) .yOrient('left') .yPadding([0.1]) .xLabel('Million tonnes of oil equivalent') .chartLabel('2013 Energy Production') .svgPlotArea(repeat) .decorate(function(selection, data, index) { // append an svg for the d3-legend selection .enter() .append('d3fc-svg') .attr('class', 'legend'); // render the legend selection .select('.legend') .select('svg') .call(legend); }); d3.select('#stacked-chart') // remove the loading text from the container .text(null) .datum(seriesData) .call(chart); });
'use strict'; angular.module("ngLocale", [], ["$provide", function ($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "fm", "em" ], "DAY": [ "s\u00f6ndag", "m\u00e5ndag", "tisdag", "onsdag", "torsdag", "fredag", "l\u00f6rdag" ], "MONTH": [ "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december" ], "SHORTDAY": [ "s\u00f6n", "m\u00e5n", "tis", "ons", "tors", "fre", "l\u00f6r" ], "SHORTMONTH": [ "jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec" ], "fullDate": "EEEE'en' 'den' d:'e' MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "yyyy-MM-dd HH:mm", "shortDate": "yyyy-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "kr", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "sv-se", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER; } }); }]);
require('ember-metal/utils'); require('ember-metal/chains'); var metaFor = Ember.meta, // utils.js typeOf = Ember.typeOf, // utils.js ChainNode = Ember._ChainNode; // chains.js // get the chains for the current object. If the current object has // chains inherited from the proto they will be cloned and reconfigured for // the current object. function chainsFor(obj) { var m = metaFor(obj), ret = m.chains; if (!ret) { ret = m.chains = new ChainNode(null, null, obj); } else if (ret.value() !== obj) { ret = m.chains = ret.copy(obj); } return ret; } Ember.watchPath = function(obj, keyPath) { // can't watch length on Array - it is special... if (keyPath === 'length' && typeOf(obj) === 'array') { return; } var m = metaFor(obj), watching = m.watching; if (!watching[keyPath]) { // activate watching first time watching[keyPath] = 1; chainsFor(obj).add(keyPath); } else { watching[keyPath] = (watching[keyPath] || 0) + 1; } }; Ember.unwatchPath = function(obj, keyPath) { var m = metaFor(obj), watching = m.watching, desc; if (watching[keyPath] === 1) { watching[keyPath] = 0; chainsFor(obj).remove(keyPath); } else if (watching[keyPath] > 1) { watching[keyPath]--; } };
module.exports = git; git.desc = "Git operations on a FeedHenry App which doesn't have it's own repo"; // TODO Is this still valid in FH3? git.usage = "\nfhc git [props] <app-id>" + "\nfhc git set <app-id> <git-prop-name> <git-prop-value>" + "\nfhc git pull <app-id>"; var log = require("../../utils/log"); var fhc = require("../../fhc"); var fhreq = require("../../utils/request"); var common = require("../../common"); var util = require('util'); var async = require('async'); var path = require('path'); var fs = require('fs'); var url = require('url'); var https = require('https'); var millicore = require("../../utils/millicore.js"); var ini = require('../../utils/ini'); var Table = require('cli-table'); // Main git command entry point function git (argv, cb) { var args = argv._; if (args.length === 0 || args.length > 3){ return cb(git.usage); } var action = args[0], appId; if (action === 'props') { appId = fhc.appId(args[1]); return props(appId, cb); } else if (action === 'pull') { var appId = fhc.appId(args[1]); return pull(appId, cb); } else if (action === 'set'){ args.shift(); if (args.length === 0 || args.length > 3) return cb(git.usage); var appId = fhc.appId(args[0]); var name = args[1]; var value = args[2]; return set(appId, name, value, cb); }else { return cb(git.usage); } } // git props function props (appId, cb) { getGitProps(appId, function(err, scm){ if(err) return cb(err); if(!scm) git.message = "'" + appId + "' is not a Git based Application"; if(scm && ini.get('table') === true && scm) { createTableForProps(scm); } if (!scm) scm = {}; return cb(err, scm); }); } // Git set properties // Note: although we're just setting scm related properties, the app update endpoint expects the full config object.. function set (appId, k, v, cb) { common.readApp(appId, function(err, cfg){ if (err) return cb(err); // the config object returned from readApp is not the expected format for app/update :-( var payload = { "payload": { "app": cfg.app.guid, "inst": appId, "title": cfg.inst.title, "description": cfg.inst.description, "height": cfg.inst.height, "width": cfg.inst.width, "config": cfg.inst.config, "widgetConfig": cfg.app.config }, "context": {} }; // update the payload scm parameters var scm; if (cfg.app && cfg.app.config && cfg.app.config.scm) scm = cfg.app.config.scm; if(!scm) git.message = "'" + appId + "' is not a Git based Application"; payload.payload.widgetConfig.scm[k] = v; fhreq.POST(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.curTarget + "/app/update", payload, function (err, remoteData, raw, response) { if (err) { log.error("Error updating app: " + err); cb(err); }else { git.message = "Property set ok"; if (remoteData.status !== 'ok') { git.message = "Error setting property: " + remoteData.message; return cb(remoteData.messsage, remoteData); } return cb(undefined, remoteData); } }); }); } // tell FeedHenry to do a 'git pull' function pull (appId, cb) { var payload = {payload:{guid: appId}}; millicore.widgForAppId(appId, function (err, widgId) { common.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/pub/app/" + widgId + "/refresh", payload, "Error in Git pull: ", function(err, data){ if(err) return cb(err); if(data.status !== 'ok') return cb("Error in Git pull: " + data.error); if(data.cacheKey) return common.waitFor(data.cacheKey, function(err, data){ if (err) return cb(err); if (data[0] && data[0].log && data[0].log[0]) git.message = data[0].log.join(' '); return cb(err, data); }); return cb(err, data); }); }); } // table format for Git Properties function createTableForProps(scm) { var url = scm.url; var branch = scm.branch; var key = scm.key; var branchLen = common.strlen(branch) < 6 ? 8 : common.strlen(branch); var keyLen = common.strlen(key) < 3 ? 5 : common.strlen(key); if (keyLen > common.maxTableCell) keyLen = common.maxTableCell; // create our table git.table = new Table({ head: ['Url', 'Branch', 'Key'], colWidths: [common.strlen(url)+2, branchLen + 2, keyLen+2], style: common.style() }); git.table.push([url, branch, key]); } // get git properties function getGitProps(appId, cb) { // TODO check for valid app guid/app exists var payload = {payload:{guid: appId}}; common.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.curTarget + "/app/read", payload, "Error reading Git properties: ", function(err, data){ if(err) return cb(err); if(data.status !== 'ok') return cb("Error reading Git properties: " + (data.error || data.msg)); var scm; if (data.app && data.app.config && data.app.config.scm) scm = data.app.config.scm; return cb(err, scm); }); } // bash completion git.completion = function (opts, cb) { var argv = opts.conf.argv.remain; if (argv[1] !== "git") argv.unshift("git"); if (argv.length === 2) { return cb(null, ["props", "set", "pull"]); } if (argv.length === 3) { var action = argv[2]; switch (action) { case "props": case "set": case "pull": common.getAppIds(cb); break; default: return cb(null, []); } } };
class A { #x() {} static #x = 0; }
#!/usr/bin/env node var fs = require('fs'); var path = require('path'); // change to parent directory so all paths are relative to the top dir process.chdir(path.dirname(__dirname)); var targetFile = path.join(__dirname, 'spiceproxy.js'); var files = [ 'lib/utils.js', 'spiceobjects/spiceobjects.js', 'spiceobjects/generated/protocol.js', 'lib/GlobalPool.js', 'lib/GenericObjectPool.js', 'spiceproxy/socket.js', 'spiceproxy/globalpool.js', 'lib/queue.js', 'network/socketqueue.js', 'network/packetextractor.js', 'network/packetcontroller.js', 'network/sizedefiner.js', 'network/packetreassembler.js', 'network/reassemblerfactory.js', 'lib/biginteger.js', 'spiceproxy/spicechannel.js' ]; var exportString = "\nmodule.exports = wdi; \n"; console.log("Will generate %s", targetFile); if (fs.existsSync(targetFile)) { fs.unlinkSync(targetFile); } files.forEach(function (file) { var data = fs.readFileSync(file); console.log('... appending %s', file); fs.appendFileSync(targetFile, data); }); console.log("Done! Appending module.exports line..."); fs.appendFileSync(targetFile, exportString); console.log("Finish... Everything is stored in %s", targetFile);
import Ember from 'ember'; export default Ember.Helper.helper(function(params, hash) { let firstParam = params[0]; let secondParam = params[1]; return firstParam === secondParam; });
var Readable = require('stream').Readable; var request = require('supertest'); var json = require('..'); var koa = require('koa'); describe('streams', function(){ it('should not do anything binary streams', function (done) { var app = koa(); app.use(json()); app.use(function* (next) { var stream = this.body = new Readable(); stream.push('lol'); stream.push(null); }); request(app.listen()) .get('/') .expect('lol', done); }) it('should always stringify object streams', function (done) { var app = koa(); app.use(json({ pretty: false })); app.use(function* (next) { var stream = this.body = new Readable({ objectMode: true }); stream.push({ message: '1' }); stream.push({ message: '2' }); stream.push(null); }) request(app.listen()) .get('/') .expect('Content-Type', /application\/json/) .expect(200, function (err, res) { if (err) return done(err); res.text.should.include('{"message":"1"}'); res.text.should.include('{"message":"2"}'); res.body.should.eql([{ message: '1' }, { message: '2' }]); done(); }) }) it('should prettify object streams', function (done) { var app = koa(); app.use(json()); app.use(function* (next) { var stream = this.body = new Readable({ objectMode: true }); stream.push({ message: '1' }); stream.push({ message: '2' }); stream.push(null); }) request(app.listen()) .get('/') .expect('Content-Type', /application\/json/) .expect(200, function (err, res) { if (err) return done(err); res.text.should.include('{\n "message": "1"\n}'); res.text.should.include('{\n "message": "2"\n}'); res.body.should.eql([{ message: '1' }, { message: '2' }]); done(); }) }) })
import leftHelix from "./leftHelix"; import rightHelix from "./rightHelix"; it("should import generate ensure function for this", () => { return Promise.all([leftHelix.run(), rightHelix.run()]); }); export default { leftHelix, rightHelix };
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; var models = require('./index'); var util = require('util'); /** * @class * Initializes a new instance of the ApplicationGatewayAuthenticationCertificate class. * @constructor * Authentication certificates of application gateway * * @member {string} [data] Certificate public data * * @member {string} [provisioningState] Provisioning state of the * authentication certificate resource Updating/Deleting/Failed * * @member {string} [name] Name of the resource that is unique within a * resource group. This name can be used to access the resource * * @member {string} [etag] A unique read-only string that changes whenever the * resource is updated * */ function ApplicationGatewayAuthenticationCertificate() { ApplicationGatewayAuthenticationCertificate['super_'].call(this); } util.inherits(ApplicationGatewayAuthenticationCertificate, models['SubResource']); /** * Defines the metadata of ApplicationGatewayAuthenticationCertificate * * @returns {object} metadata of ApplicationGatewayAuthenticationCertificate * */ ApplicationGatewayAuthenticationCertificate.prototype.mapper = function () { return { required: false, serializedName: 'ApplicationGatewayAuthenticationCertificate', type: { name: 'Composite', className: 'ApplicationGatewayAuthenticationCertificate', modelProperties: { id: { required: false, serializedName: 'id', type: { name: 'String' } }, data: { required: false, serializedName: 'properties.data', type: { name: 'String' } }, provisioningState: { required: false, serializedName: 'properties.provisioningState', type: { name: 'String' } }, name: { required: false, serializedName: 'name', type: { name: 'String' } }, etag: { required: false, serializedName: 'etag', type: { name: 'String' } } } } }; }; module.exports = ApplicationGatewayAuthenticationCertificate;
// @flow import type { EventName } from 'pickadate/constants' ////////////// // GENERICS // ////////////// export type WeekdaysIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 export type Weekdays = [string, string, string, string, string, string, string] export type Months = [ string, string, string, string, string, string, string, string, string, string, string, string, ] export type Hour = | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 export type Minute = | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 ////////// // BASE // ////////// export type Store<State> = { addActor: (Actor<State, any>) => any, subscribe: (listener: Function) => Function, getState: () => State, } export type Actor<State, Payload> = ( state: State, payload: Payload ) => ?$Shape<State> export type Action<Payload = void, Return = void> = (payload: Payload) => Return ///////////////// // DATE PICKER // ///////////////// export type TemplateHookWords = { MMM: Months, MMMM: Months, DDD: Weekdays, DDDD: Weekdays, } export type DatePickerState = {| disabled: Array<number | Date | [Date, Date]>, firstDayOfWeek: WeekdaysIndex, highlighted: Date, maximum: null | Date, minimum: null | Date, selected: null | Date, template: string, templateHookWords: TemplateHookWords, view: Date, |} export type DatePickerActor<Payload = void> = Actor<DatePickerState, Payload> export type SetSelectedPayload = { value: Date | string | number, isUpdatingView?: boolean, } export type SetHighlightedPayload = { keyCode: number, } export type SetMinimumPayload = { value: Date, } export type SetMaximumPayload = { value: Date, } export type SetFirstDayOfWeekPayload = { value: WeekdaysIndex, } export type SetTimePayload = $Shape<{ hours: Hour, minutes: number, }> export type DatePickerStore = Store<DatePickerState> & { setSelected: Action<SetSelectedPayload>, setHighlighted: Action<SetHighlightedPayload>, setMinimum: Action<SetMinimumPayload>, setMaximum: Action<SetMaximumPayload>, setTime: Action<SetTimePayload>, setFirstDayOfWeek: Action<SetFirstDayOfWeekPayload>, clear: Action<>, viewPrevious: Action<>, viewNext: Action<>, viewToday: Action<>, cycleHourUp: Action<>, cycleHourDown: Action<>, cycleMinuteUp: Action<>, cycleMinuteDown: Action<>, cycleMeridiem: Action<>, } export type DatePickerCoreApi = { store: DatePickerStore, getValue: () => string, subscribeToValue: (listener: (formattedValue: string) => void) => Function, addEventListener: (eventName: EventName, listener: Function) => Function, triggerEvent: (eventName: EventName) => void, }
import PopoverMixin from 'ghost/mixins/popover-mixin'; var GhostPopover = Ember.Component.extend(PopoverMixin, { classNames: 'ghost-popover fade-in', classNameBindings: ['open'], name: null, closeOnClick: false, didInsertElement: function () { this._super(); var popoverService = this.get('popover'); popoverService.on('close', this, this.close); popoverService.on('toggle', this, this.toggle); }, willDestroyElement: function () { this._super(); var popoverService = this.get('popover'); popoverService.off('close', this, this.close); popoverService.off('toggle', this, this.toggle); }, click: function (event) { this._super(event); if (this.get('closeOnClick')) { return this.close(); } }, close: function () { return this.set('open', false); }, toggle: function (options) { /* Close all popovers whose button was not clicked, and toggle the actual target. */ var targetPopoverName = options.target; if (this.get('name') === targetPopoverName) { this.toggleProperty('open'); } else { this.close(); } } }); export default GhostPopover;
/* multi-line expressions */ req .shouldBeOne(); too. more. shouldBeOneToo; const a = long_expression; b = long; b = 3 + 5; b = 3 + 5; b = 3 + 5 + 7 + 8 * 8 * 9 / 17 * 8 / 20 - 34 + 3 * 9 - 8; ifthis && thendo() || otherwise && dothis /** A comment, should be at 1 */
//>>built define("dojo/cldr/nls/pt-pt/currency",{CAD_displayName:"D\u00f3lar canadiano",USD_displayName:"D\u00f3lar dos Estados Unidos"}); //@ sourceMappingURL=currency.js.map
// For docs, see: // http://developer.mapquest.com/web/products/open/directions-service // http://open.mapquestapi.com/directions/ // https://github.com/apmon/openstreetmap-website/blob/21edc353a4558006f0ce23f5ec3930be6a7d4c8b/app/controllers/routing_controller.rb#L153 function MapQuestEngine(id, routeType) { var MQ_SPRITE_MAP = { 0: 0, // straight 1: 1, // slight right 2: 2, // right 3: 3, // sharp right 4: 4, // reverse 5: 7, // sharp left 6: 6, // left 7: 5, // slight left 8: 4, // right U-turn 9: 4, // left U-turn 10: 21, // right merge 11: 20, // left merge 12: 21, // right on-ramp 13: 20, // left on-ramp 14: 24, // right off-ramp 15: 25, // left off-ramp 16: 18, // right fork 17: 19, // left fork 18: 0 // straight fork }; return { id: id, creditline: '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="' + document.location.protocol + '//developer.mapquest.com/content/osm/mq_logo.png">', draggable: false, getRoute: function (points, callback) { var from = points[0]; var to = points[points.length - 1]; return $.ajax({ url: document.location.protocol + OSM.MAPQUEST_DIRECTIONS_URL, data: { key: OSM.MAPQUEST_KEY, from: from.lat + "," + from.lng, to: to.lat + "," + to.lng, routeType: routeType, // locale: I18n.currentLocale(), //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n may only provides language, e.g. "de" manMaps: false, shapeFormat: "raw", generalize: 0, unit: "k" }, dataType: "jsonp", success: function (data) { if (data.info.statuscode !== 0) return callback(true); var i; var line = []; var shape = data.route.shape.shapePoints; for (i = 0; i < shape.length; i += 2) { line.push(L.latLng(shape[i], shape[i + 1])); } // data.route.shape.maneuverIndexes links turns to polyline positions // data.route.legs[0].maneuvers is list of turns var steps = []; var mq = data.route.legs[0].maneuvers; for (i = 0; i < mq.length; i++) { var s = mq[i]; var d; var linesegstart, linesegend, lineseg; linesegstart = data.route.shape.maneuverIndexes[i]; if (i === mq.length - 1) { d = 15; linesegend = linesegstart + 1; } else { d = MQ_SPRITE_MAP[s.turnType]; linesegend = data.route.shape.maneuverIndexes[i + 1] + 1; } lineseg = []; for (var j = linesegstart; j < linesegend; j++) { lineseg.push(L.latLng(data.route.shape.shapePoints[j * 2], data.route.shape.shapePoints[j * 2 + 1])); } steps.push([L.latLng(s.startPoint.lat, s.startPoint.lng), d, s.narrative, s.distance * 1000, lineseg]); } callback(false, { line: line, steps: steps, distance: data.route.distance * 1000, time: data.route.time }); }, error: function () { callback(true); } }); } }; } if (OSM.MAPQUEST_KEY) { OSM.Directions.addEngine(new MapQuestEngine("mapquest_bicycle", "bicycle"), true); OSM.Directions.addEngine(new MapQuestEngine("mapquest_foot", "pedestrian"), true); OSM.Directions.addEngine(new MapQuestEngine("mapquest_car", "fastest"), true); }
(function($) { var ns = birchpress.namespace('birchschedule', { __init__: function() {}, initApp: function() { } }); birchpress.addAction('birchpress.initFrameworkAfter', ns.initApp); })(jQuery);
/////////////////////////////////////////////////////////////////////////// // Copyright © 2014 Esri. 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. /////////////////////////////////////////////////////////////////////////// define(['dojo/_base/declare', 'dijit/_WidgetBase', 'dijit/_TemplatedMixin', 'dijit/_WidgetsInTemplateMixin', 'dojo/text!./templates/_BasicServiceChooserContent.html', 'dojo/Evented', 'dojo/Deferred', 'dojo/_base/html', 'dojo/_base/array', 'dojo/_base/lang', 'dojo/on', 'dojo/aspect', 'dojo/promise/all', 'jimu/dijit/URLInput', 'jimu/dijit/LoadingIndicator' ], function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, Evented, Deferred, html, array, lang, on, aspect, all, URLInput, LoadingIndicator) { /*jshint unused: false*/ return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Evented], { templateString: template, _examples:['http://myserver/arcgis/rest/services', 'http://myserver/arcgis/rest/services/folder', 'http://myserver/arcgis/rest/services/myservice/servicetype'], //options: multiple: false, url:'', //public methods: //setUrl //events: //ok //cancel //methods need to override: //_createServiceBrowser, return a service browser //public methods: //getSelectedItems return [{name,url, /*optional*/ definition}] getSelectedItems: function(){ return this.serviceBrowser.getSelectedItems(); }, postMixInProperties:function(){ this.nls = lang.mixin({}, window.jimuNls.common); this.nls = lang.mixin(this.nls, window.jimuNls.basicServiceChooser); }, postCreate: function(){ this.inherited(arguments); html.addClass(this.domNode, 'jimu-basic-service-chooser-content'); this.multiple = !!this.multiple; this._initSelf(); this.exampleTd.innerHTML = this.exampleTd.innerHTML; }, setUrl: function(url){ var def = new Deferred(); this.url = url; if(this.url && typeof this.url === 'string'){ this.urlInput.set('value', this.url); def = this._onBtnValidateClick(); } else{ def.reject(); } return def; }, _initSelf: function(){ //set examples if(this._examples && this._examples.length > 0){ array.forEach(this._examples, lang.hitch(this, function(example){ html.create('div',{ innerHTML: example, 'class': 'example-url' }, this.exampleTd); })); } else{ html.setStyle(this.exampleTr, 'display', 'none'); } //set service browser var args = { multiple: this.multiple, _onTreeClick: lang.hitch(this, this._onTreeClick) }; this.serviceBrowser = this._createServiceBrowser(args); this.serviceBrowser.placeAt(this.serviceBrowserContainer); this.serviceBrowser.startup(); this.own(aspect.after(this.urlInput, 'validator', lang.hitch(this, this._afterUrlValidate))); if(this.url && typeof this.url === 'string'){ this.urlInput.set('value', this.url); } }, //to be override,return a service browser _createServiceBrowser: function(args){/* jshint unused: false */}, _afterUrlValidate: function(isValidate){ var disabledClass = 'jimu-state-disabled'; if(isValidate){ html.removeClass(this.btnValidate, disabledClass); } else{ html.addClass(this.btnValidate, disabledClass); } return isValidate; }, _onBtnValidateClick: function(){ var def = new Deferred(); var isValidate = this.urlInput.validate(); if(isValidate){ var url = this.urlInput.get('value'); this.serviceBrowser.setUrl(url).then(lang.hitch(this, function(){ if(this.domNode){ this._checkSelectedItemsNumber(); } def.resolve(); }), lang.hitch(this, function(){ if(this.domNode){ this._checkSelectedItemsNumber(); } def.reject(); })); } else{ def.reject(); } return def; }, _checkSelectedItemsNumber: function(){ var disabledClass = 'jimu-state-disabled'; var items = this.getSelectedItems(); if(items.length > 0){ html.removeClass(this.btnOk, disabledClass); } else{ html.addClass(this.btnOk, disabledClass); } }, _onTreeClick: function(){ this._checkSelectedItemsNumber(); }, _onBtnOkClick: function(){ var items = this.getSelectedItems(); if(items.length > 0){ this.emit('ok', items); } }, _onBtnCancelClick: function(){ this.emit('cancel'); } }); });
// ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** // // Ice version 3.6.3 // // <auto-generated> // // Generated from file `pointcloud.ice' // // Warning: do not edit this file. // // </auto-generated> // (function(module, require, exports) { var Ice = require("ice").Ice; var __M = Ice.__M; var jderobot = require("jderobot/primitives").jderobot; var Slice = Ice.Slice; Slice.defineSequence(jderobot, "RGBPointsPCLHelper", "jderobot.RGBPoint", true); jderobot.pointCloudData = Slice.defineObject( function(p) { Ice.Object.call(this); this.p = p !== undefined ? p : null; }, Ice.Object, undefined, 1, [ "::Ice::Object", "::jderobot::pointCloudData" ], -1, function(__os) { jderobot.RGBPointsPCLHelper.write(__os, this.p); }, function(__is) { this.p = jderobot.RGBPointsPCLHelper.read(__is); }, false); jderobot.pointCloudDataPrx = Slice.defineProxy(Ice.ObjectPrx, jderobot.pointCloudData.ice_staticId, undefined); Slice.defineOperations(jderobot.pointCloudData, jderobot.pointCloudDataPrx); jderobot.pointCloud = Slice.defineObject( undefined, Ice.Object, undefined, 1, [ "::Ice::Object", "::jderobot::pointCloud" ], -1, undefined, undefined, false); jderobot.pointCloudPrx = Slice.defineProxy(Ice.ObjectPrx, jderobot.pointCloud.ice_staticId, undefined); Slice.defineOperations(jderobot.pointCloud, jderobot.pointCloudPrx, { "getCloudData": [, 2, 2, , , ["jderobot.pointCloudData", true], , , , , true] }); exports.jderobot = jderobot; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this));
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.sketch.SingleArrowAnnotation"]){ dojo._hasResource["dojox.sketch.SingleArrowAnnotation"]=true; dojo.provide("dojox.sketch.SingleArrowAnnotation"); dojo.require("dojox.sketch.Annotation"); dojo.require("dojox.sketch.Anchor"); (function(){ var ta=dojox.sketch; ta.SingleArrowAnnotation=function(_2,id){ ta.Annotation.call(this,_2,id); this.transform={dx:0,dy:0}; this.start={x:0,y:0}; this.control={x:100,y:-50}; this.end={x:200,y:0}; this.textPosition={x:0,y:0}; this.textOffset=4; this.textAlign="middle"; this.textYOffset=10; this.rotation=0; this.pathShape=null; this.arrowhead=null; this.arrowheadGroup=null; this.labelShape=null; this.anchors.start=new ta.Anchor(this,"start"); this.anchors.control=new ta.Anchor(this,"control"); this.anchors.end=new ta.Anchor(this,"end"); }; ta.SingleArrowAnnotation.prototype=new ta.Annotation; var p=ta.SingleArrowAnnotation.prototype; p.constructor=ta.SingleArrowAnnotation; p.type=function(){ return "SingleArrow"; }; p.getType=function(){ return ta.SingleArrowAnnotation; }; p._rot=function(){ var _5=this.start.y-this.control.y; var _6=this.start.x-this.control.x; if(!_6){ _6=1; } this.rotation=Math.atan(_5/_6); }; p._pos=function(){ var _7=this.textOffset,x=0,y=0; var _a=this.calculate.slope(this.control,this.end); if(Math.abs(_a)>=1){ x=this.end.x+this.calculate.dx(this.control,this.end,_7); if(this.control.y>this.end.y){ y=this.end.y-_7; }else{ y=this.end.y+_7+this.textYOffset; } }else{ if(_a==0){ x=this.end.x+_7; y=this.end.y+this.textYOffset; }else{ if(this.start.x>this.end.x){ x=this.end.x-_7; this.textAlign="end"; }else{ x=this.end.x+_7; this.textAlign="start"; } if(this.start.y<this.end.y){ y=this.end.y+this.calculate.dy(this.control,this.end,_7)+this.textYOffset; }else{ y=this.end.y+this.calculate.dy(this.control,this.end,-_7); } } } this.textPosition={x:x,y:y}; }; p.apply=function(_b){ if(!_b){ return; } if(_b.documentElement){ _b=_b.documentElement; } this.readCommonAttrs(_b); for(var i=0;i<_b.childNodes.length;i++){ var c=_b.childNodes[i]; if(c.localName=="text"){ this.property("label",c.childNodes.length?c.childNodes[0].nodeValue:""); }else{ if(c.localName=="path"){ var d=c.getAttribute("d").split(" "); var s=d[0].split(","); this.start.x=parseFloat(s[0].substr(1),10); this.start.y=parseFloat(s[1],10); s=d[1].split(","); this.control.x=parseFloat(s[0].substr(1),10); this.control.y=parseFloat(s[1],10); s=d[2].split(","); this.end.x=parseFloat(s[0],10); this.end.y=parseFloat(s[1],10); } } } }; p.initialize=function(obj){ var _11=(ta.Annotation.labelFont)?ta.Annotation.labelFont:{family:"Times",size:"16px"}; this.apply(obj); this._rot(); this._pos(); var rot=this.rotation; if(this.control.x>=this.end.x&&this.control.x<this.start.x){ rot+=Math.PI; } var _13=dojox.gfx.matrix.rotate(rot); this.shape=this.figure.group.createGroup(); this.shape.getEventSource().setAttribute("id",this.id); if(this.transform.dx||this.transform.dy){ this.shape.setTransform(this.transform); } this.pathShape=this.shape.createPath("M"+this.start.x+","+this.start.y+" Q"+this.control.x+","+this.control.y+" "+this.end.x+","+this.end.y+" l0,0").setStroke(this.property("stroke")); this.arrowheadGroup=this.shape.createGroup().setTransform({dx:this.start.x,dy:this.start.y}).applyTransform(_13); this.arrowhead=this.arrowheadGroup.createPath("M0,0 l20,-5 -3,5 3,5 Z").setFill(this.property("fill")); this.labelShape=this.shape.createText({x:this.textPosition.x,y:this.textPosition.y,text:this.property("label"),align:this.textAlign}).setFont(_11).setFill(this.property("fill")); }; p.destroy=function(){ if(!this.shape){ return; } this.arrowheadGroup.remove(this.arrowhead); this.shape.remove(this.arrowheadGroup); this.shape.remove(this.pathShape); this.shape.remove(this.labelShape); this.figure.group.remove(this.shape); this.shape=this.pathShape=this.labelShape=this.arrowheadGroup=this.arrowhead=null; }; p.draw=function(obj){ this.apply(obj); this._rot(); this._pos(); var rot=this.rotation; if(this.control.x<this.start.x){ rot+=Math.PI; } var _16=dojox.gfx.matrix.rotate(rot); this.shape.setTransform(this.transform); this.pathShape.setShape("M"+this.start.x+","+this.start.y+" Q"+this.control.x+","+this.control.y+" "+this.end.x+","+this.end.y+" l0,0").setStroke(this.property("stroke")); this.arrowheadGroup.setTransform({dx:this.start.x,dy:this.start.y}).applyTransform(_16); this.arrowhead.setFill(this.property("fill")); this.labelShape.setShape({x:this.textPosition.x,y:this.textPosition.y,text:this.property("label"),align:this.textAlign}).setFill(this.property("fill")); }; p.getBBox=function(){ var x=Math.min(this.start.x,this.control.x,this.end.x); var y=Math.min(this.start.y,this.control.y,this.end.y); var w=Math.max(this.start.x,this.control.x,this.end.x)-x; var h=Math.max(this.start.y,this.control.y,this.end.y)-y; return {x:x,y:y,width:w,height:h}; }; p.serialize=function(){ var s=this.property("stroke"); var r=this.rotation*(180/Math.PI); if(this.start.x>this.end.x){ r-=180; } r=Math.round(r*Math.pow(10,4))/Math.pow(10,4); return "<g "+this.writeCommonAttrs()+">"+"<path style=\"stroke:"+s.color+";stroke-width:"+s.width+";fill:none;\" d=\""+"M"+this.start.x+","+this.start.y+" "+"Q"+this.control.x+","+this.control.y+" "+this.end.x+","+this.end.y+"\" />"+"<g transform=\"translate("+this.start.x+","+this.start.y+") "+"rotate("+r+")\">"+"<path style=\"fill:"+s.color+";\" d=\"M0,0 l20,-5, -3,5, 3,5 Z\" />"+"</g>"+"<text style=\"fill:"+s.color+";text-anchor:"+this.textAlign+"\" font-weight=\"bold\" "+"x=\""+this.textPosition.x+"\" "+"y=\""+this.textPosition.y+"\">"+this.property("label")+"</text>"+"</g>"; }; ta.Annotation.register("SingleArrow"); })(); }
'use strict' class SetMessage { /** * @param {string} storage * @param {string} key * @param {object} value * @param {string} id */ constructor(storage, key, value, id) { this._storage = storage this._key = key this._value = value this._id = id } /** * @returns {string} */ get storage() { return this._storage } /** * @returns {string} */ get key() { return this._key } /** * @returns {object} */ get value() { return this._value } /** * @returns {string} */ get id() { return this._id } /** * @returns {object} */ serialize() { return { storage: this._storage, key: this._key, value: this._value, id: this._id } } /** * @param {object} raw * @returns {SetMessage} */ static deserialize(raw) { return new SetMessage( raw.storage, raw.key, raw.value, raw.id ) } } module.exports = SetMessage
/** * cartDrawer helpers * * @provides displayCartDrawer * @returns open or closed cart drawer template */ Template.cartDrawer.helpers({ displayCartDrawer: function() { var count, items, storedCart, _i, _len, _ref; if (!Session.equals("displayCart", true)) { return null; } storedCart = Cart.findOne(); count = 0; if (storedCart != null ? storedCart.items : void 0) { _ref = storedCart.items; for (_i = 0, _len = _ref.length; _i < _len; _i++) { items = _ref[_i]; count += items.quantity; } } if (count === 0) { return Template.emptyCartDrawer; } else { return Template.openCartDrawer; } } }); /** * openCartDrawer helpers * */ Template.openCartDrawer.onRendered(function() { return $('#cart-drawer-container').fadeIn(); }); Template.openCartDrawer.helpers({ cartItems: function() { return Cart.findOne().items; }, checkoutView: function() { var checkoutView; checkoutView = "display:block"; if (Router.current().route.getName() === 'cartCheckout') { return checkoutView; } } }); /** * openCartDrawer events * */ Template.openCartDrawer.events({ 'click #btn-checkout': function(event, template) { $('#cart-drawer-container').fadeOut(); Session.set("displayCart", false); return Router.go("cartCheckout"); }, 'click .remove-cart-item': function(event, template) { event.stopPropagation(); event.preventDefault(); var currentCartId = Cart.findOne()._id; var currentVariant = this.variants; return $(event.currentTarget).fadeOut(300, function() { return Meteor.call('removeFromCart', currentCartId, currentVariant); }); } }); /** * emptyCartDrawer helpers * */ Template.emptyCartDrawer.events({ 'click #btn-keep-shopping': function(event, template) { event.stopPropagation(); event.preventDefault(); return $('#cart-drawer-container').fadeOut(300, function() { return toggleSession("displayCart"); }); } }); Template.emptyCartDrawer.onRendered(function() { return $('#cart-drawer-container').fadeIn(); });
import DS from 'ember-data'; import Ember from 'ember'; import moment from 'moment'; const { PromiseArray } = DS; const { Component, computed, get, inject, isEmpty } = Ember; export default Component.extend({ patient: null, database: inject.service(), store: inject.service(), appointments: computed('patient', function() { let patient = get(this, 'patient'); if (!isEmpty(patient)) { let database = get(this, 'database'); let endDate = moment().add(10, 'years').toDate().getTime(); let maxApptId = database.getMaxPouchId('appointment'); let minApptId = database.getMinPouchId('appointment'); let patientId = get(patient, 'id'); let startDate = moment().toDate().getTime(); let store = get(this, 'store'); let appointmentPromise = store.query('appointment', { options: { startkey: [patientId, startDate, startDate, minApptId], endkey: [patientId, endDate, endDate, maxApptId] }, mapReduce: 'appointments_by_patient' }); return PromiseArray.create({ promise: appointmentPromise }); } }) });
(function($) { var DEFAULT_IMAGE_WIDTH = 400; Office.onReady(function(info) { function captureEvent(event) { var eventJson, url; try { eventJson = JSON.parse(event.data); } catch(e) { console.log("Unable to parse JSON from event data: " + event.data); } if (!(eventJson && eventJson.config && eventJson.config.action && eventJson.config.action === 'done')) { // This is not a selection event so discard return; } if (eventJson.data && Array.isArray(eventJson.data) && eventJson.data.length === 1 && eventJson.data[0].url ) { url = eventJson.data[0].url; } else { console.error("An error occurred. The Asset URL could not be collected."); return; } console.debug("Syncing asset [ " + url + " ] from AEM to MS Office"); if (Office.context.document) { getBase64FromAsset(url, function(base64Img) { Office.context.document.setSelectedDataAsync( base64Img, { coercionType: Office.CoercionType.Image, imageWidth: 400 }, function(asyncResult) { Word.run(function (context) { var range = context.document.getSelection(); range.select('end'); return context.sync(); }); if (asyncResult.status === Office.AsyncResultStatus.Failed) { console.log(asyncResult.error.message); } } ); }); } else { console.error("Cannot complete selection because the browser is not operating in the context of a MS Office application. Please load this page in an MS Office application as an add-in."); } } function getBase64FromAsset(url, onSuccess) { var xhr = new XMLHttpRequest(); xhr.responseType = "arraybuffer"; xhr.open("GET", url); xhr.onload = function () { var binary, bytes; bytes = new Uint8Array(xhr.response); binary = [].map.call(bytes, function (byte) { return String.fromCharCode(byte); // May cause "Maximum call stack size exceeded" }).join(''); onSuccess(btoa(binary)); }; xhr.send(); } window.addEventListener("message", captureEvent, false); }); })(jQuery);
/* global Search */ module.exports = function (req, res) { var params = req.allParams(); if (!params.keyword) { return res.view("../search/main", {searchType: 'user', searchTerm: ''}); } var searchData = { keyword: params.keyword }; searchData.skip = params.skip || 0; Search.users(searchData, function (results) { return res.ok(results); }); };
/** * Created by Aurieh#0258 on 26.11.2016. * Extended/Modified by Wolke#6746 */ const MessageCollector = require('./messageCollector'); class Connector { constructor() { this.collectors = {}; } addCollector(channelID, opts) { let id = `${channelID}_${Date.now()}`; let collector = new MessageCollector(channelID, opts); collector.once('stop', () => { delete this.collectors[id]; }); this.collectors[id] = collector; return collector; } invokeAllCollectors(message) { // you basically run this function on every `messageCreate` for (let key in this.collectors) { if (this.collectors.hasOwnProperty(key)) { if (key.startsWith(message.channel.id)) { this.collectors[key].check(message); } } } } } module.exports = Connector;
/** * Copyright (c) 2008 - 2009 * Matthias Weidlich * * 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(!ORYX.Plugins) ORYX.Plugins = new Object(); /** * Transforms a BPEL process into its BPMN representation. * */ ORYX.Plugins.BPEL2BPMN = Clazz.extend({ facade: undefined, /** * Offers the plugin functionality: * */ construct: function(facade) { this.facade = facade; this.facade.offer({ 'name':"Transform BPEL into BPMN", 'functionality': this.transform.bind(this), 'group': 'Export', dropDownGroupIcon: ORYX.PATH + "images/import.png", 'description': "Transform a BPEL process into its BPMN representation", 'index': 1, 'minShape': 0, 'maxShape': 0}); }, /** * Trigger the actual BPEL 2 BPMN transformation. */ transform: function(){ this.openUploadDialog(); }, /** * Opens a upload dialog. * (adapted from the epcSupport plugin) * */ openUploadDialog: function(){ var form = new Ext.form.FormPanel({ frame : false, defaultType : 'textfield', waitMsgTarget : true, labelAlign : 'left', buttonAlign: 'right', fileUpload : true, enctype : 'multipart/form-data', style: 'font-size:12px;', items : [ { fieldLabel : 'File', inputType : 'file', style: 'font-size:12px;', allowBlank: false }] }); var errorMsg = new Ext.Panel({style: 'font-size:12px;', autoScroll: true}); var dialog; dialog = new Ext.Window({ autoCreate: true, title: 'Upload BPEL File', height: 240, width: 400, modal:true, collapsible:false, fixedcenter: true, shadow:true, style: 'font-size:12px;', proxyDrag: true, resizable:true, items: [new Ext.form.Label({text: "Select a BPEL (.bpel) file and transform it to BPMN.", style: 'font-size:12px;'}),form, errorMsg], buttons:[{ text:"Submit", handler: function() { form.form.submit({ clientValidation: false, url: ORYX.PATH + '/bpel2bpmn', waitMsg: "Transforming...", success: function(f,a){ /* * The XML that comes from the server is escaped. Therefore we need to replace the escape symbols once again. */ var myString = a.response.responseText.replace(/&lt;/g,'<').replace(/&gt;/g,'>'); if (myString) { var resultObject = myString.evalJSON(); var eRDF = resultObject.content; var successfulValidation = resultObject.successValidation; var validationError = resultObject.validationError; /* * In case the BPEL file complied to the schema the dialog is hidden. */ if (successfulValidation) { dialog.hide(); } else { /* * In case the BPEL file did not comply to the schema the dialog remains open. */ errorMsg.body.dom.innerHTML = '<p style="background-color: transparent;">Your BPEL file does not comply with the XML schema definition. <br /> <br />Error message: ' + validationError + '</p>'; } /* * In all cases we try to import the resulting eRDF. */ eRDF = '<?xml version="1.0" encoding="utf-8"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:b3mn="http://b3mn.org/2007/b3mn" xmlns:ext="http://b3mn.org/2007/ext" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:atom="http://b3mn.org/2007/atom+xhtml"><head profile="http://purl.org/NET/erdf/profile"><link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /><link rel="schema.dcTerms" href="http://purl.org/dc/terms/ " /><link rel="schema.b3mn" href="http://b3mn.org" /><link rel="schema.oryx" href="http://oryx-editor.org/" /><link rel="schema.raziel" href="http://raziel.org/" /><base href="http://localhost:8080/backend/poem/new" /></head><body>' +eRDF+'</body></html>'; var parser = new DOMParser(); this.facade.importERDF(parser.parseFromString(eRDF ,"text/xml")); } else { /* * Something went totally wrong. No chance to recover. */ Ext.MessageBox.show({ title: 'Error', msg: 'The BPEL file could not be imported.', buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); } }.bind(this), failure: function(f,a){ dialog.hide(); Ext.MessageBox.show({ title: 'Error', msg: a.response.responseText.substring(a.response.responseText.indexOf("content:'")+9, a.response.responseText.indexOf("'}")), buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); }.bind(this) }); }.bind(this) }] }); dialog.on('hide', function(){ dialog.destroy(true); delete dialog; }); dialog.show(); }, });
import React, { Component } from "react"; import { Container, Header, Title, Content, Button, Icon, Left, Right, Body, Text, Subtitle } from "native-base"; import styles from "./styles"; class Header7 extends Component { // eslint-disable-line render() { return ( <Container style={styles.container}> <Header hasSubtitle> <Left> <Button transparent onPress={() => this.props.navigation.goBack()}> <Icon name="arrow-back" /> </Button> </Left> <Body> <Title>Title</Title> <Subtitle>Subtitle</Subtitle> </Body> <Right /> </Header> <Content padder> <Text> Header with Title & Subtitle </Text> </Content> </Container> ); } } export default Header7;