text
stringlengths 2
6.14k
|
|---|
$(document).ready(function () {
});
var play = function () {
mopidy.playback.play({ "tl_track": null }).then(function (data) {
});
}
var pause = function () {
mopidy.playback.pause({}).then(function (data) {
});
}
var resume = function () {
mopidy.playback.resume({}).then(function (data) {
});
}
var stop = function () {
mopidy.playback.stop({}).then(function (data) {
});
}
var skip = function () {
mopidy.playback.next({}).then(function (data) {
});
}
function ChangeVolume(newVol) {
window.mopidy.playback.getVolume().then(function (vol) {
var currentVolume = vol;
console.log('curent vol: ' + currentVolume);
currentVolume = currentVolume + newVol;
mopidy.mixer.setVolume({ "volume": currentVolume }).then(function (data) {
console.log(data);
});
});
};
var shuffleTracklist = function () {
window.mopidy.tracklist.getTracks()
// => tracklist
.then(function (tracklist) {
mopidy.playback.getCurrentTlTrack({}).then(function (currentTlTrack) {
mopidy.tracklist.index({ "tl_track": currentTlTrack }).then(function (currentTlTrackIndex) {
//shuffle tracklist starting from 4 after the current track so:
// currentTlTrackIndex = current track (dont shuffle)
// currentTlTrackIndex +1 = next track (dont shuffle)
// currentTlTrackIndex +2 = 2nd next track (dont shuffle)
// currentTlTrackIndex +3 = 3rd next track (can be shuffled)
if ((tracklist.length - currentTlTrackIndex) > 4) {
mopidy.tracklist.shuffle({ "start": (currentTlTrackIndex + 4), "end": tracklist.length }).then(function (data) {
});
}
});
});
});
}
var PrintTracklist = function () {
window.mopidy.tracklist.getTracks()
.then(function (tracklist) {
$("#tblTracklist").find("tr:gt(0)").remove();
for (var i = 0; i < tracklist.length; ++i) {
if (tracklist[i].artists != null) {
$('#tblTracklist tr:last').after('<tr><td>' + tracklist[i].name + '</td><td>' + tracklist[i].artists[0].name + '</td><td><input type="button" value="X" style="font-size:10px" onclick=RemoveTrackFromTracklist(' + i + ') /></td></tr>');
}
else {
$('#tblTracklist tr:last').after('<tr><td>' + tracklist[i].name + '</td><td> </td><td><input type="button" value="X" style="font-size:10px" onclick=RemoveTrackFromTracklist(' + i + ') /></td></tr>');
}
}
});
}
|
function(from, to) {
if (from > to) {
var arr = this.measure(to, from-to+1);
arr.reverseInPlace();
return arr.sequence();
}
return this.measure(from, to-from+1);
}
|
function tooCool(){
alert(textSpan("It's too Cool!!!"));
}
window["tooCool"]=tooCool;
function compute(){
var a = 0;
var i = 12;
for(var idx = 0; idx > 10; idx++){
a = idx*i+a;
}
return a;
}
|
import Vue from 'vue'
import hello from './components/hello.vue';
import ucenter from './components/ucenter/ucenter.vue'
require('./bootstrap');
require('./less/hello.less');
import store from './store/index'
const app = new Vue({
el: '#app',
store,
components: {
hello, ucenter
}
});
|
$(()=>{
$('#save').click(()=>{
saveData();
});
for(let website in data){
for(let coin in data[website]){
const idOpen = `${website}.${coin}.warn.open`;
const idLow = `${website}.${coin}.warn.low`;
const idHeight = `${website}.${coin}.warn.height`;
const html =
`<li>`+
`<label>${website}</label>`+
`<label>${coin}</label>`+
`<label>${data[website][coin].mark}</label>`+
`<input id="${idLow}" placeholder="低 ${coin}" value="${data[website][coin].warn.low}" type="number"/>`+
`<input id="${idHeight}" placeholder="高 ${coin}" value="${data[website][coin].warn.height}" type="number"/>`+
`<input id="${idOpen}" value="true" type="checkbox" ${data[website][coin].warn.open ?'checked':''} />`+
`</li>`;
$('#setting').append(html);
}
}
});
|
var anim = require("alloy/animation");
var args = arguments[0] || {};
function doClick() {
var t = Ti.UI.create2DMatrix();
t = t.scale(0.5);
var animations = [
Ti.UI.createAnimation({
duration: 1000,
transform: t
})
];
anim.chainAnimate($.imgView, animations, function() {
alert("Finish!");
});
}
$.baseWindow.setTitle(args.title);
|
var http = require("http");
var express = require("express");
var app = express();
var fs = require("fs");
var path = require("path");
var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080;
var mongoClient = require('mongodb').MongoClient,
assert = require('assert');
//var mongodb = "mongodb://localhost:27017/kapparr";
var mongodb = "mongodb://kapparr:123@ds119568.mlab.com:19568/heroku_9pf31s17";
mongoClient.connect(mongodb, function(err, db) {
assert.equal(null, err);
console.log("Connected successfully");
db.close();
});
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/public/index.html'));
});
var re_weburl = new RegExp("^" + "(?:(?:https?|ftp)://)" + "(?:\\S+(?::\\S*)?@)?" + "(?:" + "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" + "(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" + "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))" + "\\.?" + ")" + "(?::\\d{2,5})?" + "(?:[/?#]\\S*)?" + "$", "i");
app.get(/\/api\//, function(req, res) {
var url = req.url.substring(5);
console.log(url);
//res.send(url);
if (url.match(re_weburl)) {
var hash = Math.abs(url.hashCode()).toString(36);
var doc = {
"shortened": hash,
"url": url
};
mongoClient.connect(mongodb, function(err, db) {
findUrl(db, url, function(callback) {
if (callback.length == 0) {
console.log(url + "will be added to DB");
findShortened(db, url, function(callback) {
if (callback.length == 0) {
addDocument(db, doc, function() {
db.close();
});
} else {
doc.shortened = hash + Math.abs(callback.length).toString(36);
addDocument(db, doc, function() {
res.send("http://κ.ga/" + doc.shortened);
db.close();
});
}
});
}
});
});
res.send("http://κ.ga/" + hash);
}
});
app.get(/.*/, function(req, res){
var url = req.url.substring(1);
mongoClient.connect(mongodb, function(err, db){
findShortened(db, url, function(callback){
if(callback.length != 0){
res.redirect(callback[0].url);
}
});
});
//res.send(url);
});
app.listen(port);
console.log('Server running on http://%s:%s', ip, port);
module.exports = app;
var addDocument = function(db, document, callback) {
var collection = db.collection('shorturls');
collection.insertOne(document, function(err, result) {
console.log("inserted one document");
callback();
});
};
var findShortened = function(db, url, callback) {
var collection = db.collection('shorturls');
collection.find({
"shortened": url
}).toArray(function(err, docs) {
assert.equal(err, null);
console.log(docs);
callback(docs);
});
}
var findUrl = function(db, url, callback) {
var collection = db.collection('shorturls');
collection.find({
"url": url
}).toArray(function(err, docs) {
assert.equal(err, null);
callback(docs);
});
}
String.prototype.hashCode = function() {
var hash = 0,
i, chr, len;
if (this.length === 0) return hash;
for (i = 0, len = this.length; i < len; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
};
|
'use strict';
/**
* Parsers are collection of transform streams to processes incoming data
* @summary The default `Parsers` are [Transform streams](https://nodejs.org/api/stream.html#stream_class_stream_transform) that process incoming data. To use the parsers, you must create them and then pipe the Serialport to the parser. Be careful to only write to the SerialPort object and not the parser. Full documentation for parsers can be found in [their api docs](https://node-serialport.github.io/parsers/).
* @typedef {Object} Parsers
* @property {Transform} ByteLength
* @property {Transform} CCtalk
* @property {Transform} Delimiter
* @property {Transform} Readline
* @property {Transform} Ready
* @property {Transform} Regex
* @since 5.0.0
* @example
```js
const SerialPort = require('serialport');
const Readline = SerialPort.parsers.Readline;
const port = new SerialPort('/dev/tty-usbserial1');
const parser = new Readline();
port.pipe(parser);
parser.on('data', console.log);
port.write('ROBOT PLEASE RESPOND\n');
// Creating the parser and piping can be shortened to
// const parser = port.pipe(new Readline());
```
*/
module.exports = {
ByteLength: require('@serialport/parser-byte-length'),
CCTalk: require('@serialport/parser-cctalk'),
Delimiter: require('@serialport/parser-delimiter'),
Readline: require('@serialport/parser-readline'),
Ready: require('@serialport/parser-ready'),
Regex: require('@serialport/parser-regex')
};
|
// @flow
import React from 'react';
export default ({ className = '', ...props }) => (
<i className={`${className} fa fa-close`} {...props} />
);
|
/*
* KnxValueBoolean.js
*
* David Janes
* IOTDB
* 2015-11-29
*/
exports.binding = {
bridge: require('../../KNXBridge').Bridge,
model: require('./model.json'),
discover: false,
};
|
/**
--| ADAPTIVE RUNTIME PLATFORM |----------------------------------------------------------------------------------------
(C) Copyright 2013-2015 Carlos Lozano Diez t/a Adaptive.me <http://adaptive.me>.
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 appli-
-cable 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.
Original author:
* Carlos Lozano Diez
<http://github.com/carloslozano>
<http://twitter.com/adaptivecoder>
<mailto:carlos@adaptive.me>
Contributors:
* Ferran Vila Conesa
<http://github.com/fnva>
<http://twitter.com/ferran_vila>
<mailto:ferran.vila.conesa@gmail.com>
* See source code files for contributors.
Release:
* @version v2.2.15
-------------------------------------------| aut inveniam viam aut faciam |--------------------------------------------
*/
///<reference path="IAdaptiveRPGroup.ts"/>
///<reference path="IBasePIM.ts"/>
///<reference path="IMessagingCallback.ts"/>
/**
------------------------------------| Engineered with ♥ in Barcelona, Catalonia |--------------------------------------
*/
//# sourceMappingURL=IMessaging.js.map
|
/*
* Copyright 2020 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
async function main(modelId, evaluationId, project, location = 'us-central1') {
// [START aiplatform_get_model_evaluation_tabular_classification_sample]
/**
* TODO(developer): Uncomment these variables before running the sample
* (not necessary if passing values as arguments). To obtain evaluationId,
* instantiate the client and run the following the commands.
*/
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
// parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);
// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');
// Specifies the location of the api endpoint
const clientOptions = {
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};
// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);
async function getModelEvaluationTabularClassification() {
// Configure the parent resources
const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
const request = {
name,
};
// Get model evaluation request
const [response] = await modelServiceClient.getModelEvaluation(request);
console.log('Get model evaluation tabular classification response');
console.log(`\tName : ${response.name}`);
console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
console.log(`\tSlice dimensions : ${response.sliceDimensions}`);
const modelExplanation = response.modelExplanation;
console.log('\tModel explanation');
if (!modelExplanation) {
console.log('\t\t{}');
} else {
const meanAttributions = modelExplanation.meanAttributions;
if (!meanAttributions) {
console.log('\t\t\t []');
} else {
for (const meanAttribution of meanAttributions) {
console.log('\t\tMean attribution');
console.log(
`\t\t\tBaseline output value : \
${meanAttribution.baselineOutputValue}`
);
console.log(
`\t\t\tInstance output value : \
${meanAttribution.instanceOutputValue}`
);
console.log(
`\t\t\tFeature attributions : \
${JSON.stringify(meanAttribution.featureAttributions)}`
);
console.log(`\t\t\tOutput index : ${meanAttribution.outputIndex}`);
console.log(
`\t\t\tOutput display name : \
${meanAttribution.outputDisplayName}`
);
console.log(
`\t\t\tApproximation error : \
${meanAttribution.approximationError}`
);
}
}
}
}
getModelEvaluationTabularClassification();
// [END aiplatform_get_model_evaluation_tabular_classification_sample]
}
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
|
var gulp = require('gulp');
var paths = {
scripts: ['js/**/*.js']
};
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new (require('karma').Server)({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('lint', function () {
var jshint = require('gulp-jshint');
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('scripts', function () {
var rename = require("gulp-rename");
return gulp.src("js/allpack.js")
.pipe(require('gulp-requirejs-optimize')({
baseUrl: "./js",
paths: {
circuits: ".",
dojo: "empty:",
dojox: "empty:",
dijit: "empty:"
},
name: "circuits/allpack"
}))
.pipe(rename("circuits-min.js"))
.pipe(gulp.dest('./'));
});
gulp.task('build', function (callback) {
require('run-sequence')('lint', 'test', 'scripts', callback);
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['lint', 'test']);
// Versioning tasks
/**
* Increments a version value within the package json and bower json
*/
function inc(importance) {
var git = require('gulp-git'),
bump = require('gulp-bump'),
filter = require('gulp-filter'),
tag_version = require('gulp-tag-version');
// get all the files to bump version in
return gulp.src(['./package.json', './bower.json'])
// bump the version number in those files
.pipe(bump({type: importance}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('bumps package version'))
// read only one file to get the version number
.pipe(filter('package.json'))
// **tag it in the repository**
.pipe(tag_version());
}
gulp.task('patch', function() { return inc('patch'); })
gulp.task('feature', function() { return inc('minor'); })
gulp.task('release', function() { return inc('major'); })
|
'use strict';
/**
* @ngdoc function
* @name sbAdminApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the sbAdminApp
*/
angular.module('sbAdminApp')
.controller('StoreController', function(StoreDataService, $stateParams) {
var vm = this;
// get store and cart from service
vm.store = StoreDataService.store;
vm.cart = StoreDataService.cart;
// use routing to pick the selected product
if ($stateParams.productSku != null) {
vm.product = vm.store.getProduct($stateParams.productSku);
}
});
|
var Tempest = Tempest || {};
Tempest.Boot = function(){};
//setting game configuration and loading the assets for the loading screen
Tempest.Boot.prototype = {
preload: function() {
//assets we'll use in the loading screen
var loadingbar = this.load.image('preloadbar', 'images/loadingbar.png');
},
create: function() {
// Set game to automatically resize
this.scale.scaleMode = Phaser.ScaleManager.RESIZE;
this.scale.parentIsWindow = true;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
// Set background color
// this.stage.backgroundColor = '#09f';
this.stage.backgroundColor = '#000';
//scaling options
//have the game centered horizontally
//screen size will be set automatically
// this.scale.setScreenSize(true); // This function no longer exists in Phaser
//physics system
// game.physics.startSystem(Phaser.Physics.ARCADE);
this.state.start('Preload');
}
};
|
import React from "react";
import { observer } from "mobx-react";
import Image from "components/common/Image";
import yellow from
"assets/images/traffic_light_indicator/yellow_background.png";
import green from
"assets/images/traffic_light_indicator/green_background.png";
import red from
"assets/images/traffic_light_indicator/red_background.png";
@observer
export default class TrafficLightIndicator extends React.Component {
render() {
// TODO actually implement render "traffic light on".
return (
<div className="traffic-light-indicator">
<Image image={green} className="green" />
<Image image={yellow} className="yellow" />
<Image image={red} className="red" />
<span className="traffic-light-label-text label-text">
Traffic Signal
</span>
</div>
);
}
}
|
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
var textField =Ti.UI.createTextField ({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
color: '#336699',
top: 10, left: 10,
width: 250, height: 60
});
win2.add(label2);
win2.add(textField);
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
|
sap.ui.jsview("ui.default", {
getControllerName: function() {
return "ui.default";
},
createContent: function(oController) {
oController.oShell = new sap.ui.ux3.Shell("myShell", {
appIcon: "./ui/images/sap_18.png",
appIconTooltip: "SAP",
appTitle: oBundle.getText("console"),
showLogoutButton: true,
logout: function() {
oController.logout();
},
showInspectorTool: false,
showFeederTool: false,
showSearchTool: false,
worksetItems: [new sap.ui.ux3.NavigationItem("wi_home", {
key: "wi_home",
text: oBundle.getText("worklist")
})]
});
// oController.oShell.attachLogout(oController.handleExitShell);
createShell(oController);
buildShellPersonalization(oController);
var oDataGenView = sap.ui.view({
id: "epm_datagen_view",
viewName: "ui.DataGen",
type: sap.ui.core.mvc.ViewType.JS
});
var oLayout = new sap.ui.commons.layout.MatrixLayout();
oLayout.createRow(oDataGenView);
oController.oShell.setContent(oLayout);
return oController.oShell;
}
});
function createShell(oController) {
var oUserTxt = new sap.ui.commons.TextView({
tooltip: oBundle.getText("welcome")
});
oController.oShell.addHeaderItem(oUserTxt);
oController.getSessionInfo(oController, oUserTxt);
oController.oShell.addHeaderItem(new sap.ui.commons.Button({
text: oBundle.getText("personalize"),
tooltip: oBundle.getText("personalize"),
press: oController.handlePersonalizeShell
}));
oController.oShell.addHeaderItem(new sap.ui.commons.MenuButton({
text: oBundle.getText("help"),
tooltip: oBundle.getText("helpm"),
menu: new sap.ui.commons.Menu("menu1", {
items: [new sap.ui.commons.MenuItem("menuitem1", {
text: oBundle.getText("help")
}), new sap.ui.commons.MenuItem("menuitem2", {
text: oBundle.getText("incident")
}), new sap.ui.commons.MenuItem("menuitem3", {
text: oBundle.getText("about")
})]
})
}));
}
function buildShellPersonalization(oController) {
oController.oShell._getPersonalization().attachPersonalizationChange(
oController.handlePersonalizeShellChange);
// initialize settings
if (JSON && window["localStorage"]) { // only in browsers with native JSON
// and offline storage support
var sSettings = localStorage.getItem("sapUiShellTestSettings");
if (sSettings) {
oController.oShell.initializePersonalization(JSON.parse(sSettings));
}
}
}
|
var classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest =
[
[ "setUp", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.html#a2dce61fc6869e60bcb0f5be7616b985d", null ],
[ "testDeviceAnnotation", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.html#aea5c73ac191d40a0a4986ed2bdb6a751", null ],
[ "testDeviceTypes", "classorg_1_1onosproject_1_1provider_1_1lldp_1_1impl_1_1SuppressionConfigTest.html#add66c76a6bf03715757f058c32cf5e34", null ]
];
|
/** @externs */
/**
* @externs
* @suppress {duplicate,checkTypes}
*/
// NOTE: generated by tsickle, do not edit.
// externs from /private/var/folders/7d/r6b3nrdj7bn9t_w_dclm6y9r00kg80/T/angular-release-latest.XXXXXXX.FjdRL2Ds/sandbox/darwin-sandbox/169/execroot/angular/packages/core/src/render3/interfaces/player.ts:
/** @const */
var angular$packages$core$src$render3$interfaces$player = {};
/** @typedef {?} */
angular$packages$core$src$render3$interfaces$player.ComponentInstance;
/** @typedef {?} */
angular$packages$core$src$render3$interfaces$player.DirectiveInstance;
// externs from /private/var/folders/7d/r6b3nrdj7bn9t_w_dclm6y9r00kg80/T/angular-release-latest.XXXXXXX.FjdRL2Ds/sandbox/darwin-sandbox/169/execroot/angular/packages/core/src/render3/util/global_utils.ts:
/** @const */
var angular$packages$core$src$render3$util$global_utils = {};
/** @typedef {?} */
angular$packages$core$src$render3$util$global_utils.GlobalDevModeContainer;
// externs from /private/var/folders/7d/r6b3nrdj7bn9t_w_dclm6y9r00kg80/T/angular-release-latest.XXXXXXX.FjdRL2Ds/sandbox/darwin-sandbox/169/execroot/angular/packages/core/src/linker/system_js_ng_module_factory_loader.ts:
/** @const */
var angular$packages$core$src$linker$system_js_ng_module_factory_loader = {};
/** @type {?} */
var System;
// externs from /private/var/folders/7d/r6b3nrdj7bn9t_w_dclm6y9r00kg80/T/angular-release-latest.XXXXXXX.FjdRL2Ds/sandbox/darwin-sandbox/169/execroot/angular/packages/core/src/testability/testability.ts:
/** @const */
var angular$packages$core$src$testability$testability = {};
/**
* @record
* @struct
*/
angular$packages$core$src$testability$testability.PublicTestability = function() {};
/**
* @return {?}
*/
angular$packages$core$src$testability$testability.PublicTestability.prototype.isStable = function() {};
/**
* @param {?} callback
* @param {?=} timeout
* @param {?=} updateCallback
* @return {?}
*/
angular$packages$core$src$testability$testability.PublicTestability.prototype.whenStable = function(callback, timeout, updateCallback) {};
/**
* @param {?} using
* @param {?} provider
* @param {?} exactMatch
* @return {?}
*/
angular$packages$core$src$testability$testability.PublicTestability.prototype.findProviders = function(using, provider, exactMatch) {};
|
/* global QUnit */
sap.ui.define([
"sap/ui/fl/Layer",
"sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory",
"sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory",
"sap/ui/rta/command/CommandFactory",
"sap/m/Button",
"sap/ui/base/ManagedObject",
"sap/ui/thirdparty/sinon-4",
"test-resources/sap/ui/rta/qunit/RtaQunitUtils"
], function(
Layer,
AppVariantInlineChangeFactory,
DescriptorChangeFactory,
CommandFactory,
Button,
ManagedObject,
sinon,
RtaQunitUtils
) {
"use strict";
QUnit.module("Given the parameters required to create an app descriptor change...", {
before: function () {
this.oMockedAppComponent = RtaQunitUtils.createAndStubAppComponent(sinon);
},
after: function () {
this.oMockedAppComponent._restoreGetAppComponentStub();
this.oMockedAppComponent.destroy();
},
beforeEach: function () {
this.sReference = "appReference";
this.mFlexSettings = {
layer: Layer.CUSTOMER
};
this.sChangeType = "dummyChangeType";
this.mParameters = {
dataSource: {
source1: {
uri: "/sap/opu/odata/snce/PO_S_SRV;v=2/"
}
}
};
this.mTexts = {
"customer.newid_sap.ovp.cards.customer.fancy_card.settings.category": {
type: "XTIT",
maxLength: 20,
comment: "example",
value: {
"": "Category example default text",
en: "Category example text in en",
de: "Kategorie Beispieltext in de"
}
}
};
this.oButton = new Button("myButton");
},
afterEach: function () {
this.oButton.destroy();
}
}, function () {
QUnit.test("when calling command factory for a generic app descriptor change type ...", function(assert) {
var done = assert.async();
var fnAssertSpy = sinon.spy(ManagedObject.prototype, "applySettings");
var oMockDescriptorInlineChange = {
mockName: "mocked"
};
var oMockDescriptorChange = {
store: function() {
assert.ok(true, "the descriptor change was submitted");
var mPassedSettings = fnAssertSpy.getCall(0).args[0];
var bHasSelector = Object.keys(mPassedSettings).some(function(sKey) {
return sKey === "selector";
});
assert.notOk(bHasSelector, "the selector is not part of the passed settings");
fnAssertSpy.restore();
done();
}
};
this.createDescriptorInlineChangeStub = sinon.stub(AppVariantInlineChangeFactory, "createDescriptorInlineChange").callsFake(function(mPropertyBag) {
assert.equal(mPropertyBag.changeType, this.sChangeType, "change type is properly passed to the 'createDescriptorInlineChange' function");
assert.equal(mPropertyBag.content, this.mParameters, "parameters are properly passed to the 'createDescriptorInlineChange' function");
assert.equal(mPropertyBag.texts, this.mTexts, "texts are properly passed to the 'createDescriptorInlineChange' function");
this.createDescriptorInlineChangeStub.restore();
return Promise.resolve(oMockDescriptorInlineChange);
}.bind(this));
this.createNewChangeStub = sinon.stub(DescriptorChangeFactory.prototype, "createNew").callsFake(function (sReference, oInlineChange, sLayer, oAppComponent) {
assert.equal(sReference, this.sReference, "reference is properly passed to createNew function");
assert.equal(oInlineChange.mockName, oMockDescriptorInlineChange.mockName, "Inline Change is properly passed to createNew function");
assert.equal(sLayer, this.sLayer, "layer is properly passed to createNew function");
assert.equal(oAppComponent, this.oMockedAppComponent, "App Component is properly passed to createNew function");
this.createNewChangeStub.restore();
return Promise.resolve(oMockDescriptorChange);
}.bind(this));
return CommandFactory.getCommandFor(this.oButton, "appDescriptor", {
reference: this.sReference,
parameters: this.mParameters,
texts: this.mTexts,
changeType: this.sChangeType,
appComponent: this.oMockedAppComponent
}, {}, {layer: this.sLayer})
.then(function(oAppDescriptorCommand) {
assert.ok(oAppDescriptorCommand, "App Descriptor command exists for element");
assert.ok(oAppDescriptorCommand.needsReload, "App Descriptor commands need restart to be applied");
oAppDescriptorCommand.createAndStoreChange();
})
.catch(function (oError) {
assert.ok(false, "catch must never be called - Error: " + oError);
});
});
QUnit.test("when calling command factory for a addLibraries app descriptor and adding composite command id ...", function(assert) {
var sCompositeCommandId = "my-fancy-new-composite-command";
return CommandFactory.getCommandFor(this.oButton, "appDescriptor", {
reference: this.sReference,
parameters: {
libraries: {}
},
texts: this.mTexts,
changeType: "create_ui5_addLibraries",
appComponent: this.oMockedAppComponent
}, {}, {layer: this.sLayer})
.then(function(oAppDescriptorCommand) {
oAppDescriptorCommand.setCompositeId(sCompositeCommandId);
assert.ok(oAppDescriptorCommand, "App Descriptor command exists for element");
return oAppDescriptorCommand.createAndStoreChange()
.then(function () {
var oStoredChange = oAppDescriptorCommand.getPreparedChange();
assert.strictEqual(oStoredChange.getDefinition().support.compositeCommand, sCompositeCommandId, "then composite command id is attached to the change definition");
});
})
.catch(function (oError) {
assert.ok(false, "catch must never be called - Error: " + oError);
});
});
});
QUnit.done(function () {
jQuery("#qunit-fixture").hide();
});
});
|
import { mount } from '@cypress/vue';
import Vuex from 'vuex';
import quicklinks from '../../../vuex/store/quicklinks';
import Quicklinks from './quicklinks.vue';
describe('<Quicklinks />', () => {
it('Verify adding/removing links works', () => {
// Load data from a fixture ('another name for mock data, all fixture are
// stored inside cypress/fixtures') then use that data
cy.fixture('quicklinks/quicklinks.json').then((mockQuicklinks) => {
// Sets up the mock response from the resources api
cy.intercept(
{method: 'GET', url: '/api/v1/link/'},
mockQuicklinks,
);
});
// `createLocalVue` is a custom helper that sets up a local vue instance
// populated with all the plugins and mixins
cy.createLocalVue(Vuex).then((localVue) => {
let store = new Vuex.Store({
modules: {
quicklinks,
},
state: {
csrfToken: "dfsdfsgfsdg",
},
});
// Mount the Notices component with store instance and the localVue
// instance
mount(Quicklinks, {store, localVue}).then(() => {
// A custom helper that will wait for a components card to have some condition
// in this case the card's isReady or isErrored needs to be true
cy.componentWaitUntil((vm) => vm.isReady || vm.isErrored);
cy.intercept(
{method: 'POST', url: '/api/v1/link'},
);
// TODO: take image snapshot here
// cy.invm((vm) => vm.resources).should('have.length', 9);
// cy.get('.card').should('have.length', 29);
// cy.get('button').should('have.length', 30);
// // Scroll to bottom and click TOP button to take user back
// cy.window().scrollTo('bottom');
// cy.wait(800);
// cy.get('button').last().click();
// cy.window().its('scrollY').should('equal', 0);
// // Test pinning and unpinning
// // The 'Advising & Tutoring' card is unpinned by default and is the first card
// cy.get('.card').its(0).find('button').contains('Pin to Home');
// cy.get('.card').its(0).find('button').click();
// cy.get('.card').its(0).find('button').contains('Unpin');
// cy.get('.card').its(0).find('button').click();
// cy.get('.card').its(0).find('button').contains('Pin to Home');
});
});
});
});
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**
* Return an array of an object's own and inherited enumerable property names and symbols.
*
* @module @stdlib/utils/enumerable-properties-in
*
* @example
* var enumerablePropertiesIn = require( '@stdlib/utils/enumerable-properties-in' );
*
* var props = enumerablePropertiesIn( [] );
* // returns [...]
*/
// MODULES //
var main = require( './main.js' );
// EXPORTS //
module.exports = main;
|
import fs from 'fs';
import cheerio from 'cheerio';
import colors from 'colors';
/*eslint-disable no-console */
fs.readFile('index.html', 'utf8', (err, markup) => {
if (err) {
return console.log(err);
}
const $ = cheerio.load(markup);
$('head').prepend('');
fs.writeFile('public/index.html', $.html(), 'utf8', function (err) {
if (err) {
return console.log(err);
}
console.log('index.html written to /public'.green);
});
});
|
angular.module('ReportModule', ['ngRoute']).
// config(['$locationProvider', function($locationProvider) {
// $locationProvider.html5Mode(true);
// }]).
controller('ReportController', ['$scope', '$http', '$location', function($scope, $http, $location) {
$scope.leasing = [];
$scope.service = [];
$scope.defaulter = [];
// use a range of 6 months
var date = new Date();
var year = date.getFullYear();
var firstMonth = year + '-' + (date.getMonth() - 5) + '-01';
var lastMonth = year + '-' + (date.getMonth() + 1) + '-01';
function initLeasing() {
$http.get('../res/php/reports.php?action=getLeasingReport&firstMonth='+(date.getMonth() - 5)+"&lastMonth="+(date.getMonth() + 1)).
success(function(data) {
$scope.leasing = data;
});
};
function initDefaulters() {
$http.get('../res/php/reports.php?action=getServiceReport&firstMonth='+firstMonth+"&lastMonth="+lastMonth).
success(function(data) {
$scope.service = data;
});
};
function initService() {
$http.get('../res/php/reports.php?action=getRentDefaultersReport&selectedMonth='+lastMonth).
success(function(data) {
$scope.defaulter = data;
});
};
initLeasing();
initDefaulters();
initService();
}]);
|
/**
* Blockly Apps: Index
*
* Copyright 2012 Google Inc.
* http://blockly.googlecode.com/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview JavaScript for Blockly's application index.
* @author ellen.spertus@gmail.com (Ellen Spertus)
*/
'use strict';
var BlocklyAppsIndex = {};
// Supported languages.
BlocklyApps.LANGUAGES = [
'ar', 'ca', 'da', 'de', 'el', 'en', 'es', 'fa', 'fr', 'hu', 'is', 'it', 'ko',
'nl', 'pt-br', 'ro', 'ru', 'sv', 'tr', 'uk', 'vi', 'zh-hans', 'zh-hant'];
BlocklyApps.LANG = BlocklyApps.getLang();
// Relative directory "index/" needed because index.html is in parent directory.
document.write('<script type="text/javascript" src="index/generated/' +
BlocklyApps.LANG + '.js"></script>\n');
window.addEventListener('load', BlocklyApps.init);
|
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define(["Handlebars"], function (a0) {
return (factory(a0));
});
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("Handlebars"));
} else {
root['Languagemenu'] = factory(root["Handlebars"]);
}
}(this, function (Handlebars) {
return { "renderState":Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
return "<ul class=\"dropdown-content blue-grey white-text\">\n <li class=\"divider\"></li>\n <li><a lang=\"en\" href=\"javascript:false;\" class=\"white-text\">English / English</a></li>\n <li><a lang=\"de\" href=\"javascript:false;\" class=\"white-text\">German / Deutsch</a></li>\n </ul>";
},"useData":true}), "onAttach":function(node) { $('.dropdown-button').filter('[data-activates="language-menu"]').dropdown();
$(node).on('click', function(e) {
var lang = $(e.target).attr('lang');
if ( lang ) this.select(lang);
}.bind(this));},"onUpdate":undefined,"onDetach":undefined};
}));
|
if (typeof PATH_TO_THE_REPO_PATH_UTILS_FILE === 'undefined') {
PATH_TO_THE_REPO_PATH_UTILS_FILE = "https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js";
Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);
nitpick = createNitpick(Script.resolvePath("."));
}
nitpick.perform("Text Entity topMargin", Script.resolvePath("."), "secondary", undefined, function(testType) {
Script.include(nitpick.getUtilsRootPath() + "test_stage.js");
var LIFETIME = 200;
// Add the test Cases
var initData = {
flags: {
hasKeyLight: true,
hasAmbientLight: true
},
lifetime: LIFETIME,
originFrame: nitpick.getOriginFrame()
};
var createdEntities = setupStage(initData);
var posOri = getStagePosOriAt(0, 0, 0);
function getPos(col, row) {
var center = posOri.pos;
return Vec3.sum(Vec3.sum(center, Vec3.multiply(Quat.getRight(MyAvatar.orientation), col)),
Vec3.multiply(Quat.getUp(MyAvatar.orientation), row));
}
createdEntities.push(Entities.addEntity({
type: "Text",
position: getPos(-0.5, 1),
dimensions: 1.0,
text: "test",
lineHeight: 0.3,
topMargin: 0.0,
lifetime: LIFETIME
}));
createdEntities.push(Entities.addEntity({
type: "Text",
position: getPos(0.5, 1),
dimensions: 1.0,
text: "test",
lineHeight: 0.3,
topMargin: 0.2,
lifetime: LIFETIME
}));
nitpick.addStepSnapshot("Take snapshot");
nitpick.addStep("Clean up after test", function () {
for (var i = 0; i < createdEntities.length; i++) {
Entities.deleteEntity(createdEntities[i]);
}
});
var result = nitpick.runTest(testType);
});
|
sap.ui.define(['sap/ui/core/UIComponent'],
function(UIComponent) {
"use strict";
return UIComponent.extend("sap.ui.layout.sample.FixFlexHorizontal.Component", {
metadata : {
manifest: "json"
}
});
});
|
'use strict';
var arrayBufferSerialization = require('./arrayBufferSerialization');
function isArrayEmpty(array) {
array = new Int8Array(array);
for (var i = 0; i < array.length; i++) {
if (array[i] !== 0) {
return false;
}
}
return true;
}
function xorArrays(array1, array2) {
array1 = new Int8Array(array1);
array2 = new Int8Array(array2);
var xored = new Int8Array(Math.max(array1.length, array2.length));
for (var i = 0; i < xored.length; i++) {
xored[i] = (array1[i] || 0) ^ (array2[i] || 0);
}
return xored.buffer;
}
function bucket(count, xor, hash) {
function items() {
return count;
}
function xored() {
return xor;
}
function hashed() {
return hash;
}
function modify(variation, content, digest) {
return bucket(count + variation, xorArrays(xor, content), xorArrays(hash, digest));
}
function group(other) {
return modify(other.items(), other.xored(), other.hashed());
}
function toJSON() {
return [count, arrayBufferSerialization.toString(xor), arrayBufferSerialization.toString(hash)];
}
function isEmpty() {
return (count === 0) && (isArrayEmpty(hash));
}
return {
group : group,
items : items,
xored : xored,
hashed : hashed,
isEmpty : isEmpty,
toJSON : toJSON,
modify : modify
};
}
var emptyBucket = bucket(0, new ArrayBuffer(0), new ArrayBuffer(0));
function fromJSON(json) {
return bucket(json[0], arrayBufferSerialization.fromString(json[1]), arrayBufferSerialization.fromString(json[2]));
}
emptyBucket.fromJSON = fromJSON;
module.exports = emptyBucket;
|
/* Copyright 2017 Mozilla Foundation
*
* 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.
*/
import { CMapCompressionType, isNodeJS } from '../../src/shared/util';
import { isRef } from '../../src/core/primitives';
class NodeFileReaderFactory {
static fetch(params) {
var fs = require('fs');
var file = fs.readFileSync(params.path);
return new Uint8Array(file);
}
}
const TEST_PDFS_PATH = {
dom: '../pdfs/',
node: './test/pdfs/',
};
function buildGetDocumentParams(filename, options) {
let params = Object.create(null);
if (isNodeJS()) {
params.data = NodeFileReaderFactory.fetch({
path: TEST_PDFS_PATH.node + filename,
});
} else {
params.url = new URL(TEST_PDFS_PATH.dom + filename, window.location).href;
}
for (let option in options) {
params[option] = options[option];
}
return params;
}
class NodeCMapReaderFactory {
constructor({ baseUrl = null, isCompressed = false, }) {
this.baseUrl = baseUrl;
this.isCompressed = isCompressed;
}
fetch({ name, }) {
if (!name) {
return Promise.reject(new Error('CMap name must be specified.'));
}
return new Promise((resolve, reject) => {
let url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
let fs = require('fs');
fs.readFile(url, (error, data) => {
if (error || !data) {
reject(new Error('Unable to load ' +
(this.isCompressed ? 'binary ' : '') +
'CMap at: ' + url));
return;
}
resolve({
cMapData: new Uint8Array(data),
compressionType: this.isCompressed ?
CMapCompressionType.BINARY : CMapCompressionType.NONE,
});
});
});
}
}
class XRefMock {
constructor(array) {
this._map = Object.create(null);
for (let key in array) {
let obj = array[key];
this._map[obj.ref.toString()] = obj.data;
}
}
fetch(ref) {
return this._map[ref.toString()];
}
fetchAsync(ref) {
return Promise.resolve(this.fetch(ref));
}
fetchIfRef(obj) {
if (!isRef(obj)) {
return obj;
}
return this.fetch(obj);
}
fetchIfRefAsync(obj) {
return Promise.resolve(this.fetchIfRef(obj));
}
}
export {
NodeFileReaderFactory,
NodeCMapReaderFactory,
XRefMock,
buildGetDocumentParams,
TEST_PDFS_PATH,
};
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// MODULES //
var tape = require( 'tape' );
var isNegativeNumber = require( './../lib' );
// TESTS //
tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.equal( typeof isNegativeNumber, 'function', 'main export is a function' );
t.end();
});
tape( 'attached to the main export is a method to test for a primitive number having a negative value', function test( t ) {
t.equal( typeof isNegativeNumber.isPrimitive, 'function', 'export is a function' );
t.end();
});
tape( 'attached to the main export is a method to test for a number object having a negative value', function test( t ) {
t.equal( typeof isNegativeNumber.isObject, 'function', 'export is a function' );
t.end();
});
|
var app = angular.module('app', []);
app.directive('codex', function($timeout){
return {
restrict: 'A',
scope: {
content: '='
},
transclude: true,
replace: true,
template: '<div></div>',
compile: function(tElement, tAttrs, transclude){
return function(scope, element, attrs, ctrl, transclude){
var content;
var hl = function(content){
$(element).html($('<pre class="'+(attrs.codex || '')+'"><code></code></pre>'));
$(element).find('pre code').text(content);
hljs.highlightBlock($(element).find('pre')[0], {
languages: ['javascript']
});
}
transclude(scope.$new(), function(el){
content = el[0].innerText;
scope.content = content;
});
scope.$watch('content',
function(newValue, oldValue) {
hl(newValue);
}
);
}
}
};
})
|
/**
* Created by IntelliJ IDEA.
* User: deepthi.kulkarni
* Date: 27/07/13
* Time: 1:19 PM
* To change this template use File | Settings | File Templates.
*/
var createRuleUrl = '/alertz/scheduledRules';
var getTeamsUrl = '/alertz/teams/scheduledRules';
$(document).ready(function () {
$("#teams").typeahead({source: getTeams()});
$('#headerPlaceHolder').load("/header.html");
initDatePicker();
initPopOver();
$('#ruleTemplate').load("/ruleTemplate.html", function(){
ko.applyBindings(new CreateRuleModel());
});
});
function CreateRuleModel() {
var self = this;
self.content = {};
self.jsonData = ko.observable(self.content);
self.content.name = ko.observable();
self.content.team = ko.observable();
self.content.dataSerieses = ko.observableArray([{
name: "",
source: "",
query: ""
}]);
self.content.addDataSeries = function() {
self.content.dataSerieses.push({
name: "",
source: "",
query: ""
});
};
self.content.removeDataSeries = function() {
self.content.dataSerieses.pop();
};
self.content.variables = ko.observableArray([{
name: "",
value: ""
}]);
self.content.addVariables = function() {
self.content.variables.push({
name: "",
value: ""
});
};
self.content.removeVariables = function() {
self.content.variables.pop();
};
self.content.checks = ko.observableArray([{
description: "",
booleanExpression: "",
alertLevel:""
}]);
self.content.addChecks = function() {
self.content.checks.push({
description: "",
booleanExpression: "",
alertLevel:""
});
};
self.content.removeChecks = function() {
self.content.checks.pop();
};
self.content.endPoints = ko.observableArray([{
type: "NAGIOS",
publishAlways: true,
endPointParams: ko.observableArray([]),
changeContent: function(el) {
var i = 0;
self.content.endPoints()[i].type = el.type;
self.content.endPoints()[i].publishAlways = false;
if(el.type == 'MAIL') {
self.content.endPoints()[i].endPointParams([{"name":"to", value:""}]);
} else {
self.content.endPoints()[i].endPointParams([]);
}
}
}]);
// $.each(self.content.endPoints(), function(i, data){
// self.content.endPoints()[i].endPointParams = ko.observableArray(self.content.endPoints()[i].endPointParams);
//
// self.content.endPoints()[i].changeContent = function(el) {
// console.log(el);
// self.content.endPoints()[i].type = el.type;
// self.content.endPoints()[i].publishAlways = false;
//
// if(el.type == 'MAIL') {
// self.content.endPoints()[i].endPointParams([{"name":"to", value:""}]);
// } else {
// self.content.endPoints()[i].endPointParams([]);
// }
// console.log(self.content.endPoints());
// }
//
// });
self.endPointTypes = ["MAIL","NAGIOS"];
self.dataSources = getMetricSourceNames();
self.content.addEndPoints = function() {
self.content.endPoints.push({
type: "NAGIOS",
publishAlways: true,
endPointParams: ko.observableArray([]),
changeContent: function(el) {
var i = self.content.endPoints().length-1;
self.content.endPoints()[i].type = el.type;
self.content.endPoints()[i].publishAlways = false;
if(el.type == 'MAIL') {
self.content.endPoints()[i].endPointParams([{"name":"to", value:""}]);
} else {
self.content.endPoints()[i].endPointParams([]);
}
}
});
};
self.content.removeEndPoints = function() {
self.content.endPoints.pop();
};
self.content.schedule = ko.observable({
startDate: ko.observable(""),
endDate: ko.observable(""),
interval: ko.observable(""),
dates: ko.observable(null),
days: ko.observable(null),
times: ko.observable(null),
startDateFormat: function(selected) {
var newDate = new Date(selected);
console.log("here");
var formattedDate = $.datepicker.formatDate("yy-mm-dd", new Date(newDate.setDate(newDate.getDate() + 1)));
$("#endDate").datepicker("option","minDate", formattedDate);
self.content.schedule().startDate(selected);
},
endDateFormat: function(selected) {
var newDate = new Date(selected);
console.log("and here");
var formattedDate = $.datepicker.formatDate("yy-mm-dd", new Date(newDate.setDate(newDate.getDate() - 1)));
$("#startDate").datepicker("option","maxDate", formattedDate);
self.content.schedule().endDate(selected);
}
});
self.content.save = function(){
var jsonDataOfModel = ko.toJSON(self.jsonData);
console.log("JSON used for Create Rule", jsonDataOfModel);
createRule(self.content.name(), jsonDataOfModel);
};
console.log(self);
}
|
// Ensure text search metadata is not lost in an external sort
var t = db.external_sort_text_agg;
t.drop();
t.ensureIndex({text: "text"});
for (i = 0; i < 100; i++) {
t.insert({_id: i, text: Array(210000).join("asdf ")});
// string over 1MB to hit the 100MB threshold for external sort
}
var score = t.find({$text: {$search: "asdf"}}, {score: {$meta: 'textScore'}}).next().score;
var res = t.aggregate(
[
{$match: {$text: {$search: "asdf"}}},
{$sort: {"_id": 1}},
{$project: {string: "$text", score: {$meta: "textScore"}}}
],
{allowDiskUse: true});
// we must use .next() rather than a $limit because a $limit will optimize away the external sort
printjson(res.next());
assert.eq(res.next().score, score);
|
/**
* simplePagination.js v1.5
* A simple jQuery pagination plugin.
* http://flaviusmatis.github.com/simplePagination.js/
*
* Copyright 2012, Flavius Matis
* Released under the MIT license.
* http://flaviusmatis.github.com/license.html
*/
(function($){
var methods = {
init: function(options) {
var o = $.extend({
items: 1,
itemsOnPage: 1,
pages: 0,
displayedPages: 5,
edges: 2,
currentPage: 1,
hrefTextPrefix: '#page-',
hrefTextSuffix: '',
prevText: '上一页',
nextText: '下一页',
ellipseText: '…',
cssStyle: 'light-theme',
selectOnClick: true,
onPageClick: function(pageNumber, event) {
// Callback triggered when a page is clicked
// Page number is given as an optional parameter
},
onInit: function() {
// Callback triggered immediately after initialization
}
}, options || {});
var self = this;
o.pages = o.pages ? o.pages : Math.ceil(o.items / o.itemsOnPage) ? Math.ceil(o.items / o.itemsOnPage) : 1;
o.currentPage = o.currentPage - 1;
o.halfDisplayed = o.displayedPages / 2;
this.each(function() {
self.addClass(o.cssStyle + ' simple-pagination').data('pagination', o);
methods._draw.call(self);
});
o.onInit();
return this;
},
selectPage: function(page) {
methods._selectPage.call(this, page - 1);
return this;
},
prevPage: function() {
var o = this.data('pagination');
if (o.currentPage > 0) {
methods._selectPage.call(this, o.currentPage - 1);
}
return this;
},
nextPage: function() {
var o = this.data('pagination');
if (o.currentPage < o.pages - 1) {
methods._selectPage.call(this, o.currentPage + 1);
}
return this;
},
getPagesCount: function() {
return this.data('pagination').pages;
},
getCurrentPage: function () {
return this.data('pagination').currentPage + 1;
},
destroy: function(){
this.empty();
return this;
},
redraw: function(){
methods._draw.call(this);
return this;
},
disable: function(){
var o = this.data('pagination');
o.disabled = true;
this.data('pagination', o);
methods._draw.call(this);
return this;
},
enable: function(){
var o = this.data('pagination');
o.disabled = false;
this.data('pagination', o);
methods._draw.call(this);
return this;
},
_draw: function() {
var o = this.data('pagination'),
interval = methods._getInterval(o),
i;
methods.destroy.call(this);
var $panel = this.prop("tagName") === "UL" ? this : $('<ul></ul>').appendTo(this);
// Generate Prev link
if (o.prevText) {
methods._appendItem.call(this, o.currentPage - 1, {text: o.prevText, classes: 'prev'});
}
// Generate start edges
if (interval.start > 0 && o.edges > 0) {
var end = Math.min(o.edges, interval.start);
for (i = 0; i < end; i++) {
methods._appendItem.call(this, i);
}
if (o.edges < interval.start && (interval.start - o.edges != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (interval.start - o.edges == 1) {
methods._appendItem.call(this, o.edges);
}
}
// Generate interval links
for (i = interval.start; i < interval.end; i++) {
methods._appendItem.call(this, i);
}
// Generate end edges
if (interval.end < o.pages && o.edges > 0) {
if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (o.pages - o.edges - interval.end == 1) {
methods._appendItem.call(this, interval.end++);
}
var begin = Math.max(o.pages - o.edges, interval.end);
for (i = begin; i < o.pages; i++) {
methods._appendItem.call(this, i);
}
}
// Generate Next link
if (o.nextText) {
methods._appendItem.call(this, o.currentPage + 1, {text: o.nextText, classes: 'next'});
}
},
_getInterval: function(o) {
return {
start: Math.ceil(o.currentPage > o.halfDisplayed ? Math.max(Math.min(o.currentPage - o.halfDisplayed, (o.pages - o.displayedPages)), 0) : 0),
end: Math.ceil(o.currentPage > o.halfDisplayed ? Math.min(o.currentPage + o.halfDisplayed, o.pages) : Math.min(o.displayedPages, o.pages))
};
},
_appendItem: function(pageIndex, opts) {
var self = this, options, $link, o = self.data('pagination'), $linkWrapper = $('<li></li>'), $ul = self.find('ul');
pageIndex = pageIndex < 0 ? 0 : (pageIndex < o.pages ? pageIndex : o.pages - 1);
options = $.extend({
text: pageIndex + 1,
classes: ''
}, opts || {});
if (pageIndex == o.currentPage || o.disabled) {
if (o.disabled) {
$linkWrapper.addClass('disabled');
} else {
$linkWrapper.addClass('active');
}
$link = $('<span class="current">' + (options.text) + '</span>');
} else {
$link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link">' + (options.text) + '</a>');
$link.click(function(event){
return methods._selectPage.call(self, pageIndex, event);
});
}
if (options.classes) {
$link.addClass(options.classes);
}
$linkWrapper.append($link);
if ($ul.length) {
$ul.append($linkWrapper);
} else {
self.append($linkWrapper);
}
},
_selectPage: function(pageIndex, event) {
var o = this.data('pagination');
o.currentPage = pageIndex;
if (o.selectOnClick) {
methods._draw.call(this);
}
return o.onPageClick(pageIndex + 1, event);
}
};
$.fn.pagination = function(method) {
// Method calling logic
if (methods[method] && method.charAt(0) != '_') {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.pagination');
}
};
})(jQuery);
|
var express = require('express');
var router = express.Router();
var User = require('../entity/user');
var crypto = require('crypto');
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('login');
});
router.post('/submit', function (req, res, next) {
var telephone = req.body.telephone;
var password = req.body.password;
if (telephone && password) {
User.find({ 'telephone': telephone }, function (err, users) {
if (err) return res.json({ "flag": false, "msg": err });
if (users.length == 1) {
var md5Pwd = crypto.createHash('md5').update(telephone + '@' + password, "utf8").digest('hex');
if (md5Pwd == users[0].password) {
var context={
id:users[0]._id,
telephone:users[0].telephone,
project_id:"1"
};
req.session.user=context;
res.json({ "flag": true });
}
else {
res.json({ "flag": false, "msg": "用户名或密码错误" });
}
}
else {
res.json({ "flag": false, "msg": "用户不存在" });
}
});
}
else {
res.json({ "flag": false, "msg": "用户名或密码不能为空" });
}
});
router.get('/logout', function (req, res, next) {
delete req.session.user;
res.redirect('/login');
});
module.exports = router;
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var Hypergeometric = require( './../lib' );
var hypergeometric = new Hypergeometric( 100, 50, 20 );
var mu = hypergeometric.mean;
console.log( 'Mean = %d', mu );
// => 'Mean = 10'
var mode = hypergeometric.mode;
console.log( 'Mode = %d', mode );
// => 'Mode = 10'
var s2 = hypergeometric.variance;
console.log( 'Variance = %d', s2 );
// => 'Variance = 4.040404040404041'
var y = hypergeometric.cdf( 10.5 );
console.log( 'F(10.5) = %d', y );
// => 'F(10.5) = 0.5984356088532534'
|
var nx_match_8h =
[
[ "NXM_TYPICAL_LEN", "nx-match_8h.html#a507ca86a344628ed401aa0b146d32eb4", null ],
[ "mf_format_subfield", "nx-match_8h.html#a8e69b40cba0525f4e9b37d30ffe334a9", null ],
[ "mf_from_nxm_header", "nx-match_8h.html#a3491473078cf8cf4743324ff1e38739f", null ],
[ "mf_nxm_header", "nx-match_8h.html#a3aca29180485ec2d1c6940304cb5e219", null ],
[ "mf_parse_subfield", "nx-match_8h.html#a110b183602424e688a5e426007af9afd", null ],
[ "mf_parse_subfield__", "nx-match_8h.html#a9a28f0fc32e65d1b6bc4103153432fa7", null ],
[ "nx_format_field_name", "nx-match_8h.html#a5b598718623e0eb4e3a68c3d8974624d", null ],
[ "nx_match_from_string", "nx-match_8h.html#a64310f723c3417ff20d09c480bc7ec24", null ],
[ "nx_match_to_string", "nx-match_8h.html#a56907f30f48dd098257db641a4f3e49e", null ],
[ "nx_pull_entry", "nx-match_8h.html#a8bd4850c81c2d176e174239236741f45", null ],
[ "nx_pull_header", "nx-match_8h.html#a4fb3ad8f291edb66249d3a26ae5960ba", null ],
[ "nx_pull_match", "nx-match_8h.html#aab9dfc2ab7d2493261cd1e5c5d736216", null ],
[ "nx_pull_match_loose", "nx-match_8h.html#a4a07b646faefa41dfc1f05dd9daffa2f", null ],
[ "nx_put_entry", "nx-match_8h.html#a7d337a7a69486da35947e672dbe57335", null ],
[ "nx_put_header", "nx-match_8h.html#a22257d7475bb9fb7f121ceb17eba50ae", null ],
[ "nx_put_match", "nx-match_8h.html#a88f4db556037433b05b00f681836f42d", null ],
[ "nxm_decode_n_bits", "nx-match_8h.html#a2075e6021c8d0179130464258d7bfc4b", null ],
[ "nxm_decode_ofs", "nx-match_8h.html#a1b6257393b9a1a59afa414a030c92eb9", null ],
[ "nxm_encode_ofs_nbits", "nx-match_8h.html#a54354fe4d3f33939d09329491a15e1f6", null ],
[ "nxm_execute_reg_move", "nx-match_8h.html#abac6792b3a8fc83876568fda954b3b9a", null ],
[ "nxm_execute_stack_pop", "nx-match_8h.html#a2094850cccddf90b76386bdb2cb27993", null ],
[ "nxm_execute_stack_push", "nx-match_8h.html#a54ceaca7b579a685a5785dabc477d6be", null ],
[ "nxm_format_reg_move", "nx-match_8h.html#aeab2e184381180047484b07ad9034c89", null ],
[ "nxm_format_stack_pop", "nx-match_8h.html#a7cdf73da5342d2593a8ae0d11033fe5e", null ],
[ "nxm_format_stack_push", "nx-match_8h.html#aaba9b06651154d577f6235a99dc8f1dd", null ],
[ "nxm_parse_reg_move", "nx-match_8h.html#a981b48944cc3f2fed8ad2494881baefc", null ],
[ "nxm_parse_stack_action", "nx-match_8h.html#a55725e98484a3c4062070930758382e4", null ],
[ "nxm_put__", "nx-match_8h.html#a12fbcbfba944e5885bd90e4266a3414f", null ],
[ "nxm_reg_load", "nx-match_8h.html#ace73c6c66fee11a74176a5b4210fd07c", null ],
[ "nxm_reg_move_check", "nx-match_8h.html#a804547b4d214a56356ec2bd4cd3777d5", null ],
[ "nxm_stack_pop_check", "nx-match_8h.html#a9d23d18ef8e93402296c4beac6918d2e", null ],
[ "nxm_stack_push_check", "nx-match_8h.html#a69ce503c23638231ce94e87d75599b1b", null ],
[ "oxm_bitmap_from_mf_bitmap", "nx-match_8h.html#aa60e9e201a2b08d284f7ccb36505dda6", null ],
[ "oxm_bitmap_to_mf_bitmap", "nx-match_8h.html#a96204418e7fc0c1196fb1f3e5f88e5af", null ],
[ "oxm_format_field_array", "nx-match_8h.html#a4dd5253981d44bbd097b4f15b0994337", null ],
[ "oxm_maskable_fields", "nx-match_8h.html#aefd3829ae8ad29aa44a0e05a0a9539a5", null ],
[ "oxm_match_from_string", "nx-match_8h.html#a0283c002f3c640813edfebeae6d34d8d", null ],
[ "oxm_match_to_string", "nx-match_8h.html#a236062ae817b78720841404acc7da46e", null ],
[ "oxm_matchable_fields", "nx-match_8h.html#a82ced0309fcc8e486fe8d692da1603e4", null ],
[ "oxm_pull_field_array", "nx-match_8h.html#a668fb5b09cd7275ac95e52167620cb95", null ],
[ "oxm_pull_match", "nx-match_8h.html#abc4ff64135446e4cc412fd43d67f190c", null ],
[ "oxm_pull_match_loose", "nx-match_8h.html#a9a3e70addc6918834bc9bc50dffdaefb", null ],
[ "oxm_put_field_array", "nx-match_8h.html#a7234b36782f88ffebef354f8cbc2b6b2", null ],
[ "oxm_put_match", "nx-match_8h.html#abed20c8d1ef942eda41038ff776f5b85", null ],
[ "oxm_writable_fields", "nx-match_8h.html#ae28e89ef630180efa1e933844166b925", null ]
];
|
//// [objectTypesIdentityWithPrivates2.ts]
// object types are identical structurally
class C<T> {
private foo: T;
}
class D<T> extends C<T> {
}
function foo1(x: C<string>);
function foo1(x: C<number>); // ok
function foo1(x: any) { }
function foo2(x: D<string>);
function foo2(x: D<number>); // ok
function foo2(x: any) { }
function foo3(x: C<string>);
function foo3(x: D<number>); // ok
function foo3(x: any) { }
function foo4(x: C<number>): number;
function foo4(x: D<number>): string; // BUG 831926
function foo4(x: any): any { }
var r = foo4(new C<number>());
var r = foo4(new D<number>());
function foo5(x: C<number>): number;
function foo5(x: C<number>): string; // error
function foo5(x: any): any { }
function foo6(x: D<number>): number;
function foo6(x: D<number>): string; // error
function foo6(x: any): any { }
//// [objectTypesIdentityWithPrivates2.js]
// object types are identical structurally
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var C = /** @class */ (function () {
function C() {
}
return C;
}());
var D = /** @class */ (function (_super) {
__extends(D, _super);
function D() {
return _super !== null && _super.apply(this, arguments) || this;
}
return D;
}(C));
function foo1(x) { }
function foo2(x) { }
function foo3(x) { }
function foo4(x) { }
var r = foo4(new C());
var r = foo4(new D());
function foo5(x) { }
function foo6(x) { }
|
/*
* Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.
*/
import test from 'tape';
import utils from '../../lib/utils';
test('Test current time milliseconds', (t) => {
t.equal(utils.nowMillis(), new Date().getTime());
t.end();
});
|
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import * as P from '../../../actions/fb-photos';
import Photo from './partials/photo';
import EmbeddedPhoto from './partials/embedded-photo';
import Masonry from 'react-masonry-component';
import Upload from './upload';
class Photos extends React.Component {
constructor(props) {
super(props);
this.state = {
filterText: ''
};
}
refresh = (e) => {
e.preventDefault();
this.props.dispatch(P.fbLoadPhotos());
};
upload = (e) => {
e.preventDefault();
this.props.dispatch(P.fbUploadShow());
};
filter = (e) => {
e.preventDefault();
this.setState({ filterText: this.refs.filter.value })
};
componentDidMount() {
this.props.dispatch(P.fbLoadPhotos());
}
componentDidUpdate() {
// FB.XFBML.parse();
}
renderPhotos() {
const photos = this.props.photos.filter((photo) => {
return !this.state.filterText
|| (photo.name && photo.name.toLowerCase().indexOf(this.state.filterText.toLowerCase()) !== -1);
});
if (!photos.length) {
return (<div className="col-xs-12">No photos</div>);
}
return photos.map((photo) => {
return <Photo photo={photo} key={photo.id} />;
});
// return photos.map((photo) => {
// return <EmbeddedPhoto photo={photo} key={photo.id} />;
// });
}
render() {
return (
<div>
<h1>Photos</h1>
<hr/>
<div className="row">
<div className="col-sm-4">
<a href="#" className="btn btn-default" onClick={this.refresh}>Refresh</a>
</div>
<div className="col-sm-4 text-center">
<div className="form-inline">
<div className="form-group">
<div className="input-group">
<input type="text" ref="filter" className="form-control" />
<span className="input-group-btn">
<a href="#" className="btn btn-default" onClick={this.filter}>Filter</a>
</span>
</div>
</div>
</div>
</div>
<div className="col-sm-4 text-right">
<a href="#" className="btn btn-primary" onClick={this.upload}>Upload</a>
</div>
</div>
<hr/>
<Masonry
className={'row'} // default ''
disableImagesLoaded={false} // default false
updateOnEachImageLoad={true} // default false and works only if disableImagesLoaded is false
>
{this.renderPhotos() }
</Masonry>
<Upload show={this.props.uploadShow} dispatch={this.props.dispatch} />
</div>
);
}
}
Photos.propTypes = {
dispatch: PropTypes.func.isRequired,
photos: PropTypes.array.isRequired,
uploadShow: PropTypes.bool.isRequired,
};
function mapStateToProps(state) {
return {
photos: state.fb.photos.photos,
uploadShow: state.fb.photos.uploadShow,
};
}
export default connect(mapStateToProps)(Photos);
|
var express = require('express');
var app = express();
var destinations = require('./scripts/destinations');
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.logger('dev'));
app.use(express.static(__dirname + '/'))
app.configure('development', function(){
app.use(express.errorHandler());
app.locals.pretty = true;
});
app.get('/', function (req, res) {
res.render('index', {
title: "test",
destinations: destinations.allDestinations()
});
});
app.listen(3000);
|
var PluginModel = Backbone.Model.extend({
getName: function () {
return this.get('metadata').name;
},
getGensByModule: function (moduleName) {
if (moduleName === 'metadata') throw 'metadata is not a module';
if (this.has(moduleName))
return this.get(moduleName);
else
return [];
},
});
exports.PluginModel = PluginModel;
|
import React from 'react';
import { Route } from 'react-router';
import App from './container/App';
import ChannelPage from './container/ChannelPage';
export default (
<Route path="/" component={App}>
<Route path="/channel/:channelId"
component={ChannelPage} >
<Route path="/channel/:channelId/:messageId" />
</Route>
</Route>
);
|
// Copyright 2011 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Defines error codes to be thrown by storage mechanisms.
*/
goog.provide('goog.storage.mechanism.ErrorCode');
/**
* Errors thrown by storage mechanisms.
* @enum {string}
*/
goog.storage.mechanism.ErrorCode = {
INVALID_VALUE: 'Storage mechanism: Invalid value was encountered',
QUOTA_EXCEEDED: 'Storage mechanism: Quota exceeded',
STORAGE_DISABLED: 'Storage mechanism: Storage disabled'
};
|
'use strict';
const weatherApiKey = '65242acc93fa100cfe5f6d1968916208';
module.exports.weatherApiKey = weatherApiKey;
|
/*************************************************
* Copyright (c) 2016 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
import UsersList from './list/users-list.controller';
import UsersAdd from './add/users-add.controller';
import UsersEdit from './edit/users-edit.controller';
import UserForm from './users.form';
import UserList from './users.list';
import { N_ } from '../i18n';
export default
angular.module('Users', [])
.controller('UsersList', UsersList)
.controller('UsersAdd', UsersAdd)
.controller('UsersEdit', UsersEdit)
.factory('UserForm', UserForm)
.factory('UserList', UserList)
.config(['$stateProvider', 'stateDefinitionsProvider',
function($stateProvider, stateDefinitionsProvider) {
let stateDefinitions = stateDefinitionsProvider.$get();
// lazily generate a tree of substates which will replace this node in ui-router's stateRegistry
// see: stateDefinition.factory for usage documentation
$stateProvider.state({
name: 'users',
url: '/users',
lazyLoad: () => stateDefinitions.generateTree({
parent: 'users',
modes: ['add', 'edit'],
list: 'UserList',
form: 'UserForm',
controllers: {
list: UsersList,
add: UsersAdd,
edit: UsersEdit
},
data: {
activityStream: true,
activityStreamTarget: 'user'
},
ncyBreadcrumb: {
label: N_('USERS')
}
})
});
}
]);
|
'use strict';
// gulp
var gulp = require('gulp');
var paths = gulp.paths;
var options = gulp.options;
// plugins
var $ = require('gulp-load-plugins')();
// modules
var wiredep = require('wiredep');
var mainBowerFiles = require('main-bower-files');
// inject app/**/*.js, bower components, css into index.html
// inject environment variables into config.js constant
gulp.task('inject-all', ['styles', 'wiredep', 'bower-fonts', 'environment', 'build-vars'], function () {
return gulp.src('app/index.html')
.pipe(
$.inject( // app/**/*.js files
gulp.src(paths.jsFiles)
.pipe($.plumber()) // use plumber so watch can start despite js errors
.pipe($.naturalSort())
.pipe($.angularFilesort()),
{relative: true}))
.pipe(
$.inject( // inject compiled css
gulp.src('.tmp/**/*.css', {read: false})
.pipe($.naturalSort()),
{
ignorePath: '../.tmp',
relative: true,
}))
.pipe(gulp.dest('app'));
});
// build styles to tmp
gulp.task('styles', ['clean'], function () {
// compile css starting from each module's scss
return gulp.src([
'!app/bower_components/**/*.scss',
'app/**/!(_)*.scss'
])
.pipe($.plumber())
.pipe($.sourcemaps.init())
.pipe($.sass.sync().on('error', $.sass.logError))
.pipe($.autoprefixer({ browsers: ['last 2 versions'], remove: false}))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('.tmp/'));
});
// inject bower components into index.html
gulp.task('wiredep', function () {
return gulp.src('app/index.html')
// exclude ionic scss since we're using ionic sass
.pipe(wiredep.stream({exclude: ['bower_components/ionic/release/css']}))
.pipe(gulp.dest('app/'));
});
// copy bower fonts
gulp.task('bower-fonts', function () {
// to app/main/assets/fonts (path can be set in app/main/styles/<module>.scss)
var DEST = 'app/main/assets/fonts';
var fontFiles = mainBowerFiles({filter: /\.(eot|otf|svg|ttf|woff|woff2)$/i})
.concat('app/main/assets/fonts/**/*');
return gulp.src(fontFiles)
.pipe($.changed(DEST))
.pipe(gulp.dest(DEST));
});
/**
* transforms object into a string format that is ready for injection at indentation 4
* @param {Object} obj Object with values to inject
* @return {String} properly formatted string
*/
var injectFormat = function (obj) {
// indentation of 2
obj = JSON.stringify(obj, null, 2);
// replace all doublequotes with singlequotes
obj = obj.replace(/\"/g, '\'');
// remove first and last line curly braces
obj = obj.replace(/^\{\n/, '').replace(/\n\}$/, '');
// remove indentation of first line
obj = obj.replace(/^( ){2}/, '');
// insert padding for all remaining lines
obj = obj.replace(/\n( ){2}/g, '\n ');
return obj;
};
gulp.task('environment', function () {
return gulp.src('app/*/constants/*config-const.js')
.pipe(
$.inject(
gulp.src('app/main/constants/env-' + options.env + '.json'),
{
starttag: '/*inject-env*/',
endtag: '/*endinject*/',
transform: function (filePath, file) {
var json;
try {
json = JSON.parse(file.contents.toString('utf8'));
}
catch (e) {
console.log(e);
}
if (json) {
json = injectFormat(json);
}
return json;
}
}))
.pipe(gulp.dest('app/'));
});
gulp.task('build-vars', ['environment'], function () {
return gulp.src('app/*/constants/*config-const.js')
.pipe(
$.inject(
gulp.src(''),
{
starttag: '/*inject-build*/',
endtag: '/*endinject*/',
transform: function () {
var obj = {};
var buildVars = options.buildVars;
if (buildVars) {
// loop over build variables
var variables = buildVars.split(',');
for (var i = 0, variable; ((variable = variables[i])); i++) {
var splits = variable.split(':');
// add key and value to object
obj[splits[0]] = splits[1];
}
return injectFormat(obj);
}
else {
return;
}
}
}))
.pipe(gulp.dest('app/'));
});
|
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
/// <reference path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.WinJS.1.0\1.0\DesignTime\CommonConfiguration\Neutral\Microsoft.WinJS.1.0\js\base.js" />
/// <reference path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.WinJS.1.0\1.0\DesignTime\CommonConfiguration\Neutral\Microsoft.WinJS.1.0\js\ui.js" />
/// <reference path="..\..\js\MobileServices.Internals.js" />
/// <reference path="..\..\generated\Tests.js" />
$testGroup('Blogging')
.functional()
.tests(
$test('UseBlog')
.description('Create and manipulate posts/comments')
.checkAsync(function () {
var client = $getClient();
var postTable = client.getTable('blog_posts');
var commentTable = client.getTable('blog_comments');
var context = {};
return $chain(
function () {
$log('Add a few posts and a comment');
return postTable.insert({ title: "Windows 8" });
},
function (post) {
context.post = post;
context.newItems = 'id ge ' + post.id;
return postTable.insert({ title: "ZUMO" });
},
function (highlight) {
context.highlight = highlight;
return commentTable.insert({
postid: context.post.id,
name: "Anonymous",
commentText: "Beta runs great"
});
},
function () {
return commentTable.insert({
postid: context.highlight.id,
name: "Anonymous",
commentText: "Whooooo"
});
},
function () {
return postTable.where(context.newItems).read();
},
function (items) {
$assert.areEqual(2, items.length);
$log('Add another comment to the first post');
return commentTable.insert({ postid: context.post.id, commentText: "Can't wait" });
},
function (opinion) {
$assert.areNotEqual(0, opinion.id);
});
})
);
|
define(['build/Objects/Page/Form/integer'], function (Item) {
describe('Integer form item', function () {
beforeEach(function () {
this.addMatchers(require('jasmine_matchers'));
});
it('should return corresponding attributes', function () {
var item = new Item({
order: 10,
name: 'thename',
label: 'The name',
value: 11,
required: true
});
expect(item.getAttributes()).toHaveKeys([
'type',
'value',
'name'
]);
expect(item.getValue()).toBe(11);
});
it('should implement a form item', function () {
var item = new Item({
order: 10,
name: 'thename',
label: 'The name',
value: 11,
required: true
});
//Test spec of transferring initial data
expect(item.getType()).toBe('integer');
expect(item.getOrder()).toBe(10);
expect(item.getName()).toBe('thename');
expect(item.getLabel()).toBe('The name');
expect(item.getValue()).toBe(11);
expect(item.isRequired()).toBe(true);
//Test spec of setters
item.setOrder(2);
item.setName('somename');
item.setLabel('Your name');
item.setValue(14);
item.setRequired(false);
expect(item.getOrder()).toBe(2);
expect(item.getName()).toBe('somename');
expect(item.getLabel()).toBe('Your name');
expect(item.getValue()).toBe(14);
expect(item.isRequired()).toBe(false);
});
});
});
|
import ModalView from 'OpenOrchestra/Service/Modal/View/ModalView'
import FormBuilder from 'OpenOrchestra/Service/Form/Model/FormBuilder'
import InternalLinkFormView from 'OpenOrchestra/Service/Tinymce/Plugins/InternalLink/View/InternalLinkFormView'
/**
* InternalLinkModalView
*/
class InternalLinkModalView extends ModalView
{
/**
* Initialize
* @param {Editor} editor
* @param {Object} data
*/
initialize({editor, data}) {
super.initialize();
this._editor = editor;
this._data = data;
}
/**
* render internal link modal form
*/
render() {
let template = this._renderTemplate('Tinymce/InternalLink/internalLinkForm');
this.$el.html(template);
let $formRegion = $('.modal-body', this.$el);
this._displayLoader($formRegion);
let url = Routing.generate('open_orchestra_backoffice_internal_link_form');
FormBuilder.createFormFromUrl(url, (form) => {
let internalLinkFormView = new InternalLinkFormView({
form: form,
editor: this._editor,
modal: this
});
$formRegion.html(internalLinkFormView.render().$el);
}, this._data);
return this;
}
}
export default InternalLinkModalView
|
const webpack = require('webpack')
const copy = require('copy-webpack-plugin')
const extract = require('extract-text-webpack-plugin')
const environment = require('./../environment')
const environments = {
development: require('./plugins/development'),
production: require('./plugins/production')
}
const plugins = environments[environment]
module.exports = (settings, helpers) => {
return [
new webpack.DefinePlugin({
'process.env': {NODE_ENV: JSON.stringify(environment)}
}),
new webpack.optimize.OccurenceOrderPlugin(),
new copy(settings.paths.static.map(helpers.static)),
new extract('[name]', {allChunks: true}),
new webpack.NoErrorsPlugin()
].concat(plugins(settings, helpers))
}
|
require('../lib/common');
const path = require('path');
const pify = require('pify');
const fs = pify(require('fs'));
const Koa = require('koa');
const router = require('koa-router')();
const bodyParser = require('koa-bodyparser');
const log4js = require('koa-log4');
const staticServer = require('koa-static');
const logger = require('../lib/logger')();
let start = async()=> {
const app = new Koa();
app.use(async (ctx,next) => {
ctx.set('Access-Control-Allow-Origin','*')
await next();
});
app.use(log4js.koaLogger(log4js.getLogger("http"), {level: 'auto'}));
app.use(staticServer(path.join(__dirname, '../dist'), {gzip: true}));
app.use(staticServer(path.join(__dirname, '../../download/fuli'), {gzip: true}));
app.use(bodyParser());
// add routes
let walk = async(dir, root) => {
let items = await fs.readdir(dir);
for (let i in items) {
let item = items[i];
let stat = await fs.stat(path.join(dir, item));
if (stat.isDirectory()) {
await walk(path.join(dir, item), root + item + '/')
} else {
let routeItem = require('../routes' + root + item.substring(0, item.length - 3));
router.use(item == 'index.js' ? root : root + item.substring(0, item.length - 3) + '/', routeItem.routes(), routeItem.allowedMethods());
}
}
};
await walk(path.join(__dirname, '../routes'), '/');
app.use(router.routes(), router.allowedMethods());
// socket
const server = require('http').createServer(app.callback());
const io = require('socket.io')(server);
const loginManager = require('../lib/socket/loginManager');
io.on('connection', (socket) => {
// 所有的连接都必须通过login manager进行校验后再分配
loginManager.socketHandler(socket);
});
// before listen
await require('../bootstrap')();
const port = 8080;
server.listen(port);
logger.info(`app started at port ${port}...`);
};
start();
|
var UNDEFINED_ERROR = -1;
var NULL_ERROR = -2;
// var NOTHING_ERROR = -3;
|
var a04485 =
[
[ "Convolve", "a04485.html#a43dc5a3ee340111a240b29c201291351", null ],
[ "~Convolve", "a04485.html#afe4bdcfc64bd500237175b1d30f3bdfb", null ],
[ "Backward", "a04485.html#a2ded8b7c997ed868a02df44445701712", null ],
[ "DeSerialize", "a04485.html#a2ab11ec1c218c57b43a825f6657597b9", null ],
[ "Forward", "a04485.html#ae955c429d72219f43a4f0596df809179", null ],
[ "Serialize", "a04485.html#afa04786afd07e333635f7c77ea43de91", null ],
[ "spec", "a04485.html#ab92c5022eafd8ef5e190bcbb6de36954", null ],
[ "half_x_", "a04485.html#ad6110aa04d976fde8ef207847b768deb", null ],
[ "half_y_", "a04485.html#ae91d0a17c5223136a2276ead7b223b3e", null ]
];
|
define([
'knockout',
'text!./cohort-definition-browser.html',
'components/Component',
'utils/Renderers',
'utils/CommonUtils',
'faceted-datatable',
], function(ko, view, Component, renderers, commonUtils) {
class EntityBrowser extends Component {
constructor(params) {
super(params);
this.onSelect = params.onSelect;
this.multiChoice = params.multiChoice || false;
this.showModal = params.showModal;
this.scrollY = this.multiChoice ? (params.scrollY !== undefined ? params.scrollY : '50vh') : params.scrollY;
this.scrollCollapse = params.scrollCollapse || false;
this.selectedDataIds =
this.multiChoice && params.selectedData
? (params.selectedData() || []).map(({ id }) => id)
: [];
this.data = ko.observableArray([]);
this.isLoading = ko.observable(false);
this.importEnabled = ko.pureComputed(() => this.data().some(i => i.selected()));
this.dtApi = ko.observable();
this.filteredData = ko.observableArray([]);
this.buttons = !!this.multiChoice
? [
{
text: ko.i18n('common.selectAll', 'Select All')(),
action: () => this.toggleSelected(true),
className: this.classes({ extra: 'btn btn-sm btn-success' }),
init: this.removeClass('dt-button'),
},
{
text: ko.i18n('common.deselectAll', 'Deselect All')(),
action: () => this.toggleSelected(false),
className: this.classes({ extra: 'btn btn-sm btn-primary' }),
init: this.removeClass('dt-button'),
},
]
: null;
this.columns = !!this.multiChoice
? [
{
data: 'selected',
class: this.classes({extra: 'text-center'}),
render: () => renderers.renderCheckbox('selected'),
searchable: false,
orderable: false,
},
] : [];
this.tableDom = this.multiChoice ? "Bfiprt<'page-size'l>ip" : 'Blfiprt';
this.rowClick = this.rowClick.bind(this);
this.loadData();
}
rowClick(data) {
this.action(() => this.onSelect(data));
}
removeClass(className) {
return (dt, node, cfg) => node.removeClass(className);
}
action(callback) {
callback();
}
import() {
const selectedItems = this.data().filter(i => i.selected());
this.action(() => this.onSelect(selectedItems));
}
cancel() {
this.showModal(false);
}
toggleSelected(selected) {
const filteredData = this.dtApi() ? this.dtApi().getFilteredData() : [];
commonUtils.selectAllFilteredItems(this.data, filteredData, selected);
}
}
return EntityBrowser;
});
|
/**
* Confirm Component
*
* Same as window.confirm but using Filter component and divs.
*
* @param text The text to confim.
* @param onOK (optional) Javascript function to call when OK button is clicked.
* Make sure that it is a String!
* @param onCancel (optional) Javascript function to call when Cancel button is clicked.
* Make sure that it is a String!
* @return a Confirm object
*/
function Confirm(text, onOK, onCancel) {
this.id = 'zuiConfirm'; // getElementById id of this DOM
this.DOM = init();
window.dialog = this;
function init() {
window.filter = new Filter(); // create new filter at window.filter
var h1 = createHeader('Confirm', id, window.filter);
var p1 = document.createElement('P');
p1.className = 'zuiAlertText';
p1.innerHTML = text;
var ok = createButton('OK', id, window.filter, onOK);
var cancel = createButton('Cancel', id, window.filter, onCancel);
if(text.match(/\?$/)) {
ok.value = LABEL_YES;
cancel.value = LABEL_NO;
}
var p2 = document.createElement('P');
p2.className = 'center';
p2.appendChild(ok);
p2.appendChild(cancel);
var container = document.createElement('DIV');
container.className = 'zuiDialog';
container.id = id;
container.onkeydown = function(e) {
e = e || event;
if(e.keyCode==ESC_KEY) {
removeObject(id, window.filter);
}
}
container.style.display = 'block';
container.appendChild(h1);
container.appendChild(p1);
container.appendChild(p2);
document.body.insertBefore(container, document.body.firstChild);
centerDiv(container);
return container;
}
}
|
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/GreekAndCoptic.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u03C3': MO.ORD11 // greek small letter sigma
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/GreekAndCoptic.js");
})(MathJax.ElementJax.mml);
|
Ember.Application.initializer({
name: 'current-user',
after: 'preload',
initialize: function(container) {
var user, store = container.lookup('store:main'),
controller = container.lookup('controller:currentUser');
if (window.currentUserName) {
user = store.find('currentUser', window.currentUserName);
controller.set('model', user);
}
container.injection('route', 'currentUser', 'controller:currentUser');
container.injection('view', 'currentUser', 'controller:currentUser');
}
});
|
/*
Description: The class is used to filter assets based on the permissions specified in the extension json files
Filename: permission.asset.filter.js
Created Date: 7/10/2013
*/
var filterModule = function () {
var log = new Log('permission.asset.filter');
var utility = require('/modules/utility.js').rxt_utility();
var ADMIN_ROLE = Packages.org.wso2.carbon.context.PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminRoleName();
var ANON_ROLE = 'anon';
/*
The function checks whether the filter can be applied to the current request
@context: The context of the request
@return: True if the filter can be applied ,else false
*/
function isApplicable(context) {
var permissions = context.config.permissions || null;
//Check if a permission block is present for the given asset type
if (permissions) {
return true;
}
log.debug('not applying filter as a permission block has not been specified for the asset type.');
return false;
}
/*
The function filters the provided assets list based on the permissions defined in the extension file
@context: The context provides the required resources for the filter
*/
function execute(context) {
var data = context['data'];
var userRoles = context['roles'];
var tenantId = context['tenantId'];
var item;
var items = [];
//Go through each data item
for (var index in data) {
item = data[index];
//TODO: We are ignoring any assets without a lifecycle state
if(item.lifecycleState) {
//Obtain the permissions for the current lifecycle state
permissableRoles = obtainPermissibleRoles(context, item.lifecycleState);
//Fill in dynamic values
permissableRoles = fillDynamicPermissibleRoles(item, tenantId, permissableRoles);
//Check if the user has any of the roles specified for the state
var commonRoles = utility.intersect(userRoles, permissableRoles, function (a, b) {
return (a == b);
});
//Check if we have common roles
if (commonRoles.length > 0) {
items.push(item);
}
}
else{
log.debug('ignoring '+item.attributes.overview_name+' as it does not have a lifecycle state.');
}
}
context['data'] = items;
return true;
}
/*
The function is used to fill in dynamic roles (e.g. private_{overview_provider} )
@context: The context of the request (username)
@permissions: A list of permissions
*/
function fillDynamicPermissibleRoles(item, tenantId, permissions) {
var list = [];
var overviewProvider = item.attributes.overview_provider;
for (var index in permissions) {
if(tenantId == '-1234') {
list.push(permissions[index].replace('{overview_provider}', overviewProvider));
} else {
var providerDetails = overviewProvider.split("-AT-");
list.push(permissions[index].replace('{overview_provider}', providerDetails[0]));
}
}
return list;
}
/*
The function is used to obtain permissible roles based on the provided state
@context: A context containing the permissions configuration block
@state: The state of the current asset
@return: An array of permissible roles
*/
function obtainPermissibleRoles(context, state) {
var config = context.config.permissions;
var roles = [];
var state = state.toLowerCase();
log.debug("#### Config : "+ stringify(config));
log.debug("#### State : "+state);
//Check if any roles are specified for the state
if (config.hasOwnProperty(state)) {
roles = config[state];
}
//All resources can be accessed by the admin role
roles = addAdminRole(roles);
return roles;
}
/*
The function checks whether the admin role is present in the permissions array.If it is not present,then
the it is added (All assets can be viewed by the admin role)
@roles: An array of roles having access to a resource
@return: If the admin role is not present in the permissions it is added
*/
function addAdminRole(roles) {
//If the admin role has not been given,then add it
if (roles.indexOf(ADMIN_ROLE) == -1) {
roles.push(ADMIN_ROLE);
}
return roles;
}
return{
isApplicable: isApplicable,
execute: execute
}
}
|
module.exports = function(msg){
alert(msg);
}
|
/**
* @file log.js
*/
import window from 'global/window';
/**
* Log plain debug messages
*/
const log = function(){
_logType(null, arguments);
};
/**
* Keep a history of log messages
* @type {Array}
*/
log.history = [];
/**
* Log error messages
*/
log.error = function(){
_logType('error', arguments);
};
/**
* Log warning messages
*/
log.warn = function(){
_logType('warn', arguments);
};
/**
* Log messages to the console and history based on the type of message
*
* @param {String} type The type of message, or `null` for `log`
* @param {Object} args The args to be passed to the log
* @private
* @method _logType
*/
function _logType(type, args){
// convert args to an array to get array functions
let argsArray = Array.prototype.slice.call(args);
// if there's no console then don't try to output messages
// they will still be stored in log.history
// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
let noop = function(){};
let console = window['console'] || {
'log': noop,
'warn': noop,
'error': noop
};
if (type) {
// add the type to the front of the message
argsArray.unshift(type.toUpperCase()+':');
} else {
// default to log with no prefix
type = 'log';
}
// add to history
log.history.push(argsArray);
// add console prefix after adding to history
argsArray.unshift('VIDEOJS:');
// call appropriate log function
if (console[type].apply) {
console[type].apply(console, argsArray);
} else {
// ie8 doesn't allow error.apply, but it will just join() the array anyway
console[type](argsArray.join(' '));
}
}
export default log;
|
import './explore-user-widget.html';
import './explore-user-widget.js';
import './explorer-choose-user-widget.html';
import './explorer-choose-user-widget.js';
import './student-home-menu.html';
import './student-home-menu.js';
import './student-explorer-courses-widget-button.html';
import './student-explorer-courses-widget-button.js';
import './student-explorer-menu.html';
import './student-explorer-menu.js';
import './student-explorer-add-review-widget.html';
import './student-explorer-add-review-widget.js';
import './student-explorer-edit-review-widget.html';
import './student-explorer-edit-review-widget.js';
import './student-explorer-review-widget.html';
import './student-explorer-review-widget.js';
import './student-explorer-opportunities-widget-button.html';
import './student-explorer-opportunities-widget-button.js';
import './student-explorer-opportunities-widget-teaser.html';
import './student-explorer-opportunities-widget-teaser.js';
import './student-explorer-review-stars-widget.html';
import './student-explorer-review-stars-widget.js';
import './student-feed-item.html';
import './student-feed-item.js';
import './student-feed-modal.html';
import './student-feed-modal.js';
import './student-feed-widget.html';
import './student-feed-widget.js';
import './student-home-widget.html';
import './student-ice-column.html';
import './student-ice-column.js';
import './student-ice-widget.html';
import './student-ice-widget.js';
import './student-about-me-widget.html';
import './student-about-me-widget.js';
import './student-levels-others.html';
import './student-levels-others.js';
import './student-levels-widget.html';
import './student-levels-widget.js';
import './student-log-widget.html';
import './student-log-widget.js';
import './student-mentorspace-hidden-questions.html';
import './student-mentorspace-hidden-questions.js';
import './student-mentorspace-questions-accordion.html';
import './student-mentorspace-questions-accordion.js';
import './student-mentorspace-question-form.html';
import './student-mentorspace-question-form.js';
import './student-mentorspace-mentor-directory.html';
import './student-mentorspace-mentor-directory.js';
import './student-of-interest-card.html';
import './student-of-interest-card.js';
import './student-of-interest-widget.html';
import './student-of-interest-widget.js';
import './student-profile-add.html';
import './student-profile-add';
import './student-plan-card.html';
import './student-plan-card';
import './student-profile-card.html';
import './student-profile-card';
import './student-share-info-widget.html';
import './student-share-info-widget';
import './student-teaser-widget.html';
import './student-teaser-widget.js';
import './student-teaser-widget-video.html';
import './student-teaser-widget-video.js';
import './student-update-picture-widget.html';
import './student-update-picture-widget';
import './student-update-website-widget.html';
import './student-update-website-widget';
import './student-user-card.html';
import './student-user-card';
|
//// [es6ModuleModuleDeclaration.ts]
export module m1 {
export var a = 10;
var b = 10;
export module innerExportedModule {
export var k = 10;
var l = 10;
}
export module innerNonExportedModule {
export var x = 10;
var y = 10;
}
}
module m2 {
export var a = 10;
var b = 10;
export module innerExportedModule {
export var k = 10;
var l = 10;
}
export module innerNonExportedModule {
export var x = 10;
var y = 10;
}
}
//// [es6ModuleModuleDeclaration.js]
var m1;
(function (m1) {
m1.a = 10;
var b = 10;
var innerExportedModule;
(function (innerExportedModule) {
innerExportedModule.k = 10;
var l = 10;
})(innerExportedModule = m1.innerExportedModule || (m1.innerExportedModule = {}));
var innerNonExportedModule;
(function (innerNonExportedModule) {
innerNonExportedModule.x = 10;
var y = 10;
})(innerNonExportedModule = m1.innerNonExportedModule || (m1.innerNonExportedModule = {}));
})(m1 || (m1 = {}));
export { m1 };
var m2;
(function (m2) {
m2.a = 10;
var b = 10;
var innerExportedModule;
(function (innerExportedModule) {
innerExportedModule.k = 10;
var l = 10;
})(innerExportedModule = m2.innerExportedModule || (m2.innerExportedModule = {}));
var innerNonExportedModule;
(function (innerNonExportedModule) {
innerNonExportedModule.x = 10;
var y = 10;
})(innerNonExportedModule = m2.innerNonExportedModule || (m2.innerNonExportedModule = {}));
})(m2 || (m2 = {}));
|
'use strict';
/**
* @ngdoc directive
* @name izzyposWebApp.directive:adminPosHeader
* @description
* # adminPosHeader
*/
angular.module('marbleCoreApp')
.directive('header',function(){
return {
templateUrl:'templates/directives/header/header.html',
restrict: 'E',
replace: true,
}
});
|
/* @flow */
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { StarMap } from './map';
type Props = {};
@observer
export default class RootComponent extends Component {
constructor(props: Props) {
super(props);
}
render() {
return(
<div style={{ color: 'white' }}>
<StarMap />
</div>
);
}
}
|
define(["marionette","backbone","jquery","underscore", "app/app.models"],
function(Marionette, Backbone, $, _) {
return function(app) {
app.module("Collections", function(Collections, App, Backbone, Marionetter, $, _) {
this.PageCollection = Backbone.Collection.extend({
model: App.Models.PageModel
});
});
};
});
|
'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": [
"domingo",
"lunes",
"martes",
"mi\u00e9rcoles",
"jueves",
"viernes",
"s\u00e1bado"
],
"ERANAMES": [
"antes de Cristo",
"despu\u00e9s de Cristo"
],
"ERAS": [
"a. C.",
"d. C."
],
"FIRSTDAYOFWEEK": 6,
"MONTH": [
"enero",
"febrero",
"marzo",
"abril",
"mayo",
"junio",
"julio",
"agosto",
"septiembre",
"octubre",
"noviembre",
"diciembre"
],
"SHORTDAY": [
"dom.",
"lun.",
"mar.",
"mi\u00e9.",
"jue.",
"vie.",
"s\u00e1b."
],
"SHORTMONTH": [
"ene.",
"feb.",
"mar.",
"abr.",
"may.",
"jun.",
"jul.",
"ago.",
"sept.",
"oct.",
"nov.",
"dic."
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE, d 'de' MMMM 'de' y",
"longDate": "d 'de' MMMM 'de' y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "d/M/yy h:mm a",
"shortDate": "d/M/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-\u00a4",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "es-us",
"pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
watch: {
files: ["src/less/*.less", "src/js/*.js"],
tasks: ["concat", "less", "uglify"]
},
clean: {
dist: 'dist'
},
concat: {
bootstrap: {
src: [
'vendor/twbs/bootstrap/js/transition.js',
'vendor/twbs/bootstrap/js/alert.js',
'vendor/twbs/bootstrap/js/button.js',
//'vendor/twbs/bootstrap/js/carousel.js',
'vendor/twbs/bootstrap/js/collapse.js',
'vendor/twbs/bootstrap/js/dropdown.js',
'vendor/twbs/bootstrap/js/modal.js',
'vendor/twbs/bootstrap/js/tooltip.js',
'vendor/twbs/bootstrap/js/popover.js',
'vendor/twbs/bootstrap/js/scrollspy.js',
'vendor/twbs/bootstrap/js/tab.js',
'vendor/twbs/bootstrap/js/affix.js'
],
dest: 'dist/js/bootstrap.js'
},
admin: {
src: [
'src/js/admin.js'
],
dest: 'dist/js/admin.js'
}
},
less: {
development: {
options: {
compress: false
},
files: {
"dist/css/theme.css": "src/less/bootstrap.less"
}
},
production: {
options: {
compress: true
},
files: {
"dist/css/theme.min.css": "src/less/bootstrap.less",
}
}
},
uglify: {
options: {
mangle: true,
preserveComments: 'some'
},
javascript: {
files: {
"dist/js/admin.min.js": ['dist/js/admin.js'],
"dist/js/bootstrap.min.js": ['dist/js/bootstrap.js']
}
}
},
image: {
dynamic: {
files: [{
expand: true,
cwd: 'src/img/',
src: ['**/*.{png,jpg,gif,svg,jpeg}'],
dest: 'dist/img/'
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-image');
grunt.registerTask('run', ['clean', 'concat', 'less', 'uglify', 'image']);
grunt.registerTask('default', ['watch']);
};
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var debug = require('debug')('mqtt-common');
var Message = require('azure-iot-common').Message;
/**
* @class module:azure-iot-device-mqtt.MqttReceiver
* @classdesc Object that is used to receive and settle messages from the server.
*
* @param {Object} transport MQTT Client object.
* @throws {ReferenceError} If either mqttClient or topic_subscribe is falsy
* @emits message When a message is received
*/
/**
* @event module:azure-iot-mqtt-base.MqttReceiver#message
* @type {Message}
*/
function MqttReceiver(mqttClient, topic_subscribe) {
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_001: [If the topic_subscribe parameter is falsy, a ReferenceError shall be thrown.]*/
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_002: [If the mqttClient parameter is falsy, a ReferenceError shall be thrown.]*/
if (!mqttClient) { throw new ReferenceError('mqttClient cannot be falsy'); }
if (!topic_subscribe) { throw new ReferenceError('topic_subscribe cannot be falsy'); }
debug('creating a new MqttReceiver');
EventEmitter.call(this);
this._client = mqttClient;
this._topic_subscribe = topic_subscribe;
this._listenersInitialized = false;
var self = this;
this.on('removeListener', function () {
// stop listening for AMQP events if our consumers stop listening for our events
if (self._listenersInitialized && self.listeners('message').length === 0) {
debug('Stopped listening for messages');
self._removeListeners();
}
});
this.on('newListener', function (eventName) {
// lazy-init AMQP event listeners
if (!self._listenersInitialized && eventName === 'message') {
debug('Now listening for messages');
self._setupListeners();
}
});
}
util.inherits(MqttReceiver, EventEmitter);
MqttReceiver.prototype._setupListeners = function () {
debug('subscribing to ' + this._topic_subscribe);
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_003: [When a listener is added for the message event, the topic should be subscribed to.]*/
this._client.subscribe(this._topic_subscribe, { qos: 1 }, function () {
debug('subscribed to ' + this._topic_subscribe);
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_004: [If there is a listener for the message event, a message event shall be emitted for each message received.]*/
this._client.on('message', this._onMqttMessage.bind(this));
this._listenersInitialized = true;
}.bind(this));
};
MqttReceiver.prototype._removeListeners = function () {
this._client.removeListener('message', this._onMqttMessage.bind(this));
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_006: [When there are no more listeners for the message event, the topic should be unsubscribed]*/
debug('unsubscribing from ' + this._topic_subscribe);
this._client.unsubscribe(this._topic_subscribe, function () {
debug('unsubscribed from ' + this._topic_subscribe);
this._listenersInitialized = false;
}.bind(this));
};
MqttReceiver.prototype._onMqttMessage = function (topic, message) {
// needs proper conversion to transport-agnostic message.
/*Codes_SRS_NODE_DEVICE_MQTT_RECEIVER_16_005: [When a message event is emitted, the parameter shall be of type Message]*/
var msg = new Message(message);
debug('Got a message: ' + message);
this.emit('message', msg);
};
module.exports = MqttReceiver;
|
$.index.open();
$.start_button.addEventListener('click', function(){
var config = new Alloy.createController("config").getView();
config.open();
$.index.close();
});
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// MODULES //
var dirname = require( '@stdlib/utils/dirname' );
var convertPath = require( '@stdlib/utils/convert-path' );
// FUNCTIONS //
/**
* Returns the last index of a substring matching a specified string.
*
* @private
* @param {string} str - string to search
* @param {string} search - string to match
* @returns {integer} index
*/
function lastIndexOf( str, search ) {
var sub;
var len;
var N;
var i;
var j;
len = str.length;
N = search.length;
if ( N > len ) {
return -1;
}
for ( j = str.length; j >= N; j-- ) {
i = j - N;
sub = str.substring( i, j );
if ( sub === search ) {
return i;
}
}
return -1;
}
// MAIN //
/**
* Transforms a raw `package.json` list into package names.
*
* @private
* @param {StringArray} files - list of `package.json` absolute file paths
* @returns {StringArray} list of package names
*
* @example
* var files = [ '/stdlib/stdlib/lib/node_modules/@stdlib/constants/float64/min-safe-integer/package.json' ];
*
* var names = transform( files );
* // returns [ '@stdlib/constants/float64/min-safe-integer' ]
*/
function transform( files ) {
var match;
var name;
var out;
var i;
out = [];
for ( i = 0; i < files.length; i++ ) {
match = lastIndexOf( files[ i ], '@stdlib' );
if ( match >= 0 ) {
name = files[ i ].substring( match );
name = dirname( name );
out.push( convertPath( name, 'posix' ) );
}
}
return out;
}
// EXPORTS //
module.exports = transform;
|
import { group, benchmark } from './lib/minibench/minibench.js';
import { BlazorApp } from './util/BlazorApp.js';
group('App Startup', () => {
benchmark('Time to first UI', async () => {
const app = new BlazorApp();
try {
await app.start();
} finally {
app.dispose();
}
}, {
descriptor: {
name: "blazorwasm/time-to-first-ui",
description: "Time to render first UI (ms)"
}
});
});
|
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a MetricSpecification.
*/
class MetricSpecification {
/**
* Create a MetricSpecification.
* @member {string} [name]
* @member {string} [displayName]
* @member {string} [displayDescription]
* @member {string} [unit]
* @member {string} [aggregationType]
* @member {boolean} [supportsInstanceLevelAggregation]
* @member {boolean} [enableRegionalMdmAccount]
* @member {string} [sourceMdmAccount]
* @member {string} [sourceMdmNamespace]
* @member {string} [metricFilterPattern]
* @member {boolean} [fillGapWithZero]
* @member {boolean} [isInternal]
* @member {array} [dimensions]
* @member {string} [category]
* @member {array} [availabilities]
*/
constructor() {
}
/**
* Defines the metadata of MetricSpecification
*
* @returns {object} metadata of MetricSpecification
*
*/
mapper() {
return {
required: false,
serializedName: 'MetricSpecification',
type: {
name: 'Composite',
className: 'MetricSpecification',
modelProperties: {
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
displayName: {
required: false,
serializedName: 'displayName',
type: {
name: 'String'
}
},
displayDescription: {
required: false,
serializedName: 'displayDescription',
type: {
name: 'String'
}
},
unit: {
required: false,
serializedName: 'unit',
type: {
name: 'String'
}
},
aggregationType: {
required: false,
serializedName: 'aggregationType',
type: {
name: 'String'
}
},
supportsInstanceLevelAggregation: {
required: false,
serializedName: 'supportsInstanceLevelAggregation',
type: {
name: 'Boolean'
}
},
enableRegionalMdmAccount: {
required: false,
serializedName: 'enableRegionalMdmAccount',
type: {
name: 'Boolean'
}
},
sourceMdmAccount: {
required: false,
serializedName: 'sourceMdmAccount',
type: {
name: 'String'
}
},
sourceMdmNamespace: {
required: false,
serializedName: 'sourceMdmNamespace',
type: {
name: 'String'
}
},
metricFilterPattern: {
required: false,
serializedName: 'metricFilterPattern',
type: {
name: 'String'
}
},
fillGapWithZero: {
required: false,
serializedName: 'fillGapWithZero',
type: {
name: 'Boolean'
}
},
isInternal: {
required: false,
serializedName: 'isInternal',
type: {
name: 'Boolean'
}
},
dimensions: {
required: false,
serializedName: 'dimensions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'DimensionElementType',
type: {
name: 'Composite',
className: 'Dimension'
}
}
}
},
category: {
required: false,
serializedName: 'category',
type: {
name: 'String'
}
},
availabilities: {
required: false,
serializedName: 'availabilities',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'MetricAvailabilityElementType',
type: {
name: 'Composite',
className: 'MetricAvailability'
}
}
}
}
}
}
};
}
}
module.exports = MetricSpecification;
|
myApp.factory("relacaoAtletasAPI", function ($http, config) {
var _getEventos = function () {
return $http.get(config.baseUrl + "/ListarEventos");
};
var _getRelacao = function (evento) {
return $http.post(config.baseUrl + "/ListaRelacaoAtletas", evento);
};
return{
getEventos: _getEventos,
getRelacao: _getRelacao
};
});
|
/**
* Created with JetBrains PhpStorm.
* User: Mrkupi
* Date: 9/22/13
* Time: 9:34 AM
* To change this template use File | Settings | File Templates.
*/
var BombManager = cc.Node.extend({
bombs:null,
effectManager:null,
initialize:function()
{
this.bombs = new Array();
this.scheduleUpdate();
},
update:function(dt)
{
this.removeWithExplodeBomb();
},
addChild:function(child)
{
if(this.bombs == null)
{
this.bombs = new Array();
}
this.bombs.push( child );
this._super(child);
}
});
BombManager.prototype.setEffectManager = function(manager)
{
this.effectManager = manager;
this.addChild(this.effectManager);
}
BombManager.prototype.removeWithExplodeBomb = function()
{
if(this.bombs != null)
{
for(var i = 0; i < this.bombs.length; ++i)
{
if(this.bombs[i].isExplode == true)
{
// Now call to fire effect on screen
this.effectManager.fire(this.bombs[i].chopEffectTexture, this.bombs[i].bodyEffectTexture, this.bombs[i].centerEffectTexture,
this.bombs[i].getPosition(), this.bombs[i].range);
this.removeChild(this.bombs[i]);
this.bombs.splice(i, 1);
}
}
}
}
|
var baseUrlServer = 'http://luzparatodos.o3midia.com.br/';
$('#btn_cadastrar_usuario').click(function(){
dadosForm = $('#form_login').serialize();
console.log(dadosForm);
});
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady()
{
$('#btn_login').click(function(){
dadosForm = $('#form_login').serialize();
$.post(baseUrlServer,dadosForm,function(r){
});
});
}
var endereco = 'VAZIO';
// onSuccess Geolocation
//
function onSuccess(position) {
// var element = document.getElementById('geolocation');
// element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
// var msg = 'Latitude: ' + position.coords.latitude + '<br />' +
// 'Longitude: ' + position.coords.longitude + '<br />' +
// 'Altitude: ' + position.coords.altitude + '<br />' +
// 'Accuracy: ' + position.coords.accuracy + '<br />' +
// 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
// 'Heading: ' + position.coords.heading + '<br />' +
// 'Speed: ' + position.coords.speed + '<br />' +
// 'Timestamp: ' + position.timestamp + '<br />';
var urlGmaps = 'http://maps.googleapis.com/maps/api/geocode/json?' + 'latlng='+position.coords.latitude+','+position.coords.longitude+'&sensor=false';
$.getJSON(urlGmaps,function(dataJson){
endereco = dataJson.results[0].formatted_address;
$('#paragrafo_tela_estou_aqui').html(endereco);
$('#btn_salvar_endereco_tela_estou_aqui,#observacao_tela_estou_aqui').show();
$.mobile.loading('hide');
});
}
$('#tela-estou-aqui').on('pagehide',function(){
$('#paragrafo_tela_estou_aqui').html('');
$('#btn_salvar_endereco_tela_estou_aqui,#observacao_tela_estou_aqui').hide();
});
$('#tela-estou-aqui').on('pageshow',function(){
$.mobile.loading('show');
navigator.geolocation.getCurrentPosition(onSuccess, onError);
});
$('#btn_salvar_endereco_tela_estou_aqui').click(function(){
alert(endereco);
});
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
|
queue()
.defer(d3.json, "/cf/cc/api/data")
.defer(d3.json, "/cf/cc/api/ts/data")
.await(renderAll)
function renderAll(error, rawData, tsData) {
//Start Transformations
var rawDataSet = rawData;
var tsDataSet = tsData;
// Convert String to iso date format
var dateFormat = d3.time.format.iso;
tsDataSet.forEach(function(d) {
// console.log("d = " + d)
// console.log("d.received_date = " + d.received_date)
d.received_date = dateFormat.parse(d.received_date);
d.received_date.setDate(1);
// console.log("d.received_date formatted = " + d.received_date)
});
// 2013-07-29T04:00:00.000Z
// console.log("+++++rawDataSet:" + rawDataSet);
// console.log("+++++tsDataSet:" + tsDataSet);
//Create a Crossfilter instance
var ndx = crossfilter(rawDataSet);
// Create dataTable dimension
var companyDimension = ndx.dimension(function (d) {
return d.Company;
});
var dataTable = dc.dataTable('#dc-table-graph');
dataTable
.dimension(companyDimension)
.size(5)
.group(function(d) { return "<h4>Raw Sample Data</h4>"
})
.columns([
function (d) { return d.company },
function (d) { return d.product },
function (d) { return d.sub_product},
function (d) { return d.issue },
function (d) { return d.state }
]);
// Render Time Series Data
//Create a Crossfilter instance
var tsNdx = crossfilter(tsDataSet);
var complaintReceivedDate = tsNdx.dimension(function(d) { return d.received_date; });
var company = tsNdx.dimension(function(d) { return d.company; });
var product = tsNdx.dimension(function(d) { return d.product; });
var issue = tsNdx.dimension(function(d) { return d.issue; });
var complaintId = tsNdx.dimension(function(d) { return d.complaint_id; });
// Grouping fields
var complaintsByDate = complaintReceivedDate.group();
var complaintsByCompany = company.group();
var complaintsByProduct = product.group();
var complaintsByIssue = issue.group();
var all = tsNdx.groupAll();
var year = tsNdx.dimension(function(d) { return d.year; });
var yearGroup = year.group();
//Define threshold values for data
var minDate = complaintReceivedDate.bottom(1)[0].received_date;
var maxDate = complaintReceivedDate.top(1)[0].received_date;
// Charts
var dateChart = dc.lineChart("#date-chart");
var complaintsByCompanyChart = dc.rowChart("#complaints-by-companies-chart");
var complaintsByProductChart = dc.rowChart("#complaints-by-product-chart");
var complaintsByIssueChart = dc.rowChart("#complaints-by-issue-chart");
var pieChart = dc.pieChart("#pie-chart");
var pieChartProducts = dc.pieChart("#pie-chart-products");
// Table
var dataTable1 = dc.dataTable('#dc-table-graph-1');
// year menu
selectField = dc.selectMenu('#menuselect')
.dimension(year)
.group(yearGroup);
dc.dataCount("#row-selection")
.dimension(tsNdx)
.group(all);
console.log("minDate= " + minDate);
console.log("maxDate= " + maxDate);
dateChart
//.width(600)
.height(220)
.margins({top: 10, right: 50, bottom: 30, left: 50})
.dimension(complaintReceivedDate)
.group(complaintsByDate)
.renderArea(true)
.transitionDuration(500)
.x(d3.time.scale().domain([minDate, maxDate]))
.elasticY(true)
.renderHorizontalGridLines(true)
.renderVerticalGridLines(true)
.xAxisLabel("Year")
.yAxis().ticks(6);
complaintsByCompanyChart
//.width(300)
.height(250)
.dimension(company)
.group(complaintsByCompany)
.elasticX(true)
.xAxis().ticks(5);
complaintsByProductChart
//.width(300)
.height(250)
.dimension(product)
.group(complaintsByProduct)
.elasticX(true)
.xAxis().ticks(5);
complaintsByIssueChart
//.width(300)
.height(1000)
.dimension(issue)
.group(complaintsByIssue)
.elasticX(true)
.xAxis().ticks(5);
pieChart
.height(450)
//.width(350)
.radius(200)
.innerRadius(40)
.transitionDuration(1000)
.dimension(complaintId)
.group(complaintsByCompany);
pieChartProducts
.height(450)
// .width(450)
.radius(200)
.innerRadius(40)
.transitionDuration(1000)
.dimension(complaintId)
.group(complaintsByProduct);
var tableDimension = tsNdx.dimension(function(d) {return [(+d.company),(+d.product)];})
var tableGrouping = function (d) { return "<h5 style='color:green;'>" + d.company + "</h5>";};
dataTable1
.dimension(tableDimension)
.size(10)
.group(tableGrouping)
.columns([
function (d) { return d.product },
function (d) { return d.issue },
function (d) { return d.received_date }
])
.sortBy(function (d) { return d.received_date; });
dc.renderAll();
};
|
/*
* Vibe
* http://vibe-project.github.io/projects/vibe-protocol/
*
* Copyright 2014 The Vibe Project
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*/
// Defines the module
module.exports = {
// Creates a vibe socket and establishes a connection to the server.
open: require("./socket"),
// Creates a vibe server.
createServer: require("./server"),
// Defines Transport module.
transport: {
// Creates a HTTP transport server.
createHttpServer: require("./transport-http-server"),
// Creates a HTTP streaming transport.
createHttpStreamTransport: require("./transport-http-stream-transport"),
// Creates a HTTP long polling transport.
createHttpLongpollTransport: require("./transport-http-longpoll-transport"),
// Creates a WebSocket transport server.
createWebSocketServer: require("./transport-websocket-server"),
// Creates a WebSocket transport.
createWebSocketTransport: require("./transport-websocket-transport"),
}
};
|
import mix from "./mix";
export default (color) => (weight) => mix("FFFFFF", color, weight);
|
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("workbox-v3.6.3/workbox-sw.js");
workbox.setConfig({modulePathPrefix: "workbox-v3.6.3"});
workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
workbox.skipWaiting();
workbox.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [
{
"url": "webpack-runtime-3b0de88cc86236a9fd25.js"
},
{
"url": "styles.d5535f422ce021f2fbf4.css"
},
{
"url": "styles-36681512479a843831b0.js"
},
{
"url": "framework-52a3ea48de1a5dd03b5a.js"
},
{
"url": "app-8676dc5fee877e903cab.js"
},
{
"url": "component---node-modules-gatsby-plugin-offline-app-shell-js-af9e0f2c9acfb4fb259c.js"
},
{
"url": "offline-plugin-app-shell-fallback/index.html",
"revision": "2e2284128b12e011ace69ffe4b6e061e"
},
{
"url": "manifest.webmanifest",
"revision": "bd80d19c4b4dd12eca877feb0b5015cc"
}
].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, workbox.strategies.cacheFirst(), 'GET');
workbox.routing.registerRoute(/^https?:.*\page-data\/.*\/page-data\.json/, workbox.strategies.networkFirst(), 'GET');
workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, workbox.strategies.staleWhileRevalidate(), 'GET');
workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, workbox.strategies.staleWhileRevalidate(), 'GET');
/* global importScripts, workbox, idbKeyval */
importScripts(`idb-keyval-iife.min.js`)
const { NavigationRoute } = workbox.routing
const navigationRoute = new NavigationRoute(async ({ event }) => {
let { pathname } = new URL(event.request.url)
pathname = pathname.replace(new RegExp(`^`), ``)
// Check for resources + the app bundle
// The latter may not exist if the SW is updating to a new version
const resources = await idbKeyval.get(`resources:${pathname}`)
if (!resources || !(await caches.match(`/app-8676dc5fee877e903cab.js`))) {
return await fetch(event.request)
}
for (const resource of resources) {
// As soon as we detect a failed resource, fetch the entire page from
// network - that way we won't risk being in an inconsistent state with
// some parts of the page failing.
if (!(await caches.match(resource))) {
return await fetch(event.request)
}
}
const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
return await caches.match(offlineShell)
})
workbox.routing.registerRoute(navigationRoute)
const messageApi = {
setPathResources(event, { path, resources }) {
event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
},
clearPathResources(event) {
event.waitUntil(idbKeyval.clear())
},
}
self.addEventListener(`message`, event => {
const { gatsbyApi } = event.data
if (gatsbyApi) messageApi[gatsbyApi](event, event.data)
})
|
export default function VideoBlockV1Mixin(M) {
Object.assign(M.prototype, {
/**
* @returns {Object}
*/
getUriTemplateVars() {
return {
etag: this.get('etag'),
node_ref: `${this.get('node_ref', '')}`,
autoplay: this.get('autoplay'),
muted: this.get('muted'),
start_at: this.get('start_at'),
show_more_videos: this.get('show_more_videos'),
};
}
});
}
|
/**
* Created by 310199253 on 2016/12/30.
*/
var moment = require('moment');
var m = moment("2013/7/18", "YYYY/MM/DD HH:mm:ss");
console.log(m.isValid());
console.log(m.valueOf());
|
// ECMAScript 5 strict mode
"use strict";
assert2(cr, "cr namespace not created");
assert2(cr.plugins_, "cr.plugins_ not created");
/////////////////////////////////////
// Plugin class
cr.plugins_.Rex_Parse_FileUpload = function(runtime)
{
this.runtime = runtime;
};
(function ()
{
var pluginProto = cr.plugins_.Rex_Parse_FileUpload.prototype;
/////////////////////////////////////
// Object type class
pluginProto.Type = function(plugin)
{
this.plugin = plugin;
this.runtime = plugin.runtime;
};
var typeProto = pluginProto.Type.prototype;
typeProto.onCreate = function()
{
jsfile_load("parse-1.5.0.min.js");
};
var jsfile_load = function(file_name)
{
var scripts=document.getElementsByTagName("script");
var exist=false;
for(var i=0;i<scripts.length;i++)
{
if(scripts[i].src.indexOf(file_name) != -1)
{
exist=true;
break;
}
}
if(!exist)
{
var newScriptTag=document.createElement("script");
newScriptTag.setAttribute("type","text/javascript");
newScriptTag.setAttribute("src", file_name);
document.getElementsByTagName("head")[0].appendChild(newScriptTag);
}
};
/////////////////////////////////////
// Instance class
pluginProto.Instance = function(type)
{
this.type = type;
this.runtime = type.runtime;
};
var instanceProto = pluginProto.Instance.prototype;
instanceProto.onCreate = function()
{
if ((!window.RexC2IsParseInit) && (this.properties[0] !== ""))
{
window["Parse"]["initialize"](this.properties[0], this.properties[1]);
window.RexC2IsParseInit = true;
}
this.file_obj = null;
this.last_error = null;
};
instanceProto.UploadImage = function (dataURI, file_name)
{
var d = {'base64': dataURI};
this.file_obj = new Parse["File"](file_name, d, null);
var self = this;
var on_complete = function()
{
self.runtime.trigger(cr.plugins_.Rex_Parse_FileUpload.prototype.cnds.OnUploadCompleted, self);
};
var on_error = function(error)
{
self.last_error = error;
self.runtime.trigger(cr.plugins_.Rex_Parse_FileUpload.prototype.cnds.OnUploadError, self);
};
this.file_obj["save"]()["then"](on_complete, on_error);
};
//////////////////////////////////////
// Conditions
function Cnds() {};
pluginProto.cnds = new Cnds();
Cnds.prototype.OnUploadCompleted = function ()
{
return true;
};
Cnds.prototype.OnUploadError = function ()
{
return true;
};
//////////////////////////////////////
// Actions
function Acts() {};
pluginProto.acts = new Acts();
Acts.prototype.UploadImage = function (dataURI, file_name)
{
this.UploadImage(dataURI, file_name);
};
Acts.prototype.UploadSpriteCurrentFrame = function (sprite_objs, file_name)
{
if (!sprite_objs)
return;
var inst = sprite_objs.instances[0];
if (inst.curFrame == null)
return;
var dataURI = inst.curFrame.getDataUri();
this.UploadImage(dataURI, file_name);
};
//////////////////////////////////////
// Expressions
function Exps() {};
pluginProto.exps = new Exps();
Exps.prototype.LastURL = function (ret)
{
var url = "";
if ((this.file_obj != null) && this.file_obj["url"])
url = this.file_obj["url"]();
ret.set_string(url);
};
Exps.prototype.LastFileName = function (ret)
{
var name = "";
if ((this.file_obj != null) && this.file_obj["name"])
name = this.file_obj["name"]();
ret.set_string(name);
};
Exps.prototype.ErrorCode = function (ret)
{
var val = (!this.last_error)? "": this.last_error["code"];
ret.set_int(val);
};
Exps.prototype.ErrorMessage = function (ret)
{
var val = (!this.last_error)? "": this.last_error["message"];
ret.set_string(val);
};
}());
|
// 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.
import FauxtonAPI from "../../../core/api";
import Actions from "../designdocinfo/actions";
import testUtils from "../../../../test/mocha/testUtils";
import sinon from "sinon";
const {assert, restore} = testUtils;
describe('DesignDocInfo Actions', () => {
describe('fetchDesignDocInfo', () => {
afterEach(() => {
restore(Actions.monitorDesignDoc);
});
it('calls monitorDesignDoc on successful fetch', () => {
const promise = FauxtonAPI.Deferred();
promise.resolve();
const fakeDesignDocInfo = {
fetch: () => {
return promise;
}
};
const spy = sinon.spy(Actions, 'monitorDesignDoc');
return Actions.fetchDesignDocInfo({
ddocName: 'test-designdoc-info',
designDocInfo: fakeDesignDocInfo
}).then(() => {
assert.ok(spy.calledOnce);
});
});
});
});
|
var Chariot = function ( $core, $control ) {
var self = require( "/globHammer/core/rock/RockContent" )( $core, $control );
self.execute = function(){
self.display.position.x = self.core.rock.x;
self.display.position.y = self.core.rock.y;
}
self.clickUp = function(){}
self.show = function ( id ){
trace("id " + id + " :: " + self.currentToonID);
var soul = self.core.soul;
if ( id == self.currentToonID ) return self.currentToon;
self.currentToonID = id;
if ( self.currentToon != null ) self.currentToon.visible = false;
var display = self.toons[ id ];
if ( display == null ) {
self.currentToonID = "nullDisplay";
return;
}
display.visible = true;
display.gotoAndPlay( 0 );
self.currentToon = display;
return display;
}
self.clickDown = function( event ){
self.core.rock.dispatchEvent( "ACTIVE", [ self.core.rock ] );
}
self.awake = function( rock ){
var soul = self.core.soul;
var max = soul.toonList.length;
for ( var i = 0; i < max; i++ )
{
var toon = soul.toonList[ i ];
self.buildToon( toon );
}
var display = self.display;
display.setInteractive(true);
display.touchendoutside = self.clickUp;
display.mouseupoutside = self.clickUp;
display.touchend = self.clickUp;
display.mouseup = self.clickUp;
display.touchstartoutside = self.clickDown;
display.mousedownoutside = self.clickDown;
display.touchstart = self.clickDown;
display.mousedown = self.clickDown;
self.core.glob.soulLayer.addChild( display );
self.execute();
}
self.remove = function (){
var parent = self.display.parent;
if ( parent == null ) return trace("no parent present ");
parent.removeChild ( self.display )
trace(' do we know its parent ' + self.display.parent );
//trace( self.core.glob.soulLayer.contains( self.display));
//self.core.glob.soulLayer.removeChild( self.display);
}
self.buildToon = function( toon ){
var max;
if ( toon.src != null ) max = toon.src.length;
if ( toon.frames != null ) max = toon.frames.length;
var textureList = [];
//PWEEZE REMOVE THIS
//if ( toon.frames != null ) self.replaceFramesWithURLs( toon.src, toon.frames ); //here is the issue
for ( var i = 0; i < max; i++ )
{
var index = i;
if ( toon.frames != null ) index = toon.frames[ i ];
if ( toon.frames == null ) index = toon.src[ i ];
if (index == 'x') return;
var texture = PIXI.Texture.fromImage( index );
if ( texture != null ) textureList.push( texture );
}
var display = new PIXI.MovieClip( textureList );
self.toons[ toon.id ] = display;
display.setInteractive(true);
display.anchor.x = 0.5;
display.anchor.y = 0.5;
//trace( toon.id + " / " + display );
display.visible = false;
if ( toon.viz == "1" ) {
display.play();
if ( self.currentToon != null ) self.currentToon.visible = false;
self.currentToon = display;
display.visible = true;
}
if ( toon.x != null) display.position.x = toon.x;
if ( toon.y != null) display.position.y = toon.y;
if ( toon.speed != null) display.animationSpeed = toon.speed;
if ( toon.loop == null) display.loop = true;
if ( toon.loop != null) display.loop = toon.loop;
if ( toon.loop == null) display.loop = true;
//ANIMATION TO CALL @ THE END
if ( toon.complete != null ) {
display.loop = false;
display.onComplete = function() {
if ( display.visible == false ) return;
self.show ( toon.complete );
}
};
//FUNCTION TO CALL @ the END
if ( toon.end != null ) {
display.loop = false;
display.onComplete = function() {
var soul = self.core.soul;
if ( toon.end != null ) soul[ toon.end ]();
};
};
//here is perhaps where the lanscape should go
self.display.addChild( display );
}
self.toons = {};
return self;
};
exports = module.exports = Chariot;
|
var AreaRoute = Ember.Route.extend({
// afterModel: function(area) {
// $.get(area.get('image_url')).then(function(data) {
// area.set('contents', [$('<g/>').append(data.documentElement.childNodes).html()]) // parsing twice
// area.set('attributes', { viewBox: data.documentElement.attributes.viewBox.value })
// //debugger
// })
// }
});
export default AreaRoute;
|
export default {
apiKey: 'YOUR_BOT_API_KEY',
pollingTimeout: 20,
startMessage: `Hello. I'm the TLBot. I can help you to translate some text!`,
masterId: 'YOUR_TELEGRAM_USER_ID (Something like 12345678)'
}
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.from
es6id: 22.1.2.1
description: >
`this` value of mapping function with custom `this` argument (traversed via iterator)
info: |
[...]
2. If mapfn is undefined, let mapping be false.
3. else
a. If IsCallable(mapfn) is false, throw a TypeError exception.
b. If thisArg was supplied, let T be thisArg; else let T be undefined.
c. Let mapping be true
[...]
6. If usingIterator is not undefined, then
[...]
g. Repeat
[...]
vii. If mapping is true, then
1. Let mappedValue be Call(mapfn, T, «nextValue, k»).
features: [Symbol.iterator]
---*/
var thisVals = [];
var nextResult = {
done: false,
value: {}
};
var nextNextResult = {
done: false,
value: {}
};
var mapFn = function() {
thisVals.push(this);
};
var items = {};
var thisVal = {};
items[Symbol.iterator] = function() {
return {
next: function() {
var result = nextResult;
nextResult = nextNextResult;
nextNextResult = {
done: true
};
return result;
}
};
};
Array.from(items, mapFn, thisVal);
assert.sameValue(thisVals.length, 2);
assert.sameValue(thisVals[0], thisVal, 'First iteration `this` value');
assert.sameValue(thisVals[1], thisVal, 'Second iteration `this` value');
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.some
es5id: 15.4.4.17-2-13
description: >
Array.prototype.some - 'length' is inherited accessor property
without a get function on an Array-like object
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return val > 10;
}
var proto = {};
Object.defineProperty(proto, "length", {
set: function() {},
configurable: true
});
var Con = function() {};
Con.prototype = proto;
var child = new Con();
child[0] = 11;
child[1] = 12;
assert.sameValue(Array.prototype.some.call(child, callbackfn), false, 'Array.prototype.some.call(child, callbackfn)');
assert.sameValue(accessed, false, 'accessed');
|
import { $http } from '@/services/ng';
class OrganizationStatus {
constructor() {
this.objectCounters = {};
}
refresh() {
return $http.get('api/organization/status').then(({ data }) => {
this.objectCounters = data.object_counters;
return this;
});
}
}
export default new OrganizationStatus();
|
$(function () {
var urlXMLControl = "/xmlctrl";
$.ajax({
type: "GET",
url: urlXMLControl + "/GetVersion",
cache: false,
contentType: "text/xml", // "application/xml", "application/xml; charset=utf-8"
})
.done(function(xml, textStatus, jqXHR) {
$("#textVersion").text("Version: " + $(xml).find("Version").text());
});
})();
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.lastindexof
es5id: 15.4.4.15-8-b-i-5
description: >
Array.prototype.lastIndexOf - element to be retrieved is own data
property that overrides an inherited accessor property on an Array
---*/
Object.defineProperty(Array.prototype, "0", {
get: function() {
return false;
},
configurable: true
});
assert.sameValue([Number].lastIndexOf(Number), 0, '[Number].lastIndexOf(Number)');
|
var searchData=
[
['orientation',['orientation',['../group__orientation.html#gacd4a2942520b68691db5aebde4e537a4',1,'orientation(): orientation.c'],['../group__orientation.html#gacd4a2942520b68691db5aebde4e537a4',1,'orientation(): orientation.c']]],
['orientationerror',['orientationError',['../group__orientation.html#gab42c272957b0a5cdc11845ade183c2f9',1,'orientation.c']]],
['outfile',['outFile',['../group__xycontrol.html#gaa9e0cac6f45e381f488c1dd9a8418ca2',1,'xycontrol.c']]],
['outmax',['outMax',['../struct_p_i_d_state.html#a3bcf8ed648b49bfe14cf141b134ba23b',1,'PIDState']]],
['outmin',['outMin',['../struct_p_i_d_state.html#a5df6ddfa37685d9035861b0d9f323a05',1,'PIDState']]]
];
|
$.register({
rule: {
host: /^www\.spaste\.com$/,
path: /^\/go\/\w+$/,
},
ready: function () {
'use strict';
var id = $.searchScripts(/\{id:'(\d+)'\}/);
_.wait(3000).then(function () {
return $.post('/site/getRedirectLink', {
id: id,
}).then(function (url) {
$.openLink(url);
});
});
},
});
// ex: ts=2 sts=2 sw=2 et
// sublime: tab_size 2; translate_tabs_to_spaces true; detect_indentation false; use_tab_stops true;
// kate: space-indent on; indent-width 2;
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.filter
es5id: 15.4.4.20-9-c-iii-28
description: >
Array.prototype.filter - return value of callbackfn is the global
object
---*/
var global = this;
function callbackfn(val, idx, obj) {
return global;
}
var newArr = [11].filter(callbackfn);
assert.sameValue(newArr.length, 1, 'newArr.length');
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
jsgradient = {
inputA : '',
inputB : '',
inputC : '',
gradientElement : '',
// Convert a hex color to an RGB array e.g. [r,g,b]
// Accepts the following formats: FFF, FFFFFF, #FFF, #FFFFFF
hexToRgb : function(hex){
var r, g, b, parts;
// Remove the hash if given
hex = hex.replace('#', '');
// If invalid code given return white
if(hex.length !== 3 && hex.length !== 6){
return [255,255,255];
}
// Double up charaters if only three suplied
if(hex.length == 3){
hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
}
// Convert to [r,g,b] array
r = parseInt(hex.substr(0, 2), 16);
g = parseInt(hex.substr(2, 2), 16);
b = parseInt(hex.substr(4, 2), 16);
return [r,g,b];
},
// Converts an RGB color array e.g. [255,255,255] into a hexidecimal color value e.g. 'FFFFFF'
rgbToHex : function(color){
// Set boundries of upper 255 and lower 0
color[0] = (color[0] > 255) ? 255 : (color[0] < 0) ? 0 : color[0];
color[1] = (color[1] > 255) ? 255 : (color[1] < 0) ? 0 : color[1];
color[2] = (color[2] > 255) ? 255 : (color[2] < 0) ? 0 : color[2];
return this.zeroFill(color[0].toString(16), 2) + this.zeroFill(color[1].toString(16), 2) + this.zeroFill(color[2].toString(16), 2);
},
// Pads a number with specified number of leading zeroes
zeroFill : function( number, width ){
width -= number.toString().length;
if ( width > 0 ){
return new Array( width + (/\./.test( number ) ? 2 : 1) ).join( '0' ) + number;
}
return number;
},
// Generates an array of color values in sequence from 'colorA' to 'colorB' using the specified number of steps
generateGradient : function(colorA, colorB, steps){
var result = [], rInterval, gInterval, bInterval;
colorA = this.hexToRgb(colorA); // [r,g,b]
colorB = this.hexToRgb(colorB); // [r,g,b]
steps -= 1; // Reduce the steps by one because we're including the first item manually
// Calculate the intervals for each color
rStep = ( Math.max(colorA[0], colorB[0]) - Math.min(colorA[0], colorB[0]) ) / steps;
gStep = ( Math.max(colorA[1], colorB[1]) - Math.min(colorA[1], colorB[1]) ) / steps;
bStep = ( Math.max(colorA[2], colorB[2]) - Math.min(colorA[2], colorB[2]) ) / steps;
result.push( '#'+this.rgbToHex(colorA) );
// Set the starting value as the first color value
var rVal = colorA[0],
gVal = colorA[1],
bVal = colorA[2];
// Loop over the steps-1 because we're includeing the last value manually to ensure it's accurate
for (var i = 0; i < (steps-1); i++) {
// If the first value is lower than the last - increment up otherwise increment down
rVal = (colorA[0] < colorB[0]) ? rVal + Math.round(rStep) : rVal - Math.round(rStep);
gVal = (colorA[1] < colorB[1]) ? gVal + Math.round(gStep) : gVal - Math.round(gStep);
bVal = (colorA[2] < colorB[2]) ? bVal + Math.round(bStep) : bVal - Math.round(bStep);
result.push( '#'+this.rgbToHex([rVal, gVal, bVal]) );
};
result.push( '#'+this.rgbToHex(colorB) );
return result;
},
gradientList : function(colorA, colorB, list){
var list = (typeof list === 'object')? list : document.querySelector(list);
var listItems = list.querySelectorAll('li'),
steps = listItems.length,
colors = jsgradient.generateGradient(colorA, colorB, steps);
for (var i = 0; i < listItems.length; i++) {
var item = listItems[i];
item.style.backgroundColor = colors[i];
};
}
}
|
// This file was procedurally generated from the following sources:
// - src/class-fields/computed-symbol-names.case
// - src/class-fields/productions/cls-decl-after-same-line-static-gen.template
/*---
description: Computed property symbol names (field definitions after a static generator in the same line)
esid: prod-FieldDefinition
features: [Symbol, computed-property-names, generators, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
...
FieldDefinition ;
FieldDefinition:
ClassElementName Initializer_opt
ClassElementName:
PropertyName
---*/
var x = Symbol();
var y = Symbol();
class C {
static *m() { return 42; } [x]; [y] = 42;
}
var c = new C();
assert.sameValue(C.m().next().value, 42);
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
verifyProperty(C, "m", {
enumerable: false,
configurable: true,
writable: true,
});
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
verifyProperty(c, x, {
value: undefined,
enumerable: true,
writable: true,
configurable: true
});
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
verifyProperty(c, y, {
value: 42,
enumerable: true,
writable: true,
configurable: true
});
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
assert.sameValue(Object.hasOwnProperty.call(c, "y"), false);
|
import express from 'express';
import path from 'path';
import logger from 'morgan';
import bodyParser from 'body-parser';
const app = express();
if (process.env.DEBUG) {
app.use(logger('combined'));
}
app.use(express.static(path.resolve(__dirname, '../fixtures')));
app.use(bodyParser.json());
app.get('/ping', (req, res) => {
res.sendStatus(200);
});
app.get('/401', (req, res) => {
res.status(401).send({ errors: ['unauthorized req'] });
});
app.post('/products', (req, res) => {
res.send({ data: req.body, meta: { method: 'post' } });
});
app.patch('/products/:id', (req, res) => {
res.send({ meta: { method: 'patch' } });
});
app.delete('/products/:id', (req, res) => {
res.send({ meta: { method: 'delete' } });
});
app.get('/query', (req, res) => {
res.send({ meta: { query: req.query || {} } });
});
export default app;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.