text
stringlengths 2
6.14k
|
|---|
/**
* Copyright (c) 2016, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or
* https://opensource.org/licenses/BSD-3-Clause
*/
/**
* view/admin/utils/configure-store.js
*
* Rigs up the store with redux-thunk for http calls,
* root reducer and initial state.
*/
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import rootReducer from '../reducers';
const logger = createLogger();
// wrap store store creation function
const finalCreateStore = compose(
// apply middleware to store
// middleware intercepts calls to dispatch() and adds speciality output
applyMiddleware(thunk, logger),
// pass store through chrome extension, so state can be controlled
// See Redux Devtools
window.devToolsExtension ? window.devToolsExtension() : (f) => f
)(createStore);
export default function configureStore(initialState) {
return finalCreateStore(rootReducer, initialState);
}
|
#!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var spawn = require('cross-spawn');
var script = process.argv[2];
var args = process.argv.slice(3);
switch (script) {
case 'build':
case 'eject':
case 'start':
case 'test':
case 'generate-component':
var result = spawn.sync(
'node',
[require.resolve('../scripts/' + script)].concat(args),
{ stdio: 'inherit' }
);
if (result.signal) {
if (result.signal === 'SIGKILL') {
console.log(
'The build failed because the process exited too early. ' +
'This probably means the system ran out of memory or someone called ' +
'`kill -9` on the process.'
);
} else if (result.signal === 'SIGTERM') {
console.log(
'The build failed because the process exited too early. ' +
'Someone might have called `kill` or `killall`, or the system could ' +
'be shutting down.'
);
}
process.exit(1);
}
process.exit(result.status);
break;
default:
console.log('Unknown script "' + script + '".');
console.log('Perhaps you need to update react-scripts?');
console.log(
'See: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/templates/app/README.md#updating-to-new-releases'
);
break;
}
|
// This file was generated by silverstripe/cow from client/lang/src/sk.js.
// See https://github.com/tractorcow/cow for details
if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
if (typeof(console) !== 'undefined') { // eslint-disable-line no-console
console.error('Class ss.i18n not defined'); // eslint-disable-line no-console
}
} else {
ss.i18n.addDictionary('sk', {
"CMS.ALERTCLASSNAME": "Typ stránky bude aktualizovaný až bude stránka uložená",
"CMS.AddSubPage": "Pridať novú stránku tu",
"CMS.ConfirmRestoreFromLive": "Určite chcete obnoviť koncept do doby, kedy bola stránka naposledy zverejnená?",
"CMS.Duplicate": "Duplikovať",
"CMS.EditPage": "Editovať",
"CMS.ONLYSELECTTWO": "You can only compare two versions at this time.",
"CMS.Restore": "Určite chcete obnoviť túto stánku z archívu?",
"CMS.RestoreToRoot": "Určite chcete obnoviť túto stránku z archívu?\n\nPretože nadriadená stránka nie je k dispozícii, bude obnovena do najvyššej úrovne.",
"CMS.RollbackToVersion": "Skutočne chcete vrátiť späť na verziu #%s tejto stránky?",
"CMS.ShowAsList": "Zobraziť potomkov ako zoznam",
"CMS.ThisPageAndSubpages": "Túto stránku a podstránky",
"CMS.ThisPageOnly": "Iba túto stránku",
"CMS.Unpublish": "Určite chcete odstrániť stránku zo zverejneného webu?\n\nTáto stránka bude stále k dispozícii v štruktúre webu ako koncept.",
"CMS.UpdateURL": "Aktualizovať URL",
"CMS.ViewPage": "Zobraziť"
});
}
|
var express = require('express');
var configurations = module.exports;
var app = express();
var server = require('http').createServer(app);
var nconf = require('nconf');
var settings = require('./settings')(app, configurations, express);
var path = require('path');
var Grafty = require('grafty');
var grafty = new Grafty({
width: 50
});
var Dextromethorphan = require('dextromethorphan');
var dex = new Dextromethorphan({
db: nconf.get('db_posts'),
limit: 30
});
var level = require('level');
var profileDb = level(nconf.get('db_profile'), {
createIfMissing: true,
valueEncoding: 'json'
});
var NoPlebs = require('no-plebs');
var nopleb = new NoPlebs({
db: nconf.get('db_comments'),
limit: 25
});
var twitter = require('twitter-text');
nconf.argv().env().file({ file: 'local.json' });
var isAuthed = function (req, res, next) {
if (req.session.uid) {
next();
} else {
res.redirect('/');
}
};
var moment = require('moment');
// routes
require('./routes/comments')(app, isAuthed, nopleb, twitter, moment, nconf);
require('./routes/posts')(app, grafty, dex, profileDb, nopleb, twitter, moment, isAuthed, nconf);
require('./routes/profile')(app, grafty, dex, profileDb, isAuthed);
server.listen(process.env.PORT || nconf.get('port'));
|
var path = require('path');
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080',
'./src/index.js'
],
output: {
publicPath: '/',
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-0']
}
}
]
},
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
host: '0.0.0.0',
port: 8080,
historyApiFallback: true
}
};
|
db.patients.remove({})
db.getCollection('data_sets').find({}).forEach(function(doc) {
var patientsAdded = 0;
if (!doc["patients"]) return;
for (var i = 0; i < doc["patients"].length; i++) {
var patient = doc["patients"][i];
var samples = [];
for (var s = 0; s < patient["sample_labels"].length; s++) {
samples.push({
sample_label: patient["sample_labels"][s],
data_set_id: doc._id,
});
}
db.getCollection("patients").insert({
_id: new ObjectId().valueOf(),
patient_label: patient.patient_label,
samples: samples,
collaborations: doc.collaborations
});
patientsAdded++;
}
print(patientsAdded);
})
// db.getCollection("data_sets").update({}, {$unset: {patients: 1, sample_labels: 1}}, {multi: true})
|
import React from 'react';
import Toggle from 'rc-checkbox';
import 'rc-checkbox/assets/index.css';
import './Checkbox.css';
const Checkbox = ({ title, defaultValue, onChange }) => (
<label className='Checkbox'>
<Toggle
defaultChecked={ defaultValue }
onChange={ e => onChange(e.target.checked) } />
<span style={{ marginLeft: 10 }}>{ title || '' }</span>
</label>
);
export default Checkbox;
|
var dir_169eaf73225633059c1416b195c6cb0d =
[
[ "BayesNet-inl.h", "a00307.html", null ],
[ "BayesNet.h", "a00308.html", [
[ "BayesNet", "a00009.html", "a00009" ]
] ],
[ "BayesTree-inl.h", "a00309.html", "a00309" ],
[ "BayesTree.h", "a00310.html", "a00310" ],
[ "BayesTreeCliqueBase-inl.h", "a00311.html", null ],
[ "BayesTreeCliqueBase.h", "a00312.html", "a00312" ],
[ "ClusterTree-inl.h", "a00313.html", null ],
[ "ClusterTree.h", "a00314.html", [
[ "ClusterTree", "a00031.html", "a00031" ],
[ "Cluster", "a00030.html", "a00030" ]
] ],
[ "Conditional.h", "a00315.html", [
[ "Conditional", "a00033.html", "a00033" ]
] ],
[ "EliminationTree-inl.h", "a00316.html", null ],
[ "EliminationTree.h", "a00317.html", [
[ "EliminationTree", "a00059.html", "a00059" ],
[ "DisconnectedGraphException", "a00046.html", "a00046" ]
] ],
[ "Factor-inl.h", "a00318.html", null ],
[ "Factor.h", "a00319.html", [
[ "Factor", "a00064.html", "a00064" ]
] ],
[ "FactorGraph-inl.h", "a00320.html", "a00320" ],
[ "FactorGraph.h", "a00321.html", "a00321" ],
[ "GenericMultifrontalSolver-inl.h", "a00322.html", null ],
[ "GenericMultifrontalSolver.h", "a00323.html", [
[ "GenericMultifrontalSolver", "a00089.html", "a00089" ]
] ],
[ "GenericSequentialSolver-inl.h", "a00324.html", null ],
[ "GenericSequentialSolver.h", "a00325.html", [
[ "GenericSequentialSolver", "a00091.html", "a00091" ]
] ],
[ "graph-inl.h", "a00326_source.html", null ],
[ "graph.h", "a00327.html", "a00327" ],
[ "IndexConditional.cpp", "a00328.html", null ],
[ "IndexConditional.h", "a00329.html", [
[ "IndexConditional", "a00098.html", "a00098" ]
] ],
[ "IndexFactor.cpp", "a00330.html", null ],
[ "IndexFactor.h", "a00331.html", [
[ "IndexFactor", "a00099.html", "a00099" ]
] ],
[ "inference-inl.h", "a00332.html", "a00332" ],
[ "inference.cpp", "a00333.html", "a00333" ],
[ "inference.h", "a00334.html", "a00334" ],
[ "ISAM-inl.h", "a00335.html", null ],
[ "ISAM.h", "a00336.html", [
[ "ISAM", "a00101.html", "a00101" ]
] ],
[ "JunctionTree-inl.h", "a00337.html", null ],
[ "JunctionTree.h", "a00338.html", [
[ "JunctionTree", "a00114.html", "a00114" ]
] ],
[ "Permutation.cpp", "a00339.html", "a00339" ],
[ "Permutation.h", "a00340.html", "a00340" ],
[ "SymbolicFactorGraph.cpp", "a00341.html", "a00341" ],
[ "SymbolicFactorGraph.h", "a00342.html", "a00342" ],
[ "SymbolicMultifrontalSolver.cpp", "a00343.html", null ],
[ "SymbolicMultifrontalSolver.h", "a00344.html", [
[ "SymbolicMultifrontalSolver", "a00191.html", "a00191" ]
] ],
[ "SymbolicSequentialSolver.cpp", "a00345.html", null ],
[ "SymbolicSequentialSolver.h", "a00346.html", [
[ "SymbolicSequentialSolver", "a00192.html", "a00192" ]
] ],
[ "VariableIndex.cpp", "a00347.html", null ],
[ "VariableIndex.h", "a00348.html", [
[ "VariableIndex", "a00207.html", "a00207" ]
] ],
[ "VariableSlots.cpp", "a00349.html", null ],
[ "VariableSlots.h", "a00350.html", [
[ "VariableSlots", "a00208.html", "a00208" ]
] ]
];
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @constructor
* @extends {WebInspector.View}
*/
WebInspector.InspectedPagePlaceholder = function()
{
WebInspector.View.call(this);
this.element.classList.add("inspected-page-placeholder");
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._scheduleUpdate, this);
this._margins = { top: 0, right: 0, bottom: 0, left: 0 };
this.restoreMinimumSizeAndMargins();
};
WebInspector.InspectedPagePlaceholder.Events = {
Update: "Update"
};
WebInspector.InspectedPagePlaceholder.MarginValue = 3;
WebInspector.InspectedPagePlaceholder.prototype = {
_findMargins: function()
{
var margins = { top: 0, right: 0, bottom: 0, left: 0 };
if (this._useMargins) {
var adjacent = { top: true, right: true, bottom: true, left: true };
var view = this;
while (view.parentView()) {
var parent = view.parentView();
// This view assumes it's always inside the main split view element, not a sidebar.
// Every parent which is not a split view, must be of the same size as this view.
if (parent instanceof WebInspector.SplitView) {
var side = parent.sidebarSide();
if (adjacent[side] && !parent.hasCustomResizer() && parent.isResizable())
margins[side] = WebInspector.InspectedPagePlaceholder.MarginValue;
adjacent[side] = false;
}
view = parent;
}
}
if (this._margins.top !== margins.top || this._margins.left !== margins.left || this._margins.right !== margins.right || this._margins.bottom !== margins.bottom) {
this._margins = margins;
this._scheduleUpdate();
}
},
onResize: function()
{
this._findMargins();
this._scheduleUpdate();
},
_scheduleUpdate: function()
{
if (this._updateId)
this.element.window().cancelAnimationFrame(this._updateId);
this._updateId = this.element.window().requestAnimationFrame(this.update.bind(this));
},
restoreMinimumSizeAndMargins: function()
{
this._useMargins = true;
this.setMinimumSize(50, 50);
this._findMargins();
},
clearMinimumSizeAndMargins: function()
{
this._useMargins = false;
this.setMinimumSize(1, 1);
this._findMargins();
},
_dipPageRect: function()
{
var zoomFactor = WebInspector.zoomManager.zoomFactor();
var rect = this.element.getBoundingClientRect();
var bodyRect = this.element.ownerDocument.body.getBoundingClientRect();
var left = Math.max(rect.left * zoomFactor + this._margins.left, bodyRect.left * zoomFactor);
var top = Math.max(rect.top * zoomFactor + this._margins.top, bodyRect.top * zoomFactor);
var bottom = Math.min(rect.bottom * zoomFactor - this._margins.bottom, bodyRect.bottom * zoomFactor);
var right = Math.min(rect.right * zoomFactor - this._margins.right, bodyRect.right * zoomFactor);
return { x: left, y: top, width: right - left, height: bottom - top };
},
update: function()
{
delete this._updateId;
var rect = this._dipPageRect();
var bounds = { x: Math.round(rect.x), y: Math.round(rect.y), height: Math.max(1, Math.round(rect.height)), width: Math.max(1, Math.round(rect.width)) };
this.dispatchEventToListeners(WebInspector.InspectedPagePlaceholder.Events.Update, bounds);
},
__proto__: WebInspector.View.prototype
};
|
var classcrossbow_1_1infinio_1_1_rpc_response =
[
[ "RpcResponse", "classcrossbow_1_1infinio_1_1_rpc_response.html#a5aff1389291798073171aebf69d744dd", null ],
[ "~RpcResponse", "classcrossbow_1_1infinio_1_1_rpc_response.html#aea474873966add062795e7294e5f45b1", null ],
[ "complete", "classcrossbow_1_1infinio_1_1_rpc_response.html#ac1ebaa952222eaaff267bd88f0a43c63", null ],
[ "done", "classcrossbow_1_1infinio_1_1_rpc_response.html#a6f6242328fe3dea41516310a30e9098e", null ],
[ "fiber", "classcrossbow_1_1infinio_1_1_rpc_response.html#a290319e6c8f96456728b795c670deb43", null ],
[ "notify", "classcrossbow_1_1infinio_1_1_rpc_response.html#a82a4e2ab31688f379bc83a23e2bb851d", null ],
[ "wait", "classcrossbow_1_1infinio_1_1_rpc_response.html#aaa388b8c41f39eb9b110adf121a2816e", null ],
[ "RpcClientSocket", "classcrossbow_1_1infinio_1_1_rpc_response.html#a3c8c5df07d7f43fdef91781edd439251", null ]
];
|
var _ = require('underscore');
var $ = require('jquery');
var OnboardingView = require('builder/components/onboardings/generic/generic-onboarding-view');
var template = require('./data-onboarding.tpl');
module.exports = OnboardingView.extend({
initialize: function (opts) {
OnboardingView.prototype.initialize.call(this, _.extend(opts, {
template: template,
numberOfSteps: 4,
modifier: '--data'
}));
},
_onChangeStep: function () {
OnboardingView.prototype._onChangeStep.call(this);
var step = this.model.get('step');
if (step === 0) {
this._setMiddlePad('.js-editorPanel');
} else if (step === 1) {
this._setMiddlePad('.js-editorPanelHeader', {top: 16, right: 24, left: 24});
} else if (step === 2) {
this._setMiddlePad('.js-editorPanelContent', {top: 8, right: 24, left: 24, bottom: -$('.js-optionsBar').outerHeight()});
} else if (step === 3) {
this._setMiddlePad('.js-optionsBar', null, {top: -190});
} else if (step === 4) {
var featurePosition = this._getFeatureEditionPosition();
this._setMiddlePad(featurePosition, {top: 8, right: 8, bottom: 8, left: 8}, {top: -270, left: -330});
}
},
_getFeatureEditionPosition: function () {
var $switch = $('.js-mapTableView').first();
var $featureEdition = $('.js-newGeometryView').first();
var leftOffset = Math.min($switch.length > 0 ? $switch.offset().left : Number.MAX_VALUE, $featureEdition.length > 0 ? $featureEdition.offset().left : Number.MAX_VALUE);
var topOffset = Math.min($switch.length > 0 ? $switch.offset().top : Number.MAX_VALUE, $featureEdition.length > 0 ? $featureEdition.offset().top : Number.MAX_VALUE);
var rightOffset = Math.max(
$switch.length > 0 ? $switch.offset().left + $switch.outerWidth() : Number.MIN_VALUE,
$featureEdition.length > 0 ? $featureEdition.offset().left + $featureEdition.outerWidth() : Number.MIN_VALUE
);
var bottomOffset = Math.max(
$switch.length > 0 ? $switch.offset().top + $switch.outerHeight() : Number.MIN_VALUE,
$featureEdition.length > 0 ? $featureEdition.offset().top + $featureEdition.outerHeight() : Number.MIN_VALUE
);
return {
left: leftOffset,
top: topOffset,
width: rightOffset - leftOffset,
height: bottomOffset - topOffset
};
}
});
|
function findFrameByName(strName) {
return findFrame(top, strName);
}
function findFrame(doc, strName) {
if (doc.frames.length == 0) return;
for (var i = 0; i != doc.frames.length; i++)
if (doc.frames[i].name == strName)
return doc.frames[i];
else {
var frm = findFrame(doc.frames[i].window, strName);
if ( frm )
return frm;
}
return top;
}
function performAction_not_used(urlParams){
var frm = findFrameByName('body');
document.body.style.cursor = "wait";
frm.document.body.style.cursor = "wait";
frm.document.location = "search?"+urlParams + "<%= callerParams %>";
}
function formSearchAction(urlParams){
var frm = findFrameByName('body');
document.body.style.cursor = "wait";
frm.document.body.style.cursor = "wait";
frm.document.location = "/CDEBrowser/formSearchAction.do?method=getAllFormsForTreeNode&"+urlParams;
}
function formDetailsAction(urlParams){
top.document.location = "/CDEBrowser/formDetailsAction.do?method=getFormDetails&"+urlParams;
}
|
import { shallowMount } from '@vue/test-utils'
import TagSortDropdown from '@/components/Dashboard/Sidebar/TagSortDropdown'
const $bus = {
$emit: jest.fn((e, data) => data)
}
describe('Tag Sort Dropdown', () => {
it('shows if visibility is true', () => {
const wrapper = shallowMount(TagSortDropdown, {
propsData: {
visible: true
},
mocks: { $bus }
})
expect(wrapper.find('.tag-sort-dropdown').isVisible()).toBe(true)
})
it('is hidden if visibility is false', () => {
const wrapper = shallowMount(TagSortDropdown, {
propsData: {
visible: false
},
mocks: { $bus }
})
expect(wrapper.find('.tag-sort-dropdown').isVisible()).toBe(false)
})
it('emits an event when a sort method is clicked', () => {
const wrapper = shallowMount(TagSortDropdown, {
propsData: {
visible: false
},
mocks: { $bus }
})
const busSpy = jest.spyOn(wrapper.vm.$bus, '$emit')
wrapper.findAll('.tag-sort-item').wrappers.forEach(item => {
item.trigger('click')
})
expect(busSpy).toHaveBeenCalledWith('TAGS_SORTED', 'ALPHA_ASC')
expect(busSpy).toHaveBeenCalledWith('TAGS_SORTED', 'ALPHA_DESC')
expect(busSpy).toHaveBeenCalledWith('TAGS_SORTED', 'STARS_DESC')
expect(busSpy).toHaveBeenCalledWith('TAGS_SORTED', 'STARS_ASC')
})
})
|
var WebSocket = require('ws');
function Connection(serverWebSocket) {
this.serverSocket = serverWebSocket;
this.clientSocket = null;
}
Connection.prototype.init = function () {
connection = this;
connection.clientSocket = new WebSocket('ws://localhost:4848/app/TestInterface');
connection.clientSocket.onerror = function (ev) {
console.log('connection.clientSocket.onerror %s',ev);
connection.clientSocket = null;
};
connection.clientSocket.onclose = function () {
console.log('connection.clientSocket.onclose');
connection.clientSocket = null;
};
connection.clientSocket.onmessage = function (ev) {
connection.serverSocket.send(ev.data);
console.log('<< %s', ev.data);
};
connection.clientSocket.onopen = function () {
connection.serverSocket.send('{"id":-1, "message":"Connection opened"}');
};
connection.serverSocket.on('message', function(message) {
console.log('>> %s', message);
connection.clientSocket.send(message)
});
connection.serverSocket.on('close',function (code) {
console.log('Closing connection with code: %s', code);
});
};
var WebSocketServer = WebSocket.Server
, wss = new WebSocketServer({port: 8001});
wss.on('connection', function(ws) {
var conn = new Connection(ws);
conn.init();
});
|
/* @flow */
import React from "react";
import { typesetMath } from "mathjax-electron";
type Props = {
children?: React$Node
};
function isMathJaxOkYet(): boolean {
const MathJax: global = window ? window.MathJax : null;
return (
!window.disableMathJax &&
typeof MathJax !== "undefined" &&
window.MathJax &&
window.MathJax.Hub.Queue
);
}
export default class LatexRenderer extends React.Component<Props> {
rendered: ?HTMLElement;
componentDidMount(): void {
if (window && isMathJaxOkYet()) typesetMath(this.rendered);
}
componentDidUpdate(): void {
if (isMathJaxOkYet()) typesetMath(this.rendered);
}
render(): ?React$Element<any> {
return (
<div
ref={rendered => {
this.rendered = rendered;
}}
>
{this.props.children}
</div>
);
}
}
|
/**
* Normalizes a representation of a float to a {float}.
*
* @function float
* @param {(string|float)} x - The original values_
* @param {Object} fallback - If not a {float} or {string}, return this value.
* @return {float} The value as a {float} object.
* @memberof geodash.normalize
*
* @example
* var x = "1.0";
* var y = geodash.normalize.float(x);
* y == 1.0
*/
module.exports = function(x, fallback)
{
if(geodash.util.isNumber(x))
{
return x;
}
else if(geodash.util.isString(x))
{
if(x.length > 0)
{
return parseFloat(x);
}
else
{
return fallback;
}
}
else
{
return fallback;
}
};
|
const parser = require("../main");
describe("Array without keys", () => {
it("deference array", () => {
expect(
parser.parseEval(
["$a = [", '"a", "b"', "]($foo)[$foo->bar()[1]]->foo()"].join("\r")
)
).toMatchSnapshot();
});
it("of strings", () => {
expect(
parser.parseEval('array("item1", "item2", "item3")')
).toMatchSnapshot();
});
it("of numbers", () => {
expect(parser.parseEval("array(1, 2.5, 0x1000)")).toMatchSnapshot();
});
it("of strings and numbers", () => {
expect(parser.parseEval('array(1, "item2", 3, "item4")')).toMatchSnapshot();
});
it("of variables", () => {
expect(parser.parseEval("array($obj1, $obj2, $obj3)")).toMatchSnapshot();
});
it("of objects", () => {
expect(
parser.parseEval("[new foo(), new stdClass(), new bar()]")
).toMatchSnapshot();
});
it("of arrays", () => {
expect(
parser.parseEval(`
array(
array("item1", "item2"),
array("item3", "item4"),
array("item5", "item6")
)`)
).toMatchSnapshot();
});
describe("mixed tests / coverage", function () {
it("test empty array", function () {
expect(parser.parseEval("$a = []; $b = array();")).toMatchSnapshot();
});
it("test short form / keys", function () {
expect(
parser.parseEval('[0 => &$foo, $bar => "foobar"];')
).toMatchSnapshot();
});
});
it("single and empty", () => {
expect(parser.parseEval("array()")).toMatchSnapshot();
});
it("single and empty (short form)", () => {
expect(parser.parseEval("[]")).toMatchSnapshot();
});
it("array without trailing commas", () => {
expect(parser.parseEval("['foo', 'bar']")).toMatchSnapshot();
});
it("array without trailing commas #2", () => {
expect(parser.parseEval("['foo', 'bar']")).toMatchSnapshot();
});
it("array with trailing commas #3", () => {
expect(parser.parseEval("['foo', 'bar',]")).toMatchSnapshot();
});
it("array with trailing commas #4", () => {
expect(parser.parseEval("['foo', 'bar' ,]")).toMatchSnapshot();
});
it("array with trailing commas #5", () => {
expect(parser.parseEval("['foo', 'bar' , ]")).toMatchSnapshot();
});
it("array with multiple trailing commas", () => {
expect(parser.parseEval("['foo', 'bar',,]")).toMatchSnapshot();
});
it("array with multiple trailing commas #2", () => {
expect(parser.parseEval("['foo', 'bar',,,,,]")).toMatchSnapshot();
});
it("array with empty values", () => {
expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz']")).toMatchSnapshot();
});
it("array with empty values #2", () => {
expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz',]")).toMatchSnapshot();
});
it("array with empty values #3", () => {
expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz',,]")).toMatchSnapshot();
});
it("non empty array", () => {
expect(
parser.parseEval(
"$var = [true, 1, 1.1, 'test', \"test\", [1, 2, 3], new Foo(), call(), null];"
)
).toMatchSnapshot();
});
it("spread operator", () => {
expect(
parser.parseEval(`
$var = ['banana', 'orange', ...$parts, 'watermelon'];
$var = [...$arr1];
$var = [0, ...$arr1];
$var = array(...$arr1, ...$arr2, 111);
$var = [...$arr1, ...$arr1];
$var = [...getArr(), 'c'];
$var = [...new ArrayIterator(['a', 'b', 'c'])];
`)
).toMatchSnapshot();
});
it("spread operator with reference", function () {
const astErr = parser.parseEval(`$var = [...&$arr];`, {
parser: {
suppressErrors: true,
},
});
expect(astErr).toMatchSnapshot();
});
it("byRef", () => {
expect(
parser.parseEval(`
$var = [1, 'test', &$var, 'test' => &$var];
`)
).toMatchSnapshot();
});
});
|
var Jsonix = require('jsonix').Jsonix;
var fs = require('fs');
var XLink_1_0 = require('w3c-schemas').XLink_1_0;
var OWS_1_1_0 = require('ogc-schemas').OWS_1_1_0;
var GML_3_1_1 = require('ogc-schemas').GML_3_1_1;
var SMIL_2_0 = require('ogc-schemas').SMIL_2_0;
var SMIL_2_0_Language = require('ogc-schemas').SMIL_2_0_Language;
var WMTS_1_0 = require('ogc-schemas').WMTS_1_0;
var context = new Jsonix.Context([XLink_1_0, OWS_1_1_0, GML_3_1_1, SMIL_2_0, SMIL_2_0_Language, WMTS_1_0], {
namespacePrefixes : {
'http://www.w3.org/1999/xlink': 'xlink',
'http://www.opengis.net/wmts/1.0' : '',
'http://www.opengis.net/ows/1.1' :'ows'
}
});
var unmarshaller = context.createUnmarshaller();
var sourceStr = fs.readFileSync('./source.xml').toString();
var doc = unmarshaller.unmarshalString(sourceStr);
console.log(JSON.stringify(doc, null, 2));
var marshaller = context.createMarshaller();
var outStr = marshaller.marshalString(doc);
console.log(outStr);
if (outStr.indexOf('<Value') !== -1) {
console.error('### Broken document!');
} else {
console.error('### Document seems fine...');
}
|
/**
* @project : modula
* @package : core
* @internal : declareFunctionSupport
* @type : function
* @dependencies : none
*
* @description :
* the support is used to build crossbrowser compatible modula.js functions.
*
* @example
* support.test = support( function() { return true; } ); // result support.test = true
* support.test = support( function() { return false; } ); // result support.test = false
*/
/**
* Support
*/
var
support = _(
true ,
[ 'support' ] ,
function( fn ) {
// create div element
var div = doc.createElement( 'div' );
// try to ...
try {
// execute fn with the created div
return !!fn( div );
// catch if error occured ...
} catch( e ) {
// and return false
return false;
// finally ...
} finally {
// remove div if added to the document
div.parentNode && div.parentNode.removeChild( div );
// delete div for memory release
div = null;
};
} );
|
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/
import type {Path} from 'types/Config';
const path = require('path');
const childProcess = require('child_process');
const env = Object.assign({}, process.env, {
HGPLAIN: 1,
});
type Options = {|
lastCommit?: boolean,
withAncestor?: boolean,
|};
function findChangedFiles(cwd: string, options: Options): Promise<Array<Path>> {
return new Promise((resolve, reject) => {
let args = ['status', '-amn'];
if (options && options.withAncestor) {
args.push('--rev', 'ancestor(.^)');
} else if (options && options.lastCommit === true) {
args = ['tip', '--template', '{files%"{file}\n"}'];
}
const child = childProcess.spawn('hg', args, {cwd, env});
let stdout = '';
let stderr = '';
child.stdout.on('data', data => (stdout += data));
child.stderr.on('data', data => (stderr += data));
child.on('error', e => reject(e));
child.on('close', code => {
if (code === 0) {
stdout = stdout.trim();
if (stdout === '') {
resolve([]);
} else {
resolve(
stdout
.split('\n')
.map(changedPath => path.resolve(cwd, changedPath)),
);
}
} else {
reject(code + ': ' + stderr);
}
});
});
}
function isHGRepository(cwd: string): Promise<?string> {
return new Promise(resolve => {
try {
let stdout = '';
const child = childProcess.spawn('hg', ['root'], {cwd, env});
child.stdout.on('data', data => (stdout += data));
child.on('error', () => resolve(null));
child.on('close', code => resolve(code === 0 ? stdout.trim() : null));
} catch (e) {
resolve(null);
}
});
}
module.exports = {
findChangedFiles,
isHGRepository,
};
|
fromStreams(['createdItems', 'updatedItems']).when({
itemCreated: function (s,e) {
linkEvent(e,'createdItems-');
},
itemUpdated: function (s,e) {
linkEvent(e,'updatedItems-');
}
});
function linkEvent(e, streamPrefix)
{
var emailparts = e.body.user.split('@');
if(emailparts.length == 2)
{
linko(streamPrefix + emailparts[1],e);
}
}
|
module.exports = {
selector: 'img[alt="chairlift icon"]',
parse: {
name: '../1',
status: {
child: '../../2',
attribute: 'class',
fn: s => s.slice(5)
}
}
};
|
export class CodeBlock {
constructor (codeBlockWriter) {
this.codeBlockWriter = codeBlockWriter;
}
nop (repeat = 1) { this.codeBlockWriter.nop(repeat); }
jp () {}
}
export class CodeBlockWriter {
}
export class CodeBlockAssembler extends CodeBlockWriter {
}
export class CodeBlockExecuter extends CodeBlockWriter {
}
|
(function ($) {
"use strict";
window.savedBreakpoint = 'base';
var methods = {
bodyFontSize: function () {
if (!$.fn.whim.settings.body) {
$.fn.whim.settings.body = $('body');
}
return parseInt($.fn.whim.settings.body.css('font-size'), 10);
},
virtualPx: function () {
return Response.viewportW() / this.whim('bodyFontSize') * $.fn.whim.settings.baseFontSize;
},
actualPx: function (virtual) {
return virtual / $.fn.whim.settings.baseFontSize * this.whim('bodyFontSize');
},
currentBreakpoint : function () {
var breakpoint = null,
breakPoints = $(window).data('breakpoints').x,
breakPointsLabels = [],
labels = $(window).data('breakpoints').labels,
i = 0;
$(breakPoints).each(function () {
breakPointsLabels[i] = [this, labels[i]];
i = i + 1;
});
// makes operation more effiecient cos we stop as soon as it's true
breakPointsLabels.reverse();
for (i = 0; i < $(breakPointsLabels).length; i = i + 1) {
if (Response.band(breakPointsLabels[i][0])) {
breakpoint = breakPointsLabels[i][1];
break;
}
}
return breakpoint;
},
trigger: function (breakpoint) {
if (breakpoint === this.whim('currentBreakpoint')) {
return false;
}
window.savedBreakpoint = this.whim('currentBreakpoint');
return window.savedBreakpoint;
}
};
$.fn.whim = function (method) {
var returnData;
if (methods[method]) {
returnData = methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
returnData = methods.init.apply(this, arguments);
} else {
returnData = $.error('Method ' + method + ' does not exist on jQuery.whim');
}
return returnData;
};
$.fn.whim.settings = {
baseFontSize: 16,
body: null
};
})(jQuery);
|
const router = require('koa-router')()
const models = require('../models')
router
.get('/notifications/:id', async (ctx) => {
ctx.body = await models.db.notification.findById(
ctx.params.id,
{
include: [
{
model: models.db.participant, attributes: ['id', 'fbid']
}
],
order: [['message_date', 'DESC'], ['priority', 'DESC']]
})
})
.post('/notifications', async (ctx) => {
let message = ctx.request.body.message
let messageDate = ctx.request.body.message_date
let expiryDate = ctx.request.body.expiry_date
let priority = ctx.request.body.priority
let eventId = ctx.request.body.event_id
if (!messageDate) {
messageDate = Date.now()
}
if (!eventId) {
eventId = 0
}
// Verify message with same date and eventId are not used to comply with uniqueness constraints
let notification = await models.db.notification.findOne(
{where:
{[models.db.sequelize.Op.and]:
[ {message},
{message_date: messageDate},
{event_id: eventId}
]
}
})
if (notification) {
ctx.status = 409
ctx.body = {'error': {
'code': 409,
'message': 'this notification message for message_date already exists'
}}
} else {
await models.db.notification
.findOrCreate({where: {
message: message,
message_date: messageDate,
expiry_date: expiryDate,
priority: priority,
event_id: eventId
}})
.spread(function (event, created) {
if (created) {
ctx.status = 201
ctx.body = event
} else {
ctx.status = 409
ctx.body = {'error': {
'code': 409,
'message': 'this notification message for message_date already exists'
}}
}
})
}
})
.patch('/notifications/:id', async (ctx) => {
let notificationId = ctx.params.id
let message = ctx.request.body.message
let messageDate = ctx.request.body.message_date
let currentNotification = await models.db.notification.findByPk(notificationId)
if (!currentNotification) {
ctx.status = 400
ctx.body = {'error': {
'code': 400,
'message': 'Not found'
}}
}
// ensure that patch won't create duplicates
var updateable = true
var notification
if (message !== '' && messageDate !== '') {
notification = await models.db.notification.findOne(
{where: {
[models.db.sequelize.Op.and]: [
{message: message},
{message_date: messageDate}
]
}
})
if (notification) {
if (notification.id !== currentNotification.id) {
updateable = false
}
}
} else if (message !== '') {
notification = await models.db.notification.findOne(
{where: {message: message}})
if (notification) {
if (notification.id !== currentNotification.id &&
notification.message_date === currentNotification.message_date) {
ctx.status = 400
ctx.body = {'error': {
'code': 400,
'message': 'Validation error'
}}
}
}
} else if (messageDate !== '') {
notification = await models.db.notification.findOne(
{where: {message_date: messageDate}})
if (notification) {
if (notification.id !== currentNotification.id &&
notification.message === currentNotification.message) {
updateable = false
}
}
}
if (updateable) {
await models.db.notification.update(
ctx.request.body, {
where: {id: notificationId}
})
.then(result => {
let status = result.every((r) => r)
ctx.status = status ? 200 : 400
ctx.body = result
})
.catch(err => {
ctx.status = 400
ctx.body = {'error': {
'code': 400,
'message': err.message
}}
})
} else {
ctx.status = 400
ctx.body = {'error': {
'code': 400,
'message': 'Validation error'
}}
}
})
.del('/notifications/:id', async (ctx) => {
await models.db.notification.destroy({
where: {id: ctx.params.id}
})
.then(result => {
ctx.status = result ? 204 : 400
ctx.body = result
})
})
module.exports = router
|
/**
* @license
* Copyright (c) 2017 Google Inc. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* Code distributed by Google as part of this project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
import { StrategizerWalker, Strategy } from '../strategizer.js';
export class NameUnnamedConnections extends Strategy {
async generate(inputParams) {
return StrategizerWalker.over(this.getResults(inputParams), new class extends StrategizerWalker {
onHandleConnection(recipe, handleConnection) {
if (handleConnection.name) {
// it is already named.
return;
}
if (!handleConnection.particle.spec) {
// the particle doesn't have spec yet.
return;
}
const possibleSpecConns = handleConnection.findSpecsForUnnamedHandles();
return possibleSpecConns.map(specConn => {
return (recipe, handleConnection) => {
handleConnection.particle.nameConnection(handleConnection, specConn.name);
return 1;
};
});
}
}(StrategizerWalker.Permuted), this);
}
}
//# sourceMappingURL=name-unnamed-connections.js.map
|
(function($, Backbone, _) {
"use strict";
var name_prefix = '{{ name }}'
, catalogKey = '{{ catalog_key }}'
// The Module
// --------------
var Module = BBNS.Module.extend({
name: "StatisticApplication"
, preinitialize: function(options){
var uses = [
catalogKey
, 'StatisticView'
]
this.uses = _.union(this.uses, uses)
}
, initialize: function(options){
// catalog app
var catalogApp = BBNS.app.modules[catalogKey]
// set collection
, CatalogItems = this.collections.CatalogItems = catalogApp.collections[catalogKey + '_CatalogItems']
// Create main module view **AppView**
var AppView = BBNS.app.modules['StatisticView'].views['StatisticView'].extend({
template: '#' + name_prefix + '-app-template'
})
this.views.app = new AppView({
collection: CatalogItems
, el: $(".js-" + name_prefix + "-" + catalogKey + "-app")
}).render()
}
})
// Finally, we kick things off by creating the **Module**.
var App = new Module({
name: name_prefix + "_" + catalogKey
})
})(jQuery, Backbone, _);
|
import React from 'react'
import Reflux from 'reflux'
import { Link } from 'react-router'
import auth from '../utils/auth'
var AssetStore = require('../stores/AssetStore');
import BreadCrumb from './BreadCrumb'
export default React.createClass({
mixins: [Reflux.listenTo(AssetStore, "update")],
getInitialState: function() {
return {
assets: AssetStore.getAssets(),
loading: true
};
},
componentDidMount: function() {
this.listenTo(AssetStore, this.update);
},
update: function (assets) {
if (!this.isMounted()) {
return;
}
this.setState({
assets: assets,
loading: false
});
},
render: function() {
var token = auth.getToken();
//console.log(this.state.assets);
var assets = this.state.assets.map(function(asset, i) {
//return <li key={asset.id}><Link to="asset" params={asset}>{asset.subname}</Link></li>;
return <ListAsset key={i} asset={asset} />;
});
return (
<div className="container-fluid">
<BreadCrumb routes={this.props.routes}/>
<div className="row">
<div className="col-xs-4 scrollable">
<ul>
{assets}
</ul>
</div>
<div className="col-xs-8 full-calendar">
{this.props.children}
</div>
</div>
</div>
);
}
});
export const ListAsset = React.createClass({
render: function() {
return (
<li className="row one-list-asset" id="msg-one">
<Link to="asset" params={this.props.asset}>
<div className="col-xs-1 checkbox">
<label>
<input type="checkbox" />
<i className="fa fa-square-o small"></i>
</label>
</div>
<div className="col-xs-9 message-title">{this.props.asset.subname}</div>
<div className="col-xs-2 message-date">12/31/13</div>
</Link>
</li>
);
}
});
|
/*
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function(document) {
'use strict';
// Grab a reference to our auto-binding template
// and give it some initial binding values
// Learn more about auto-binding templates at http://goo.gl/Dx1u2g
var app = document.querySelector('#app');
// Sets app default base URL
app.baseUrl = '/';
if (window.location.port === '') { // if production
// Uncomment app.baseURL below and
// set app.baseURL to '/your-pathname/' if running from folder in production
// app.baseUrl = '/polymer-starter-kit/';
}
app.displayInstalledToast = function() {
// Check to make sure caching is actually enabled—it won't be in the dev environment.
if (!Polymer.dom(document).querySelector('platinum-sw-cache').disabled) {
Polymer.dom(document).querySelector('#caching-complete').show();
}
};
// Listen for template bound event to know when bindings
// have resolved and content has been stamped to the page
app.addEventListener('dom-change', function() {
console.log('Our app is ready to rock!');
});
// See https://github.com/Polymer/polymer/issues/1381
window.addEventListener('WebComponentsReady', function() {
var setting = document.querySelector('#setting');
if (setting){
// setting.set('globals.baseUrl', 'http://192.168.35.96:8001/rest');
setting.set('globals.baseUrl', 'http://factory.hatiolab.com:8001/rest');
}
});
// Main area's paper-scroll-header-panel custom condensing transformation of
// the appName in the middle-container and the bottom title in the bottom-container.
// The appName is moved to top and shrunk on condensing. The bottom sub title
// is shrunk to nothing on condensing.
window.addEventListener('paper-header-transform', function(e) {
var appName = Polymer.dom(document).querySelector('#mainToolbar .app-name');
var middleContainer = Polymer.dom(document).querySelector('#mainToolbar .middle-container');
var bottomContainer = Polymer.dom(document).querySelector('#mainToolbar .bottom-container');
var detail = e.detail;
var heightDiff = detail.height - detail.condensedHeight;
var yRatio = Math.min(1, detail.y / heightDiff);
// appName max size when condensed. The smaller the number the smaller the condensed size.
var maxMiddleScale = 0.50;
var auxHeight = heightDiff - detail.y;
var auxScale = heightDiff / (1 - maxMiddleScale);
var scaleMiddle = Math.max(maxMiddleScale, auxHeight / auxScale + maxMiddleScale);
var scaleBottom = 1 - yRatio;
// Move/translate middleContainer
Polymer.Base.transform('translate3d(0,' + yRatio * 100 + '%,0)', middleContainer);
// Scale bottomContainer and bottom sub title to nothing and back
Polymer.Base.transform('scale(' + scaleBottom + ') translateZ(0)', bottomContainer);
// Scale middleContainer appName
Polymer.Base.transform('scale(' + scaleMiddle + ') translateZ(0)', appName);
});
function startScan() {
var unitHome = app.$["new-unit-home"];
page("/unit-list");
cordova.plugins.barcodeScanner.scan(
function (result) {
var prefix = result.text.split('/');
if(prefix.length > 1) {
this.sendAjax(prefix[1], prefix[2], result.text);
} else {
unitHome.open();
}
},
function (error) {
alert("Scanning failed: " + error);
}
);
}
function sendAjax(page, unitId, path) {
var unitHome = this.$["new-unit-home"];
var myRequest = new XMLHttpRequest();
myRequest.onreadystatechange = function(){
if(myRequest.readyState == 4 && (myRequest.status == 200 || myRequest.status == 201)){
var res = myRequest.responseText;
if(res == null) {
unitHome.open();
} else {
location.href="/" + path;
// document.querySelector("coffer-app").route.path = path;
// document.querySelector("coffer-app").page = page;
}
}
};
var setting = document.querySelector('#setting');
myRequest.withCredentials = true;
myRequest.open('get', setting.get('globals.baseUrl') + '/units/' + unitId,true);
myRequest.send(null);
}
})(document);
|
/* Reload the aframe dynamically, as needed
*/
$(function(){
var x = "";
var debuging = {};
var gui;
// We describe specific elements using the path from the a-scene,
// as a list of children #'s, from top to bottom.
// This returns a jquery selector
function sceneElementSelector(o) {
console.log("sceneElementSelector",o)
if (o == "") { return "a-scene"; }
return "a-scene > " + o.split(".").map(function(v) {
return ":nth-child(" + v + ")"
}).join(" > ");
}
// This returns a textual descriptor
function sceneElementDescription(o) {
if (o == "") { return ""; }
var r = o.split(".").map(function(v) {
var i = (v < 10?" ":"") + v;
return i;
}).join(" . ") + " -";
var j = $(sceneElementSelector(o));
if (j.prop("tagName")) {
r += " " + j.prop("tagName");
}
if (j.attr("id")) {
r += " #" + j.attr("id")
}
return r
}
function sceneElements() {
console.log("sceneElements")
var r = []
function rec(o) {
var ch = $(sceneElementSelector(o)).children();
for(var i = 0;i < ch.length;i++) {
var p = (o == "")?(o + (i+1)):(o + "." + (i+1))
if ($(sceneElementSelector(p)).prop("tagName").substring(0,2) == "A-") {
r.push(p)
rec(p)
}
}
}
rec("")
return r
}
gui = new dat.GUI();
dat.GUI.prototype.removeFolder = function(name) {
var folder = this.__folders[name];
if (!folder) {
return;
}
folder.close();
this.__ul.removeChild(folder.domElement.parentNode);
delete this.__folders[name];
this.onResize();
}
console.log("Here");
debug = {}
var url = window.location
var defaults =
{ position: new THREE.Vector3( 0, 0, 0 )
, rotation: new THREE.Vector3( 0, 0, 0 )
, scale: new THREE.Vector3( 1, 1, 1 )
, visible: true
};
var steps =
{ position: 0.025
, rotation: 1
, scale: 0.1
};
active = { entity: "1"
, position: defaults.position.clone()
, rotation: defaults.rotation.clone()
, scale: defaults.scale.clone()
, visible: defaults.visible
}
// Insert a marker. Above the marker is HTML we have inserted, and below the marker is auto-generated.
// $("a-scene").prepend("<div aframe-marker></div>");
var reloadGUI = function() {
// We already have a gui object
var changeEntity = function(value) {
console.log("reloadGUI.entity",value)
active.entity = value;
$("[active-entity]").removeAttr("active-entity")
var me = $(sceneElementSelector(value));
me.attr("active-entity","true")
function fillAttr(attr) {
var a = me[0].getAttribute(attr)
if (a == null) {
a = defaults[attr]
}
for (var i in active[attr]) {
active[attr][i] = a[i]
}
}
fillAttr("position")
fillAttr("rotation")
fillAttr("scale")
};
var se = sceneElements()
var entityDict = {}
se.map(function(v) {
entityDict[sceneElementDescription(v)] = v
});
active.entity = "1"
changeEntity(se[0])
var changePosition = function(value) {
var me = $(sceneElementSelector(active.entity));
me[0].setAttribute("position",active.position)
me[0].setAttribute("rotation",active.rotation)
me[0].setAttribute("scale",active.scale)
me[0].setAttribute("visible",active.visible)
}
// Clear the inspector
reloadGUI.entity && gui.remove(reloadGUI.entity)
for (var i in defaults) {
// TODO: if/then/else
if (typeof(defaults[i]) == "boolean") {
reloadGUI[i] && gui.remove(reloadGUI[i])
} else {
gui.removeFolder(i)
}
}
// And refill it
reloadGUI.entity = gui.add(active, 'entity', entityDict );
reloadGUI.entity.onChange(changeEntity);
for (var i in defaults) {
if (typeof(defaults[i]) == "boolean") {
reloadGUI[i] = gui.add(active,i).listen().onChange(changePosition);
} else {
var folder = gui.addFolder(i)
var xyz = ['x','y','z'] // TODO: look this up from a table.
for(var j in xyz) {
console.log(i,j,active[i])
folder.add(active[i],xyz[j]).step(steps[i]).listen().onChange(changePosition);
}
}
}
}
// boostrap
reloadGUI()
});
|
// @flow
'use strict';
import React from 'react';
import Relay from 'react-relay';
import {createContainer} from 'recompose-relay';
import {compose} from 'recompose';
const NodeId = compose(
createContainer(
{
fragments: {
viewer: () => Relay.QL`
fragment on ExpandedNodeId {
identifierType
value
namespace
}
`
}
}
)
)(({viewer})=>
<span>
{viewer.namespace}
{viewer.identifierType}
{viewer.value}
</span>
);
export default NodeId;
|
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var Length = require('./Length');
var Point = require('../point/Point');
/**
* Get a number of points along a line's length.
*
* Provide a `quantity` to get an exact number of points along the line.
*
* Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when
* providing a `stepRate`.
*
* @function Phaser.Geom.Line.GetPoints
* @since 3.0.0
*
* @generic {Phaser.Geom.Point[]} O - [out,$return]
*
* @param {Phaser.Geom.Line} line - The line.
* @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead.
* @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`.
* @param {(array|Phaser.Geom.Point[])} [out] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line.
*
* @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line.
*/
var GetPoints = function (line, quantity, stepRate, out)
{
if (out === undefined) { out = []; }
// If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead.
if (!quantity)
{
quantity = Length(line) / stepRate;
}
var x1 = line.x1;
var y1 = line.y1;
var x2 = line.x2;
var y2 = line.y2;
for (var i = 0; i < quantity; i++)
{
var position = i / quantity;
var x = x1 + (x2 - x1) * position;
var y = y1 + (y2 - y1) * position;
out.push(new Point(x, y));
}
return out;
};
module.exports = GetPoints;
|
/**
*
* AttributeOption
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Box } from '@strapi/design-system/Box';
import { Flex } from '@strapi/design-system/Flex';
import { Typography } from '@strapi/design-system/Typography';
import useFormModalNavigation from '../../../hooks/useFormModalNavigation';
import getTrad from '../../../utils/getTrad';
import AttributeIcon from '../../AttributeIcon';
import BoxWrapper from './BoxWrapper';
const AttributeOption = ({ type }) => {
const { formatMessage } = useIntl();
const { onClickSelectField } = useFormModalNavigation();
const handleClick = () => {
const step = type === 'component' ? '1' : null;
onClickSelectField({
attributeType: type,
step,
});
};
return (
<BoxWrapper padding={4} as="button" hasRadius type="button" onClick={handleClick}>
<Flex>
<AttributeIcon type={type} />
<Box paddingLeft={4}>
<Flex>
<Typography fontWeight="bold">
{formatMessage({ id: getTrad(`attribute.${type}`), defaultMessage: type })}
</Typography>
</Flex>
<Flex>
<Typography variant="pi" textColor="neutral600">
{formatMessage({ id: getTrad(`attribute.${type}.description`) })}
</Typography>
</Flex>
</Box>
</Flex>
</BoxWrapper>
);
};
AttributeOption.defaultProps = {
type: 'text',
};
AttributeOption.propTypes = {
type: PropTypes.string,
};
export default AttributeOption;
|
export default function makeInterval (begin, end, type) {
return { begin, end, type };
}
|
var chai = require("chai"),
sinon = require("sinon"),
sinonChai = require("sinon-chai"),
expect = chai.expect;
var async = require('async'),
_ = require('lodash');
chai.use(sinonChai);
/**************************************************************************
* Begin of tests
*************************************************************************/
var app = require('../../../app');
var multisetPlugin = require('./multiset');
var mongoose = require('mongoose');
describe('Mongoose.Plugin.multiset', function(){
var schema, Model;
before(function(){
schema = new mongoose.Schema({
name : {
type : String,
default: 'nothing'
},
data : {
first : {type: String},
sub : {}
},
__v: {type: Number, default: 199},
updatedAt : {type: String},
createdAt : {type: String}
});
multisetPlugin(schema);
Model = mongoose.model('TestMultiSetPlugin', schema);
});
describe('#multiSetPlugin()', function(){
before(function(done){
if ('testmultisetplugins' in mongoose.connection.collections) {
mongoose.connection.collections['testmultisetplugins'].drop(function(err){
if (err && err.errmsg == 'ns not found') {
return done();
}
done(err);
});
} else {
done();
}
});
it('should be a function', function(){
expect(multisetPlugin).to.be.a('function');
});
describe('adds multiSet functionality to schemas', function(done){
afterEach(function(done){
Model.remove({}, done);
});
it('injects a document#multiSet() method', function(){
var doc = new Model({});
expect(doc.multiSet).to.be.a('function');
});
it('allows to set multiple values at once', function() {
var doc = new Model({name: 'test', data: {first: 'test'}});
expect(doc).to.have.a.deep.property('name', 'test');
expect(doc).to.have.a.deep.property('data.first', 'test');
expect(doc).to.have.a.deep.property('__v', 199);
doc.multiSet({name: 'test2', data: {sub: { test: 1}}});
expect(doc).to.have.a.deep.property('name', 'test2');
expect(doc).to.have.a.deep.property('data.first', 'test'); // not overwritten
expect(doc).to.have.a.deep.property('data.sub.test', 1);
expect(doc).to.have.a.deep.property('__v', 199);
})
it('prevents modification of id, _id, __v, createdAt and updatedAt', function() {
var doc = new Model({name: 'test', createdAt: 'justnow', updatedAt:'justnow'});
var currentId = doc._id.toString();
doc.multiSet({
name: 'changed',
id: '537b03bb4c3c4eb17ec61724',
_id: '537b03bb4c3c4eb17ec61724',
__v: 1,
createdAt: 'now',
updatedAt:'now'
});
expect(doc).to.have.a.deep.property('name', 'changed');
expect(doc._id.toString()).to.equal(currentId);
expect(doc).to.have.a.deep.property('__v', 199);
expect(doc).to.have.a.deep.property('createdAt', 'justnow');
expect(doc).to.have.a.deep.property('updatedAt', 'justnow');
});
});
});
});
|
module.exports = function (config) {
var configuration = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'node_modules/jquery/dist/jquery.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'node_modules/jasmine2-custom-message/jasmine2-custom-message.js',
{ pattern: 'Tests/*.html', included: true },
{ pattern: 'Tests/*.js', included: true },
'Scripts/moment.min.js',
'Scripts/bootstrap-sortable.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha'],
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
};
config.set(configuration);
}
|
define([], function() {
return {
errorMessage: "Error on loading Organization Chart",
"PropertyPaneDescription": "Modern Organization Chart, With Presence",
"BasicGroupName": "Properties",
"DescriptionFieldLabel": "Title",
}
});
|
export default function (m, v) {
m[3] = v[0];
m[4] = v[1];
m[5] = v[2];
return m;
}
|
// Flags: --expose-http2
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');
const server = http2.createServer();
server.on('stream', common.mustNotCall());
const count = 32;
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
let remaining = count + 1;
function maybeClose() {
if (--remaining === 0) {
server.close();
client.destroy();
}
}
// nghttp2 will catch the bad header value for us.
function doTest(i) {
const req = client.request({ ':path': `bad${String.fromCharCode(i)}path` });
req.on('error', common.expectsError({
code: 'ERR_HTTP2_STREAM_ERROR',
type: Error,
message: 'Stream closed with error code 1'
}));
req.on('streamClosed', common.mustCall(maybeClose));
}
for (let i = 0; i <= count; i += 1)
doTest(i);
}));
|
angular.module("umbraco").controller("SendTestEmailController.Controller", function ($scope, assetsService, $http, $routeParams, notificationsService) {
$scope.loading = false;
$scope.init = function () {
if ($scope.model.value == null || $scope.model.value == "") {
// Set default if nothing was set yet
$scope.model.value = {
recipients: [{}],
tags: [{}],
}
} else if ($scope.model.value.constructor.name === 'Array') {
// For old versions, $scope.model.value was the array of tags.
// We have made $scope.model.value into an object, with a key 'tags', among others.
// If we see an old model.value (an Array), transform it into the new format
var tags = $scope.model.value;
$scope.model.value = {
recipients: [{}],
tags: tags,
};
}
};
$scope.sendTestEmail = function () {
$scope.loading = true;
if ($scope.model.value.recipient != "") {
$http.post("/base/PerplexMail/SendTestMail?id=" + $routeParams.id, { EmailAddresses: _.pluck($scope.model.value.recipients, 'value'), EmailNodeId: $routeParams.id, Tags: $scope.model.value.tags })
.then(function (response) {
// Notify the user
notificationsService.add({ type: (response.data.Success ? "success" : "error"), headline: response.data.Message });
$scope.loading = false;
}), function (err) {
//display the error
notificationsService.error(err.errorMsg);
$scope.loading = false;
};
}
}
$scope.addRecipient = function () {
$scope.model.value.recipients.push({});
}
$scope.removeRecipient = function (index) {
// Laatste element gaan we niet verwijderen, maar leegmaken
if ($scope.model.value.recipients.length === 1) {
$scope.model.value.recipients = [{}];
} else {
$scope.model.value.recipients.splice(index, 1);
}
}
$scope.addTag = function () {
// Add an empty value
$scope.model.value.tags.push({});
};
$scope.removeTag = function (index) {
// Laatste element gaan we niet verwijderen, maar leegmaken
if ($scope.model.value.tags.length === 1) {
$scope.model.value.tags = [{}];
} else {
$scope.model.value.tags.splice(index, 1);
}
};
});
|
/**
* GKA (generate keyframes animation)
* author: joeyguo
* HomePage: https://github.com/gkajs/gka-utils
*
* gka utils
*/
const css = require('./core/css');
const html = require('./core/html');
const data = require('./core/data');
const _ = require('./core/_');
module.exports = {
html,
css,
data,
_,
}
|
function classFactory() {
var _class, _foo, _bar;
return _foo = /*#__PURE__*/new WeakMap(), (_class = class Foo {
constructor() {
babelHelpers.classPrivateFieldInitSpec(this, _foo, {
writable: true,
value: "foo"
});
}
instance() {
return babelHelpers.classPrivateFieldGet(this, _foo);
}
static() {
return babelHelpers.classStaticPrivateFieldSpecGet(Foo, _class, _bar);
}
static instance(inst) {
return babelHelpers.classPrivateFieldGet(inst, _foo);
}
static static() {
return babelHelpers.classStaticPrivateFieldSpecGet(Foo, _class, _bar);
}
}, _bar = {
writable: true,
value: "bar"
}, _class);
}
|
/**
* The application header displayed at the top of the viewport
* @extends Ext.Component
*/
Ext.define('CF.view.Header', {
extend: 'Ext.Component',
dock: 'top',
baseCls: 'cf-header',
initComponent: function() {
Ext.applyIf(this, {
html: 'MVC simple application example called CF ' +
'(Cartography Framework)'
});
this.callParent(arguments);
}
});
|
'use strict'
var request = require('supertest')
, assert = require('assert')
, models = require('../models');
describe('makeUser', function() {
// 정상적인 유저 생성 확인
it('valid make user', function (done) {
var gameId = 1000;
var facebookId = 0;
var inventorySize = 100;
var maxHeart = 80;
var status = 1;
models.makeUser(gameId, facebookId, inventorySize, maxHeart, status)
.then(function (userId) {
assert(userId > 0);
}).then(done, done);
})
// 비정상적인 유저 생성 확인
it('invalid make user', function (done) {
models.makeUser()
.catch(function (err) {
assert(err);
}).then(done, done);
})
// 유저정보 로딩 확인
it('load user', function (done) {
var gameId = 1000;
var facebookId = 0;
var inventorySize = 100;
var maxHeart = 100;
var status = 1;
models.makeUser(gameId, facebookId, inventorySize, maxHeart, status)
.then(function (userId) {
assert(userId > 0);
models.loadUser(userId).then(function (results) {
assert(results);
}).then(done, done);
}).then(null, done);
})
})
|
var struct_tempest_1_1_abstract_list_delegate_1_1_list_item =
[
[ "ListItem", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a9c11b618acf99ff46e8d3b369e22bbe8", null ],
[ "emitClick", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a46adebd1adca8d23768023144cbbe32b", null ],
[ "clicked", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a7a67d04c648280bbdcb2fb8ea370a05b", null ],
[ "id", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a8d31d29e4a483ee3dfec2aa8324a8452", null ]
];
|
(function () {
angular
.module('kalendr.accounts', [
'kalendr.accounts.controllers',
'kalendr.accounts.services'
]);
angular
.module('kalendr.accounts.controllers', ['ngDialog']);
angular
.module('kalendr.accounts.services', []);
})();
|
/**
* @class Cogwheels.SassError
* @extends Error
*/
'use strict';
var util = require('util')
, indent = require('indent-string')
;
function SassError(properties) {
Error.call(this);
if (typeof properties === 'object') {
for (var key in properties) {
this[key] = properties[key];
}
} else if (typeof properties === 'string') {
this.message = properties;
}
if (!this.message) {
this.message = 'Sass Error';
}
}
module.exports = SassError;
util.inherits(SassError, Error);
SassError.prototype.status = 1;
SassError.prototype.line = 1;
SassError.prototype.column = 1;
SassError.prototype.code = undefined;
SassError.prototype.file = undefined;
var FULL_MESSAGE_FORMAT = '[SassError] in file `%s` on line %d column %d code %d:\n%s\n\n';
Object.defineProperty(SassError.prototype, 'full_message', {
get: function() {
return util.format(FULL_MESSAGE_FORMAT, this.file || '-', this.line, this.column, this.code || 3, indent(this.message, ' '));
}
});
|
module.exports = {
'/': {
backLink: '/../priority_service_170705/filter/uncancelled',
next: '/what-you-need'
},
'/before-you-continue-overseas': {
backLink: '/../priority_service_170705/overseas/uncancelled',
next: '/what-you-need-overseas'
},
'/what-you-need': {
backLink: './',
next: '/you-need-a-photo'
},
'/what-you-need-overseas': {
backLink: '/../priority_service_170705/overseas/try-service',
next: '/you-need-a-photo-overseas'
},
'/you-need-a-photo': {
backLink: '../book-appointment/confirmation-scenario-1',
next: '/choose-photo-method'
},
'/you-need-a-photo-overseas': {
backLink: './what-you-need-overseas',
next: '/choose-photo-method'
},
'/you-need-a-photo-v3': {
backLink: './what-you-need',
next: '/choose-photo-method'
},
'/choose-photo-method': {
fields: ['choose-photo'],
next: '/../upload'
},
'/choose-photo-method-overseas': {
fields: ['choose-photo-overseas'],
next: '/../upload'
}
};
|
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: ['./src/**/*.e2e-spec.ts'],
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless'],
binary: require('puppeteer').executablePath(),
},
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
},
};
|
'use strict';
angular.module('openhds')
.service('PregnancyResultService',
['EntityService', PregnancyResultService]);
function PregnancyResultService(EntityService) {
var service = this;
var urlBase = "/pregnancyResults";
function Request(model) {
console.log(model);
return {
collectedByUuid: model.fieldWorker.uuid,
pregnancyOutcomeUuid: model.pregnancyOutcome.uuid,
childUuid: model.child.uuid,
pregnancyResult: {
type: model.event.type,
collectionDateTime: model.collectionDate
}
};
}
service.submit = function(fieldWorker, collectionDate, visit,
outcome, child, event) {
var model = {
fieldWorker: fieldWorker,
collectionDate: collectionDate,
visit: visit,
pregnancyOutcome: outcome,
child: child,
event: event
};
return EntityService.submit(urlBase, Request, model);
};
return service;
}
|
/*!
* Bootstrap-select v1.12.4 (https://silviomoreto.github.io/bootstrap-select)
*
* Copyright 2013-2018 bootstrap-select
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
*/
!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){e.fn.selectpicker.defaults={noneSelectedText:"沒有選取任何項目",noneResultsText:"沒有找到符合的結果",countSelectedText:"已經選取{0}個項目",maxOptionsText:["超過限制 (最多選擇{n}項)","超過限制(最多選擇{n}組)"],selectAllText:"選取全部",deselectAllText:"全部取消",multipleSeparator:", "}});
|
'use strict';
var Lib = require('../../lib');
var handleXYZDefaults = require('../heatmap/xyz_defaults');
var attributes = require('./attributes');
var handleConstraintDefaults = require('../contour/constraint_defaults');
var handleContoursDefaults = require('../contour/contours_defaults');
var handleStyleDefaults = require('../contour/style_defaults');
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
function coerce(attr, dflt) {
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
}
function coerce2(attr) {
return Lib.coerce2(traceIn, traceOut, attributes, attr);
}
coerce('carpet');
// If either a or b is not present, then it's not a valid trace *unless* the carpet
// axis has the a or b values we're looking for. So if these are not found, just defer
// that decision until the calc step.
//
// NB: the calc step will modify the original data input by assigning whichever of
// a or b are missing. This is necessary because panning goes right from supplyDefaults
// to plot (skipping calc). That means on subsequent updates, this *will* need to be
// able to find a and b.
//
// The long-term proper fix is that this should perhaps use underscored attributes to
// at least modify the user input to a slightly lesser extent. Fully removing the
// input mutation is challenging. The underscore approach is not currently taken since
// it requires modification to all of the functions below that expect the coerced
// attribute name to match the property name -- except '_a' !== 'a' so that is not
// straightforward.
if(traceIn.a && traceIn.b) {
var len = handleXYZDefaults(traceIn, traceOut, coerce, layout, 'a', 'b');
if(!len) {
traceOut.visible = false;
return;
}
coerce('text');
var isConstraint = (coerce('contours.type') === 'constraint');
if(isConstraint) {
handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor, {hasHover: false});
} else {
handleContoursDefaults(traceIn, traceOut, coerce, coerce2);
handleStyleDefaults(traceIn, traceOut, coerce, layout, {hasHover: false});
}
} else {
traceOut._defaultColor = defaultColor;
traceOut._length = null;
}
};
|
import {make} from '@ciscospark/common';
const data = new (make(WeakMap, Map))();
/**
* Given a class property, this decorator changes it into a setter/getter pair;
* the setter will trigger `change:${prop}` when invoked
* @param {Object} target
* @param {string} prop
* @param {Object} descriptor
* @returns {undefined}
*/
export default function evented(target, prop, descriptor) {
const defaultValue = descriptor.initializer && descriptor.initializer();
Reflect.deleteProperty(descriptor, 'value');
Reflect.deleteProperty(descriptor, 'initializer');
Reflect.deleteProperty(descriptor, 'writable');
descriptor.get = function get() {
const value = data.get(this, prop);
if (typeof value !== 'undefined') {
return value;
}
return defaultValue;
};
descriptor.set = function set(value) {
const previous = this[prop];
if (previous !== value) {
data.set(this, prop, value);
this.trigger(`change:${prop}`, value, previous);
this.trigger('change');
}
};
}
|
'use strict'
module.exports = function pull (a) {
var length = arguments.length
if (typeof a === 'function' && a.length === 1) {
var args = new Array(length)
for(var i = 0; i < length; i++)
args[i] = arguments[i]
return function (read) {
args.unshift(read)
return pull.apply(null, args)
}
}
var read = a
if (read && typeof read.source === 'function') {
read = read.source
}
for (var i = 1; i < length; i++) {
var s = arguments[i]
if (typeof s === 'function') {
read = s(read)
} else if (s && typeof s === 'object') {
s.sink(read)
read = s.source
}
}
return read
}
|
const JSONRPC = {
Client: require("../Client")
};
/**
* Extend this class to link to extra worker RPC APIs on the master.
*/
class WorkerClient extends JSONRPC.Client
{
/**
* @returns {never}
*/
async gracefulExit()
{
return this.rpc("gracefulExit", [], /*bNotification*/ true);
}
/**
* This works as an internal router to a JSONRPC.Server's endpoints, used as libraries.
*
* Proxies RPC requests directly into potentially an internet facing JSONRPC.Server's registered endpoints.
*
* strEndpointPath is an endpoint path such as "/api-ws/ipc/bsi".
*
* **************** SKIPS ANY AUTHENTICATION OR AUTHORIZATION LAYERS***********************
* **************** as well as any other JSONRPC plugins ***************************
*
* @param {string} strEndpointPath
* @param {string} strFunctionName
* @param {Array} arrParams
* @param {boolean} bNotification = false
*/
async rpcToInternalEndpointAsLibrary(strEndpointPath, strFunctionName, arrParams, bNotification = false)
{
return this.rpc("rpcToInternalEndpointAsLibrary", [...arguments]);
}
};
module.exports = WorkerClient;
|
var mongoose = require('mongoose');
var userSchema = mongoose.Schema({
username: {type: String, required: true, unique: true},
password: {type: String}
});
mongoose.model('User', userSchema);
|
define({
"instruction": "Wybierz i skonfiguruj warstwy, które będą wyświetlane początkowo w tabeli atrybutów.",
"label": "Warstwa",
"show": "Pokaż",
"actions": "Skonfiguruj pola warstwy",
"field": "Pole",
"alias": "Alias",
"visible": "Widoczne",
"linkField": "Pole łącza",
"noLayers": "Brak warstw obiektu",
"back": "Wstecz",
"exportCSV": "Zezwalaj na eksport do pliku CSV",
"expand": "Wstępnie rozwiń widżet",
"filterByExtent": "Domyślnie włącz opcję Filtruj wg zasięgu mapy",
"restore": "Przywróć wartość domyślną",
"ok": "OK",
"cancel": "Anuluj",
"includePoint": "Dołącz współrzędne punktów do wyeksportowanego pliku",
"configureLayerFields": "Skonfiguruj pola warstwy",
"result": "Zapisano pomyślnie",
"warning": "Wybierz najpierw element Pokaż opcję.",
"fieldCheckWarning": "Należy zaznaczyć co najmniej jedno pole.",
"unsupportQueryWarning": "Warstwa musi obsługiwać zapytania w celu wyświetlenia w widżecie tabeli atrybutów. Upewnij się, że funkcja zapytania w usłudze jest włączona.",
"unsupportQueryLayers": "Ta warstwa musi obsługiwać zapytania w celu wyświetlenia w widżecie tabeli atrybutów. Upewnij się, że funkcja zapytania w usłudze jest włączona.",
"fieldName": "Nazwa",
"fieldAlias": "Alias",
"fieldVisibility": "Widoczność",
"fieldActions": "Operacje"
});
|
'use strict';
angular.module('MobcastApp')
.controller('Bestsellers_controller', function ($scope, gaEcommerce, Catalogue, $rootScope, $exceptionHandler, $filter, Bookset, SETTINGS, localize, IMPRESSIONS) {
$scope.listType = $rootScope.listType || $rootScope.list_type.grid;
gaEcommerce.waitFor(1);
/**
* Loads books for scope display in tabs.
*
* @param bookType The type of books you wish to load, fiction or non-fiction
*/
$scope.loadBooks = function(bookType){
var bookSet = 'bookset_' + bookType;
var booksetInScope = $scope[bookSet];
var query = angular.extend(booksetInScope.query, $scope.order.selected.query);
Bookset.displayBooksById(query, bookSet).then(function(data){
gaEcommerce.addImpressions(IMPRESSIONS.BESTSELLERS + ', ' + bookType, data.items);
if (bookType === 'nonfiction') {
gaEcommerce.sendPageView();
}
if (typeof(booksetInScope.items) !== 'undefined' && booksetInScope.items.length > 0 && data.items.length > 0) {
booksetInScope.items = booksetInScope.items.concat(data.items);
}
else {
angular.extend(booksetInScope, data);
}
},
function(error){
$exceptionHandler({message: error.status, stack: error.config}, error);
});
};
// set default option
$scope.order = {
selected: {
query: {
order: $rootScope.sort_modes.sequential.code,
desc: false
}
}
};
// booksets
$scope.bookset_fiction = Bookset.getBookset();
$scope.bookset_fiction.title = localize('_Fiction_');
$scope.bookset_fiction.query.count = $rootScope.bestseller.items_count;
$scope.bookset_fiction.listType = $rootScope.list_type.simple;
$scope.bookset_fiction.limit = $rootScope.bestseller.limit;
$scope.bookset_fiction.refresh = function() { $scope.loadBooks('fiction'); };
// We set up the non-fiction books here, but only actually load them when we need to when the tab is selected.
$scope.bookset_nonfiction = Bookset.getBookset();
$scope.bookset_nonfiction.title = localize('_Nonfiction_');
$scope.bookset_nonfiction.query.count = $rootScope.bestseller.items_count;
$scope.bookset_nonfiction.listType = $rootScope.list_type.simple;
$scope.bookset_nonfiction.limit = $rootScope.bestseller.limit;
$scope.bookset_nonfiction.refresh = function() { $scope.loadBooks('nonfiction'); };
$scope.sections = [$scope.bookset_fiction, $scope.bookset_nonfiction];
// retrieve the id of the fiction categories and get all the books for each section
Catalogue.get({slug: SETTINGS.CURATED_CATEGORIES.BESTSELLERS_FICTION}, 'categories').then(function (response) {
if(response.data.items && response.data.items.length > 0){
$scope.bookset_fiction.query.category = response.data.items[0].id;
$scope.loadBooks('fiction', true);
}
},
function (error) {
$exceptionHandler({message: error.status, stack: error.config}, error);
}
);
// set init flag on show
var activeWatch = $scope.$watch('active', function() {
if($scope.active && $scope.active.title === $scope.bookset_nonfiction.title){
Catalogue.get({slug: SETTINGS.CURATED_CATEGORIES.BESTSELLERS_NON_FICTION}, 'categories').then(function (response) {
if(response.data.items && response.data.items.length > 0){
$scope.bookset_nonfiction.query.category = response.data.items[0].id;
$scope.loadBooks('nonfiction');
}
},
function (error) {
$exceptionHandler({message: error.status, stack: error.config}, error);
}
);
activeWatch();
}
});
// sync listType between tabs
$scope.$watch('listType', function(){
angular.forEach($scope.sections, function(section){
section.listType = $scope.listType;
});
$rootScope.listType = $scope.listType;
});
/**
* GA - Track scrolling event when user scrolls more than x number of pixels
* @see app/scripts/directives/scroll_directive.js
* @use scroll-position="scroll" within the view/template
*/
var scrollListener = $scope.$watch('scroll', function(){
if($scope.scroll > 20) {
$rootScope.reportGA($rootScope.GA.BESTSELLERS_PAGE.USER_SCROLL_ACTION);
scrollListener(); // remove watcher
}
});
});
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M14.99 3H6c-.8 0-1.52.48-1.83 1.21L.91 11.82C.06 13.8 1.51 16 3.66 16h5.65l-.95 4.58c-.1.5.05 1.01.41 1.37.29.29.67.43 1.05.43s.77-.15 1.06-.44l5.53-5.54c.37-.37.58-.88.58-1.41V5c0-1.1-.9-2-2-2zm-4.33 16.33.61-2.92.5-2.41H3.66c-.47 0-.72-.28-.83-.45-.11-.17-.27-.51-.08-.95L6 5h8.99v9.99l-4.33 4.34zM21 3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2s2-.9 2-2V5c0-1.1-.9-2-2-2z"
}), 'ThumbDownOffAltRounded');
exports.default = _default;
|
// DATA_TEMPLATE: empty_table
oTest.fnStart("sPaginationType");
$(document).ready(function () {
/* Check the default */
var oTable = $('#example').dataTable({
"bServerSide": true,
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
});
var oSettings = oTable.fnSettings();
oTest.fnWaitTest(
"Check two button paging is the default",
null,
function () {
return oSettings.sPaginationType == "two_button";
}
);
oTest.fnWaitTest(
"Check class is applied",
null,
function () {
return $('#example_paginate').hasClass('paging_two_button');
}
);
oTest.fnWaitTest(
"Two A elements are in the wrapper",
null,
function () {
return $('#example_paginate a').length == 2;
}
);
oTest.fnWaitTest(
"We have the previous button",
null,
function () {
return document.getElementById('example_previous');
}
);
oTest.fnWaitTest(
"We have the next button",
null,
function () {
return document.getElementById('example_next');
}
);
oTest.fnWaitTest(
"Previous button is disabled",
null,
function () {
return $('#example_previous').hasClass('paginate_disabled_previous');
}
);
oTest.fnWaitTest(
"Next button is enabled",
null,
function () {
return $('#example_next').hasClass('paginate_enabled_next');
}
);
/* Don't test paging - that's done by the zero config test script. */
/* Two buttons paging */
var bComplete = false;
oTest.fnWaitTest(
"Can enabled full numbers paging",
function () {
oSession.fnRestore();
oTable = $('#example').dataTable({
"bServerSide": true,
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
"sPaginationType": "full_numbers",
"fnInitComplete": function () {
setTimeout(function () {
bComplete = true;
}, 500);
}
});
oSettings = oTable.fnSettings();
},
function () {
if (bComplete)
return oSettings.sPaginationType == "full_numbers";
else
return false;
}
);
oTest.fnWaitTest(
"Check full numbers class is applied",
null,
function () {
return $('#example_paginate').hasClass('paging_full_numbers');
}
);
var nFirst, nPrevious, nNext, nLast;
oTest.fnWaitTest(
"Jump to last page",
function () {
nFirst = $('div.dataTables_paginate a.first');
nPrevious = $('div.dataTables_paginate a.previous');
nNext = $('div.dataTables_paginate a.next');
nLast = $('div.dataTables_paginate a.last');
nLast.click();
},
function () {
return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries";
}
);
oTest.fnWaitTest(
"Go to two pages previous",
function () {
nPrevious.click();
nPrevious.click();
},
function () {
return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries";
}
);
oTest.fnWaitTest(
"Next (second last) page",
function () {
nNext.click();
},
function () {
return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries";
}
);
oTest.fnWaitTest(
"Jump to first page",
function () {
nFirst.click();
},
function () {
return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries";
}
);
oTest.fnComplete();
});
|
//>>built
define({save:"Salvare"});
|
version https://git-lfs.github.com/spec/v1
oid sha256:3e054bba755bec7f581c9e2cac4eac5c9b3512a85b0ab6b23000e70080d16227
size 7523
|
version https://git-lfs.github.com/spec/v1
oid sha256:6da85cedae08e0f9ef218782d3e938f808a5e065d84fe860b8a2093cda083eb0
size 2700
|
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Tracker } from 'meteor/tracker';
import { UploadFS } from 'meteor/jalik:ufs';
import { FileUploadBase } from '../../lib/FileUploadBase';
import { Uploads, Avatars } from '../../../models';
new UploadFS.Store({
collection: Uploads.model,
name: 'Uploads',
});
new UploadFS.Store({
collection: Avatars.model,
name: 'Avatars',
});
export const fileUploadHandler = (directive, meta, file) => {
const store = UploadFS.getStore(directive);
if (store) {
return new FileUploadBase(store, meta, file);
}
console.error('Invalid file store', directive);
};
Tracker.autorun(function() {
if (Meteor.userId()) {
document.cookie = `rc_uid=${ escape(Meteor.userId()) }; path=/`;
document.cookie = `rc_token=${ escape(Accounts._storedLoginToken()) }; path=/`;
}
});
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)([/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M12 11h2v2h-2v2h2v2h-2v2h8V9h-8v2zm4 0h2v2h-2v-2zm0 4h2v2h-2v-2z",
opacity: ".3"
}, "0"), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M16 15h2v2h-2zm0-4h2v2h-2zm6-4H12V3H2v18h20V7zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10z"
}, "1")], 'BusinessTwoTone');
exports.default = _default;
|
module.exports = [
{ name: 'aqua', hex: '#00FFFF' },
{ name: 'aliceblue', hex: '#F0F8FF' },
{ name: 'antiquewhite', hex: '#FAEBD7' },
{ name: 'black', hex: '#000000' },
{ name: 'blue', hex: '#0000FF' },
{ name: 'cyan', hex: '#00FFFF' },
{ name: 'darkblue', hex: '#00008B' },
{ name: 'darkcyan', hex: '#008B8B' },
{ name: 'darkgreen', hex: '#006400' },
{ name: 'darkturquoise', hex: '#00CED1' },
{ name: 'deepskyblue', hex: '#00BFFF' },
{ name: 'green', hex: '#008000' },
{ name: 'lime', hex: '#00FF00' },
{ name: 'mediumblue', hex: '#0000CD' },
{ name: 'mediumspringgreen', hex: '#00FA9A' },
{ name: 'navy', hex: '#000080' },
{ name: 'springgreen', hex: '#00FF7F' },
{ name: 'teal', hex: '#008080' },
{ name: 'midnightblue', hex: '#191970' },
{ name: 'dodgerblue', hex: '#1E90FF' },
{ name: 'lightseagreen', hex: '#20B2AA' },
{ name: 'forestgreen', hex: '#228B22' },
{ name: 'seagreen', hex: '#2E8B57' },
{ name: 'darkslategray', hex: '#2F4F4F' },
{ name: 'darkslategrey', hex: '#2F4F4F' },
{ name: 'limegreen', hex: '#32CD32' },
{ name: 'mediumseagreen', hex: '#3CB371' },
{ name: 'turquoise', hex: '#40E0D0' },
{ name: 'royalblue', hex: '#4169E1' },
{ name: 'steelblue', hex: '#4682B4' },
{ name: 'darkslateblue', hex: '#483D8B' },
{ name: 'mediumturquoise', hex: '#48D1CC' },
{ name: 'indigo', hex: '#4B0082' },
{ name: 'darkolivegreen', hex: '#556B2F' },
{ name: 'cadetblue', hex: '#5F9EA0' },
{ name: 'cornflowerblue', hex: '#6495ED' },
{ name: 'mediumaquamarine', hex: '#66CDAA' },
{ name: 'dimgray', hex: '#696969' },
{ name: 'dimgrey', hex: '#696969' },
{ name: 'slateblue', hex: '#6A5ACD' },
{ name: 'olivedrab', hex: '#6B8E23' },
{ name: 'slategray', hex: '#708090' },
{ name: 'slategrey', hex: '#708090' },
{ name: 'lightslategray', hex: '#778899' },
{ name: 'lightslategrey', hex: '#778899' },
{ name: 'mediumslateblue', hex: '#7B68EE' },
{ name: 'lawngreen', hex: '#7CFC00' },
{ name: 'aquamarine', hex: '#7FFFD4' },
{ name: 'chartreuse', hex: '#7FFF00' },
{ name: 'gray', hex: '#808080' },
{ name: 'grey', hex: '#808080' },
{ name: 'maroon', hex: '#800000' },
{ name: 'olive', hex: '#808000' },
{ name: 'purple', hex: '#800080' },
{ name: 'lightskyblue', hex: '#87CEFA' },
{ name: 'skyblue', hex: '#87CEEB' },
{ name: 'blueviolet', hex: '#8A2BE2' },
{ name: 'darkmagenta', hex: '#8B008B' },
{ name: 'darkred', hex: '#8B0000' },
{ name: 'saddlebrown', hex: '#8B4513' },
{ name: 'darkseagreen', hex: '#8FBC8F' },
{ name: 'lightgreen', hex: '#90EE90' },
{ name: 'mediumpurple', hex: '#9370DB' },
{ name: 'darkviolet', hex: '#9400D3' },
{ name: 'palegreen', hex: '#98FB98' },
{ name: 'darkorchid', hex: '#9932CC' },
{ name: 'yellowgreen', hex: '#9ACD32' },
{ name: 'sienna', hex: '#A0522D' },
{ name: 'brown', hex: '#A52A2A' },
{ name: 'darkgray', hex: '#A9A9A9' },
{ name: 'darkgrey', hex: '#A9A9A9' },
{ name: 'greenyellow', hex: '#ADFF2F' },
{ name: 'lightblue', hex: '#ADD8E6' },
{ name: 'paleturquoise', hex: '#AFEEEE' },
{ name: 'lightsteelblue', hex: '#B0C4DE' },
{ name: 'powderblue', hex: '#B0E0E6' },
{ name: 'firebrick', hex: '#B22222' },
{ name: 'darkgoldenrod', hex: '#B8860B' },
{ name: 'mediumorchid', hex: '#BA55D3' },
{ name: 'rosybrown', hex: '#BC8F8F' },
{ name: 'darkkhaki', hex: '#BDB76B' },
{ name: 'silver', hex: '#C0C0C0' },
{ name: 'mediumvioletred', hex: '#C71585' },
{ name: 'indianred', hex: '#CD5C5C' },
{ name: 'peru', hex: '#CD853F' },
{ name: 'chocolate', hex: '#D2691E' },
{ name: 'tan', hex: '#D2B48C' },
{ name: 'lightgray', hex: '#D3D3D3' },
{ name: 'lightgrey', hex: '#D3D3D3' },
{ name: 'thistle', hex: '#D8BFD8' },
{ name: 'goldenrod', hex: '#DAA520' },
{ name: 'orchid', hex: '#DA70D6' },
{ name: 'palevioletred', hex: '#DB7093' },
{ name: 'crimson', hex: '#DC143C' },
{ name: 'gainsboro', hex: '#DCDCDC' },
{ name: 'plum', hex: '#DDA0DD' },
{ name: 'burlywood', hex: '#DEB887' },
{ name: 'lightcyan', hex: '#E0FFFF' },
{ name: 'lavender', hex: '#E6E6FA' },
{ name: 'darksalmon', hex: '#E9967A' },
{ name: 'palegoldenrod', hex: '#EEE8AA' },
{ name: 'violet', hex: '#EE82EE' },
{ name: 'azure', hex: '#F0FFFF' },
{ name: 'honeydew', hex: '#F0FFF0' },
{ name: 'khaki', hex: '#F0E68C' },
{ name: 'lightcoral', hex: '#F08080' },
{ name: 'sandybrown', hex: '#F4A460' },
{ name: 'beige', hex: '#F5F5DC' },
{ name: 'mintcream', hex: '#F5FFFA' },
{ name: 'wheat', hex: '#F5DEB3' },
{ name: 'whitesmoke', hex: '#F5F5F5' },
{ name: 'ghostwhite', hex: '#F8F8FF' },
{ name: 'lightgoldenrodyellow',
hex: '#FAFAD2' },
{ name: 'linen', hex: '#FAF0E6' },
{ name: 'salmon', hex: '#FA8072' },
{ name: 'oldlace', hex: '#FDF5E6' },
{ name: 'bisque', hex: '#FFE4C4' },
{ name: 'blanchedalmond', hex: '#FFEBCD' },
{ name: 'coral', hex: '#FF7F50' },
{ name: 'cornsilk', hex: '#FFF8DC' },
{ name: 'darkorange', hex: '#FF8C00' },
{ name: 'deeppink', hex: '#FF1493' },
{ name: 'floralwhite', hex: '#FFFAF0' },
{ name: 'fuchsia', hex: '#FF00FF' },
{ name: 'gold', hex: '#FFD700' },
{ name: 'hotpink', hex: '#FF69B4' },
{ name: 'ivory', hex: '#FFFFF0' },
{ name: 'lavenderblush', hex: '#FFF0F5' },
{ name: 'lemonchiffon', hex: '#FFFACD' },
{ name: 'lightpink', hex: '#FFB6C1' },
{ name: 'lightsalmon', hex: '#FFA07A' },
{ name: 'lightyellow', hex: '#FFFFE0' },
{ name: 'magenta', hex: '#FF00FF' },
{ name: 'mistyrose', hex: '#FFE4E1' },
{ name: 'moccasin', hex: '#FFE4B5' },
{ name: 'navajowhite', hex: '#FFDEAD' },
{ name: 'orange', hex: '#FFA500' },
{ name: 'orangered', hex: '#FF4500' },
{ name: 'papayawhip', hex: '#FFEFD5' },
{ name: 'peachpuff', hex: '#FFDAB9' },
{ name: 'pink', hex: '#FFC0CB' },
{ name: 'red', hex: '#FF0000' },
{ name: 'seashell', hex: '#FFF5EE' },
{ name: 'snow', hex: '#FFFAFA' },
{ name: 'tomato', hex: '#FF6347' },
{ name: 'white', hex: '#FFFFFF' },
{ name: 'yellow', hex: '#FFFF00' }
]
|
'use strict';
// determine native module name
let nativeModuleName = null;
if (process.platform === 'win32') {
nativeModuleName = `${process.platform}-${process.arch}`;
}
// find module
let native = null;
try {
const _native = require(`./${nativeModuleName}`);
native = _native;
} catch (e) {}
// assign mock object
if (native === null) {
native = {
fetchFileIconAsPng: (path, cb) => {
cb([]);
},
saveFocus: () => {},
restoreFocus: () => {}
};
}
function fetchFileIconAsPng(filePath, callback) {
try {
native.fetchFileIconAsPng(filePath, callback);
} catch (e) {
console.log(e);
}
}
function saveFocus() {
native.saveFocus();
}
function restoreFocus() {
native.restoreFocus();
}
module.exports = { fetchFileIconAsPng, saveFocus, restoreFocus };
|
'use strict';
var loginMod = angular.module('MMI.login', ['MMI.ajaxService', 'ui.router', 'ngStorage']);
loginMod.controller('LoginCtrl', ['$scope', 'ajaxRequest', '$state', '$localStorage',
function ($scope, ajaxRequest, $state, $localStorage) {
$scope.data = {
username: '',
password: ''
};
if ($localStorage.user) {
$state.go('main.dashboard');
}
$scope.login = function () {
console.log($scope.data);
//can do better validation, but not doing it due to time constaint
if ($scope.data.username.length > 0 && $scope.data.password.length > 0) {
var ajax = ajaxRequest.send('login', $scope.data, true);
ajax.then(function (data) {
$localStorage.user = $scope.data.username;
$state.go('main.dashboard');
//its not returning proper response, thats why doing like this
}, function (data) {
alert(data.error);
});
} else {
alert('Please fill up form!');
}
};
}]);
|
'use strict'
const path = require('path')
const fs = require('fs-extra')
const chai = require('chai')
const expect = chai.expect
const sinonChai = require('sinon-chai')
chai.use(sinonChai)
chai.should()
const AccountTemplate = require('../../lib/models/account-template')
const templatePath = path.join(__dirname, '../../default-templates/new-account')
const accountPath = path.join(__dirname, '../resources/new-account')
describe('AccountTemplate', () => {
beforeEach(() => {
fs.removeSync(accountPath)
})
afterEach(() => {
fs.removeSync(accountPath)
})
describe('copy()', () => {
it('should copy a directory', () => {
return AccountTemplate.copyTemplateDir(templatePath, accountPath)
.then(() => {
let rootAcl = fs.readFileSync(path.join(accountPath, '.acl'), 'utf8')
expect(rootAcl).to.exist
})
})
})
describe('processAccount()', () => {
it('should process all the files in an account', () => {
let substitutions = {
webId: 'https://alice.example.com/#me',
email: 'alice@example.com',
name: 'Alice Q.'
}
let template = new AccountTemplate({ substitutions })
return AccountTemplate.copyTemplateDir(templatePath, accountPath)
.then(() => {
return template.processAccount(accountPath)
})
.then(() => {
let profile = fs.readFileSync(path.join(accountPath, '/profile/card'), 'utf8')
expect(profile).to.include('"Alice Q."')
let rootAcl = fs.readFileSync(path.join(accountPath, '.acl'), 'utf8')
expect(rootAcl).to.include('<mailto:alice@')
expect(rootAcl).to.include('<https://alice.example.com/#me>')
})
})
})
})
|
if (typeof exports === 'undefined') {
exports = {};
}
exports.config = {
"name": "addImgcom",
"desc": "新增图片组件",
// 线上地址
"url": "http://xxx/addImgcom",
// 日常地址
"urlDaily": "http://xxxx/addImgcom",
// 预发地址
"urlPrepub": "http://example.com/addImgcom",
// 支持的 Method 集合
"method": ['POST']
};
exports.request ={
pageId:'1332edf', //关联 pageid
imgcom:ImgComSchema //db的imgcom表;
} ;
exports.response = {
"success": true, // 标记成功
"model": ImgComSchema
};
exports.responseError = {
"success": false, // 标记失败
"model": {
"error": "Error message"
}
};
|
'use strict';
const React = require('react');
const classnames = require('classnames');
const baseClasses = {
'mdl-textfield__error': true,
};
class TextFieldError extends React.Component {
render() {
const {
children,
className,
} = this.props;
const classes = classnames(baseClasses, className);
return (
<span {...this.props} className={classes}>
{children}
</span>
);
}
}
TextFieldError.propTypes = {
className: React.PropTypes.string,
children: React.PropTypes.object,
};
module.exports = TextFieldError;
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms"). Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.
/*---
es5id: 11.8.3-4
description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: toString <=
toString
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var obj1 = {
toString: function () {
accessed = true;
return 3;
}
};
var obj2 = {
toString: function () {
if (accessed === true) {
return 4;
} else {
return 2;
}
}
};
return (obj1 <= obj2);
}
runTestCase(testcase);
|
'use strict';
module.exports = { extends: ['@commitlint/config-conventional'] };
|
export NavHeaderComponent from './NavHeader.component';
export default from './NavHeader.container';
|
angular.module('adminlounge.services', [])
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
}), 'SearchOutlined');
|
'use strict';
var Database = require('../../../')
, getPrototypeOf = Object.getPrototypeOf;
module.exports = function (a) {
var db = new Database(), proto = db.Object.prototype, obj = new db.Object()
, protoDesc, protoSet, set, item, protoItem;
protoDesc = proto.$getOwn('foo');
protoDesc.multiple = true;
set = obj.foo;
item = set.$getOwn('foo');
protoSet = proto.foo;
protoItem = protoSet.$getOwn('foo');
a(getPrototypeOf(item), protoItem, "Item prototype");
a(item._resolveValue_(), undefined, "Initial value");
protoSet.add('foo');
a(item._resolveValue_(), true, "Prototype: Add");
db.Object.prototype.define('dates', {
multiple: true,
type: db.DateTime
});
obj = db.objects.unserialize('Object#/dates*41420070400000');
a(obj.key instanceof db.DateTime, true);
db.DateTime.extend('Foo', {
step: { value: 1000 * 60 * 60 * 24 },
_validateCreate_: { value: function (value/*[, mth[, d[, h]]]*/) {
var l = arguments.length, year, month, day;
if (!l) {
value = new Date();
year = value.getFullYear();
month = value.getMonth();
day = value.getDate();
value.setUTCFullYear(year);
value.setUTCMonth(month);
value.setUTCDate(day);
} else if (l === 1) {
value = new Date(value);
} else {
value = new Date(Date.UTC(value, arguments[1], (l > 2) ? arguments[2] : 1,
(l > 3) ? arguments[3] : 0));
}
return [this.database.DateTime.validate.call(this, value)];
} },
normalize: { value: function (value/*, descriptor*/) {
var year, month, date;
if (!value) return this.database.DateTime.normalize.apply(this, arguments);
if (value instanceof this) return this.database.DateTime.normalize.apply(this, arguments);
if (Object.prototype.toString.call(value) !== '[object Date]') {
return this.database.DateTime.normalize.apply(this, arguments);
}
year = value.getFullYear();
month = value.getMonth();
date = value.getDate();
value = new Date(value);
value.setUTCFullYear(year);
value.setUTCMonth(month);
value.setUTCDate(date);
return this.database.DateTime.normalize.call(this, value, arguments[1]);
} },
validate: { value: function (value/*, descriptor*/) {
var year, month, date;
if (!value) return this.database.DateTime.validate.apply(this, arguments);
if (value instanceof this) return this.database.DateTime.validate.apply(this, arguments);
if (Object.prototype.toString.call(value) !== '[object Date]') {
return this.database.DateTime.validate.apply(this, arguments);
}
year = value.getFullYear();
month = value.getMonth();
date = value.getDate();
value = new Date(value);
value.setUTCFullYear(year);
value.setUTCMonth(month);
value.setUTCDate(date);
return this.database.DateTime.validate.call(this, value, arguments[1]);
} }
});
db.Object.prototype.define('dates2', {
multiple: true,
type: db.Foo
});
obj = new db.Object();
var date = new Date(2012, 2, 3, 12, 34);
obj.dates2.add(date);
var createdDate = obj.dates2.first;
a.not(date, createdDate);
obj.dates2.on('change', function (event) {
a(event.value, createdDate);
});
obj.dates2.delete(date);
a(obj.dates2.size, 0);
};
|
'use strict';
module.exports = {
build: ['<%= buildDir %>']
};
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M11 16h2v2h-2zm1-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"
}), 'HelpOutlineTwoTone');
exports.default = _default;
|
// a key map of allowed keys
var allowedKeys = {
67: 'c',
69: 'e',
83: 's',
66: 'b',
73: 'i',
84: 't'
};
// the 'official' Konami Code sequence
var konamiCode = ['e', 'e', 'c', 's', 'b', 'i', 't'];
// a variable to remember the 'position' the user has reached so far.
var konamiCodePosition = 0;
// add keydown event listener
document.addEventListener('keydown', function(e) {
// get the value of the key code from the key map
var key = allowedKeys[e.keyCode];
// get the value of the required key from the konami code
var requiredKey = konamiCode[konamiCodePosition];
// compare the key with the required key
if (key == requiredKey) {
// move to the next key in the konami code sequence
konamiCodePosition++;
// if the last key is reached, activate cheats
if (konamiCodePosition == konamiCode.length)
activateCheats();
} else
konamiCodePosition = 0;
});
function activateCheats() {
document.body.style.backgroundImage = "url('images/james.jpg')";
var audio = new Audio('audio/barbie.mp3');
audio.play();
alert("Throughout this project, Paul and James have constantly made jokes and bits. Here's a picture of James stripping in EECS - Vikram");
}
|
app.factory('loaderService', function($ionicModal, $rootScope) {
$ionicModal.fromTemplateUrl('templates/modals/loader.html', {
scope: $rootScope
}).then(function(modal) {
$rootScope.loader = modal;
});
return {
show: function() {
$rootScope.loader.show();
},
hide: function() {
$rootScope.loader.hide();
}
}
});
|
var searchData=
[
['child',['child',['../classQuadLinkedTrieNode.html#a386e85a2b259728ec9fbe26907823dcf',1,'QuadLinkedTrieNode::child() const '],['../classQuadLinkedTrieNode.html#add46f502e721f5cc00a3972d6cbec709',1,'QuadLinkedTrieNode::child(QuadLinkedTrieNode< T > *pChild)']]]
];
|
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import { expect } from 'chai';
import { AddPet } from 'client/components/AddPet';
import style from 'client/style.css';
const setup = () => {
const renderer = TestUtils.createRenderer();
renderer.render(<AddPet />);
const output = renderer.getRenderOutput();
return { output };
};
describe('tests AddPet component', () => {
it('renders correctly', () => {
const { output } = setup();
expect(output.type).to.eql('div');
expect(output.props.className).to.eql(style.add);
});
});
|
'use strict';
define(["app"], function(app) {
app.directive("scrollmanager", ["$timeout", "$rootScope", "Visibility", "ArrayUtils", "Network",
function($timeout, $rootScope, $visibility, $arrayUtils, $network) {
var userScroll = false, scrollObjects = {}, timeoutsUpdateSinceId = {};
function updateSinceId(referer, msg) {
timeoutsUpdateSinceId[referer] = timeoutsUpdateSinceId[referer] || {};
var uidProviderUser = msg.unifiedRequest.uidProviderUser;
if(msg.unifiedRequest.args && msg.unifiedRequest.args[0]) {
uidProviderUser + msg.unifiedRequest.args[0].value.call;//discriminant server side
}
if(timeoutsUpdateSinceId[referer][uidProviderUser] != undefined) {
$timeout.cancel(timeoutsUpdateSinceId[referer][uidProviderUser]);
}
timeoutsUpdateSinceId[referer][uidProviderUser] = $timeout(function() {
console.log(msg);
$network.send({
cmd: "updateSinceId",
body: {
columnTitle: msg.column,
unifiedRequest: msg.unifiedRequest,
sinceId: msg.sinceId
}
});
timeoutsUpdateSinceId[referer][uidProviderUser] = undefined;
}, 3000);
}
return {
restrict: 'A',
link: function(scope, elmt, attrs) {
var element = elmt[0];
var timeout = undefined;
if(attrs["scrollmanager"] === "onlyTop") {
var scroller = angular.element(element);
var unwatch = scope.$watch(attrs["scrolldata"], function(newValue, oldValue) {
if(newValue) {
var data = newValue.title;
console.log(newValue);
$rootScope.$on("scrollManagerGoTop", function(evt, column) {
if(angular.equals(column.title, data)) {
userScroll = false;
scroller[0].scrollTop = 0;
console.log(scrollObjects[data]);
updateSinceId(data, scrollObjects[data][scrollObjects[data].length-1]);
$timeout(function() {
userScroll = true;
}, 100);
}
});
var scrollMove = function(evt) {
if(scrollObjects[data] && userScroll == true) {
for (var i = 0; i < scrollObjects[data].length; i++) {
var object = scrollObjects[data][i];
if(object.isView === false) {
var pos = object.refElement.offsetTop - scroller[0].offsetTop;
if(evt.target.scrollTop <= pos) {
scrollObjects[data].splice(i, 1);
object.isView = true;
$visibility.notifyMessageRead();
scope.$apply();
updateSinceId(data, object);
} else {
//when object post is above scroll we stop
//why the fuck insert array isn't ordered ?????????
//return;
}
}
}
}
}
scroller.bind('scroll', scrollMove);
unwatch();
}
});
} else {
var scroller = angular.element(element.parentElement.parentElement);
var unwatch = scope.$watch(attrs["scrollmanager"], function(newValue, oldValue) {
if(newValue) {
var object = scope[attrs["scrollmanager"]];
if(object.isView === false) {
var referer = scope[attrs["scrolldata"]].title;
object.refElement = element;
scrollObjects[referer] = scrollObjects[referer] || [];
userScroll = false;
scroller[0].scrollTop += element.clientHeight;
if(timeout != undefined) {
$timeout.cancel(timeout);
}
timeout = $timeout(function() {
userScroll = true;
timeout = undefined;
}, 500);
scrollObjects[referer].splice(
$arrayUtils.sortedArrayLocationOf(object, scrollObjects[referer], 'createdAt')+1,
0,
object);
}
unwatch();
}
});
}
}
};
}]);
})
|
angular.module('pager')
.controller('HeaderCtrl', function($scope, $state) {
$scope.image = 'http://agencedianeriel.com/photo/Ostiguy-Jeanne-nouv09.jpg';
$scope.$on('$viewContentLoaded', function() {
$scope.view = $state.current.title;
});
});
|
// redeye.js
// @author Tim McGowan <dropdownmenu>
var fs = require("fs");
var _ = require("underscore");
var path = require("path");
var cs = require("coffee-script");
var coffee = require("js2coffee");
var IGNORE = ["node_modules"];
var convert = function(dir, force, cb) {
fs.readdir(dir, function(err, files) {
_.each(files, function(file) {
if (_.indexOf(IGNORE, file) === -1) {
var loc = path.join(dir, file);
fs.stat(loc, function(err, stat) {
if (stat.isDirectory()) {
convert(loc, force, cb);
} else {
var extension = path.extname(file);
if (extension === ".js") {
fs.readFile(loc, "utf8", function(err, str) {
try {
var res = coffee.build(str);
var comp;
if (force) {
// compile up here to avoid multiple try/catch
comp = cs.compile(res);
}
console.log(file);
var csFile = file.replace(".js", ".coffee");
fs.writeFile(path.join(dir, csFile), res, "utf8", function(err) {
if (err) {
console.log("could not convert: " + file);
cb();
} else {
console.log(path.join(dir, file));
if (force) {
fs.writeFile(path.join(dir, file), comp, function(err) {
if (err) {
console.log('unable to write new js');
}
cb();
});
} else {
cb();
}
}
});
} catch (e) {
console.log("could not convert: " + file);
}
});
}
}
});
}
});
});
};
function wrapper(dir, force) {
}
module.exports = function(startDir, number, force) {
var cb = function() {
number--;
if (number >= 0) {
convert(startDir, force, cb);
}
}
convert(startDir, force, cb);
}
|
import ValueCommand from './ValueCommand'
export default class RemoveValueCommand extends ValueCommand {
execute (params, context) {
const { nodeId, propertyName, valueId } = params.commandState
context.api.removeItem([nodeId, propertyName], valueId)
}
}
|
//@AddComponentMenu("planet/CloudsRotate")
//partial class CloudsRotate{ }
private var amtx : float = 0.0;
private var amty : float = 0.0;
private var amtz : float = 0.0;
//private var amtx : float = Random.Range(.2,-.2);
//private var amtz : float = Random.Range(.2,-.2);
private var this_transform : Transform;
function Start()
{
amty = Random.Range(Random.Range(4.0,7.0),-Random.Range(4.0,7.0));
amtx = Random.Range(Random.Range(4.0,7.0),-Random.Range(4.0,8.0));
amty = Random.Range(Random.Range(4.0,7.0),-Random.Range(4.0,8.0));
this_transform = transform;
}
function Update ()
{
this_transform.Rotate(Time.deltaTime *amtx, Time.deltaTime *amty, Time.deltaTime *amtz);
}
|
module.exports = function(grunt) {
grunt.registerTask('compile-html', [ 'assemble', 'bower-dependencies' ]);
};
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let Business = props =>
<SvgIcon {...props}>
<path d="M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z" />
</SvgIcon>;
Business = pure(Business);
Business.muiName = 'SvgIcon';
export default Business;
|
/** @type {import("../../../").Configuration} */
module.exports = {
mode: "production",
entry: "./index",
stats: {
ids: true,
reasons: false,
modules: false,
chunks: true,
chunkRelations: true,
chunkModules: true,
dependentModules: true,
chunkOrigins: true
}
};
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z"
}), 'Redeem');
exports.default = _default;
|
for (var i = function() { return 10 in [] } in list) process(x);
|
import { Composer } from '@superguigui/wagner';
import withStore from 'decorators/withStore';
/**
* EffectComposer class
*/
@withStore({ handleResize: ({ viewport }) => ({ width: viewport.width, height: viewport.height }) })
class EffectComposer extends Composer {
/**
* Constructor function
* @param {object} renderer Renderer
*/
constructor( renderer ) {
super( renderer, { useRGBA: true });
}
/**
* handleResize function
* @param {Object} size Viewport size
* @param {number} param.width Viewport width
* @param {number} param.height Viewport height
*/
handleResize({ width, height }) {
this.setSize( width, height );
}
}
export default EffectComposer;
|
var fs = require('fs');
var scripts = require('./sha');
var client;
module.exports = {
join: join,
init: init
};
function init(_client) {
client = _client;
}
/**
* @param args {Array} name of key table, namespace of hashes, and an optional limit
* @param callback {Function} called after the script executes
*/
function join(args, callback) {
var numKeys = ''+args.length;
var keys = args[0];
var hashNamespace = args[1];
var limit = args[2];
if(typeof callback !== 'function') {
throw new TypeError('moon-bucket requires a callback as the last argument');
}
if(client) {
fs.readFile('./scripts/join.lua', 'utf8', function(err, script) {
console.log(scripts['join']);
client.evalsha([scripts['join'], numKeys, keys, hashNamespace, limit], function(err, res) {
var reply;
if(res) {
reply = res.map(function(item) {
return reply_to_object(item);
});
}
return callback(err, reply);
});
});
}
}
/**
* Taken from the node redis source.
*
* Converts a redis reply to a valid JavaScript object.
*/
function reply_to_object(reply) {
var obj = {}, j, jl, key, val;
if (reply.length === 0 || !Array.isArray(reply)) {
return null;
}
for (j = 0, jl = reply.length; j < jl; j += 2) {
key = reply[j].toString('binary');
val = reply[j + 1];
obj[key] = val;
}
return obj;
}
|
!function($) {
'use strict';
function getUniques(arr) {
var n = {};
var uniques = [];
for (var i = 0; i < arr.length; i++) {
var val = arr[i];
if (!n[val]) {
n[val] = true;
uniques.push(val);
}
}
return uniques;
}
function empties(str) {
return (str.length > 0);
}
$.hasUnique = function(arr) {
arr = $.makeArray(arr);
arr = arr.map($.trim);
arr = arr.filter(empties);
var arr2 = getUniques(arr);
return (arr.length === arr2.length);
};
}(window.jQuery);
|
{
"listAddLink": "Dodaj",
"listRemoveLink": "usuń"
}
|
var gulp = require('gulp');
var useref = require('gulp-useref');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var gulpIf = require('gulp-if');
var imagemin = require('gulp-imagemin');
var cache = require('gulp-cache');
var del = require('del');
var nodemon = require('gulp-nodemon');
var runSequence = require('run-sequence');
// clean the build directory
gulp.task('clean', function() {
return del.sync('build');
});
// minify css and js files
gulp.task('minify', function() {
return gulp.src('public/index.html')
.pipe(useref())
.pipe(gulpIf('*.js', uglify()))
.pipe(gulpIf('*.css', cssnano()))
.pipe(gulp.dest('build'))
});
// optimize images
gulp.task('imgMin', function(){
return gulp.src('public/assets/img/*.+(png|jpg|jpeg|gif|svg)')
.pipe(cache(imagemin({
interlaced: true
})))
.pipe(gulp.dest('build/img'))
});
// start app
gulp.task('nodemon', function () {
nodemon({
script: 'server.js',
ext: 'js'
});
});
gulp.task('default', function() {
runSequence('clean', ['minify', 'imgMin'], 'nodemon')
});
|
const trapezoidArea = (a, b, h) => ((a + b) / 2) * h;
export default trapezoidArea;
|
import Ember from 'ember';
import ResetScrollMixin from '../mixins/reset-scroll';
export default Ember.Route.extend(ResetScrollMixin, {
ajax: Ember.inject.service(),
toast: Ember.inject.service(),
errorHandler: Ember.inject.service(),
user: Ember.inject.service(),
model(params) {
return this.get('ajax').request('/admin/polls/' + params.pollId, {
data: {
apikey: this.get('user').getApiKey()
}
}).then((result) => {
var votes = [];
result.poll.options.forEach((option, i) => {
var count = result.poll.votes[i];
if (count === undefined) {
count = 0;
}
var opt = {
text: option,
count: count
};
votes.push(opt);
});
votes.sort((a, b) => {
if (a.count < b.count) {
return 1;
}
else if (a.count > b.count) {
return -1;
}
return 0;
});
result.poll.votes = votes;
return {
poll: result.poll
};
}).catch((err) => {
this.get('errorHandler').handleError(err, 'Unable to retrieve poll.');
this.transitionTo('admin-polls');
});
}
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.