text
stringlengths 2
6.14k
|
|---|
const router = require('koa-router')();
router.get('/', (ctx) => {
return ctx.render('contact')
})
module.exports = router;
|
/**
* event handler to be fired if the content of input element have changed.
*/
function eventHandler() {
// write your own event handler here.
document.getElementById('info').innerHTML = 'input content changed to ' +
document.getElementById('input').value;
}
/**
* Variable which keeps track of the content of input element
* @type {string}
*/
INPUT_CONTENT = '';
/**
* Check input element periodically.
*/
polling = function() {
if (INPUT_CONTENT != document.getElementById('input').value)
eventHandler();
// update INPUT_CONTENT
INPUT_CONTENT = document.getElementById('input').value;
// polling interval: 500ms.
// you can change the polling interval to fit your need.
setTimeout(polling, 500);
};
|
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
const CC = Components.Constructor;
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream",
"setInputStream");
const ProtocolProxyService = CC("@mozilla.org/network/protocol-proxy-service;1",
"nsIProtocolProxyService");
var sts = Cc["@mozilla.org/network/socket-transport-service;1"]
.getService(Ci.nsISocketTransportService);
function launchConnection(socks_vers, socks_port, dest_host, dest_port, dns)
{
var pi_flags = 0;
if (dns == 'remote')
pi_flags = Ci.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST;
var pps = new ProtocolProxyService();
var pi = pps.newProxyInfo(socks_vers, 'localhost', socks_port,
pi_flags, -1, null);
var trans = sts.createTransport(null, 0, dest_host, dest_port, pi);
var input = trans.openInputStream(Ci.nsITransport.OPEN_BLOCKING,0,0);
var output = trans.openOutputStream(Ci.nsITransport.OPEN_BLOCKING,0,0);
var bin = new BinaryInputStream(input);
var data = bin.readBytes(5);
if (data == 'PING!') {
print('client: got ping, sending pong.');
output.write('PONG!', 5);
} else {
print('client: wrong data from server:', data);
output.write('Error: wrong data received.', 27);
}
output.close();
}
for each (var arg in arguments) {
print('client: running test', arg);
test = arg.split('|');
launchConnection(test[0], parseInt(test[1]), test[2],
parseInt(test[3]), test[4]);
}
|
goog.provide('nclosure.examples.animals.IAnimal');
/**
* This is the base animal interface that will be inherited by all animals.
*
* @interface
*/
nclosure.examples.animals.IAnimal = function() {};
/**
* Makes the animal talk in its own special way
*/
nclosure.examples.animals.IAnimal.prototype.talk = goog.abstractMethod;
|
var searchData=
[
['includequery',['includeQuery',['../classcom_1_1example_1_1servlets_1_1_atakan_servlet_1_1_mathematician.html#a2ded5a2636fe235baef719d9f16ad2e1',1,'com::example::servlets::AtakanServlet::Mathematician']]]
];
|
/**
* JVectormap demo page
*/
(function ($) {
'use strict';
$('.world-map').vectorMap({
map: 'world_mill_en',
backgroundColor: 'transparent',
zoomOnScroll: false,
strokeWidth: 1,
regionStyle: {
initial: {
fill: $.staticApp.dark,
'fill-opacity': 0.2
},
hover: {
'fill-opacity': 0.3
}
},
markerStyle: {
initial: {
fill: $.staticApp.primary,
stroke: $.staticApp.primary,
'fill-opacity': 1,
'stroke-width': 8,
'stroke-opacity': 0.3,
r: 5
},
hover: {
r: 8,
stroke: $.staticApp.primary,
'stroke-width': 10
}
},
markers: [{
latLng: [41.90, 12.45],
name: 'Vatican City'
}, {
latLng: [43.73, 7.41],
name: 'Monaco'
}, {
latLng: [-0.52, 166.93],
name: 'Nauru'
}, {
latLng: [-8.51, 179.21],
name: 'Tuvalu'
}, {
latLng: [43.93, 12.46],
name: 'San Marino'
}, {
latLng: [47.14, 9.52],
name: 'Liechtenstein'
}, {
latLng: [35.88, 14.5],
name: 'Malta'
}, {
latLng: [13.16, -61.23],
name: 'Saint Vincent and the Grenadines'
}, {
latLng: [-4.61, 55.45],
name: 'Seychelles'
}, {
latLng: [7.35, 134.46],
name: 'Palau'
}, {
latLng: [42.5, 1.51],
name: 'Andorra'
}, {
latLng: [6.91, 158.18],
name: 'Federated States of Micronesia'
}, {
latLng: [1.3, 103.8],
name: 'Singapore'
}, {
latLng: [1.46, 173.03],
name: 'Kiribati'
}, {
latLng: [-21.13, -175.2],
name: 'Tonga'
}, {
latLng: [-20.2, 57.5],
name: 'Mauritius'
}, {
latLng: [26.02, 50.55],
name: 'Bahrain'
}]
});
})(jQuery);
|
/**
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const {
createCtrlcHandler,
exitCtrlcHandler,
} = require('../common/ctrlcHandler');
const {
displayLifecycleDebugging,
} = require('../compile/debug-compilation-lifecycle');
const {cleanupBuildDir, closureCompile} = require('../compile/compile');
const {compileCss} = require('./css');
const {extensions, maybeInitializeExtensions} = require('./extension-helpers');
const {log} = require('../common/logging');
const {typecheckNewServer} = require('../server/typescript-compile');
/**
* Runs closure compiler's type checker against all AMP code.
* @return {!Promise<void>}
*/
async function checkTypes() {
const handlerProcess = createCtrlcHandler('check-types');
process.env.NODE_ENV = 'production';
cleanupBuildDir();
maybeInitializeExtensions();
typecheckNewServer();
const srcFiles = [
'src/amp.js',
'src/amp-shadow.js',
'src/inabox/amp-inabox.js',
'ads/alp/install-alp.js',
'ads/inabox/inabox-host.js',
'src/web-worker/web-worker.js',
];
const extensionValues = Object.keys(extensions).map((key) => extensions[key]);
const extensionSrcs = extensionValues
.filter((ext) => !ext.noTypeCheck)
.map((ext) => `extensions/${ext.name}/${ext.version}/${ext.name}.js`)
.sort();
await compileCss();
log('Checking types...');
displayLifecycleDebugging();
await Promise.all([
closureCompile(srcFiles, './dist', 'src-check-types.js', {
include3pDirectories: true,
includePolyfills: true,
extraGlobs: ['src/inabox/*.js', '!node_modules/preact'],
typeCheckOnly: true,
warningLevel: 'QUIET', // TODO(amphtml): Make this 'DEFAULT'
}),
closureCompile(extensionSrcs, './dist', 'extensions-check-types.js', {
include3pDirectories: true,
includePolyfills: true,
extraGlobs: ['src/inabox/*.js', '!node_modules/preact'],
typeCheckOnly: true,
warningLevel: 'QUIET', // TODO(amphtml): Make this 'DEFAULT'
}),
// Type check 3p/ads code.
closureCompile(
['3p/integration.js'],
'./dist',
'integration-check-types.js',
{
externs: ['ads/ads.extern.js'],
include3pDirectories: true,
includePolyfills: true,
typeCheckOnly: true,
warningLevel: 'QUIET', // TODO(amphtml): Make this 'DEFAULT'
}
),
closureCompile(
['3p/ampcontext-lib.js'],
'./dist',
'ampcontext-check-types.js',
{
externs: ['ads/ads.extern.js'],
include3pDirectories: true,
includePolyfills: true,
typeCheckOnly: true,
warningLevel: 'QUIET', // TODO(amphtml): Make this 'DEFAULT'
}
),
closureCompile(
['3p/iframe-transport-client-lib.js'],
'./dist',
'iframe-transport-client-check-types.js',
{
externs: ['ads/ads.extern.js'],
include3pDirectories: true,
includePolyfills: true,
typeCheckOnly: true,
warningLevel: 'QUIET', // TODO(amphtml): Make this 'DEFAULT'
}
),
]);
exitCtrlcHandler(handlerProcess);
}
module.exports = {
checkTypes,
};
/* eslint "google-camelcase/google-camelcase": 0 */
checkTypes.description = 'Check source code for JS type errors';
checkTypes.flags = {
closure_concurrency: 'Sets the number of concurrent invocations of closure',
debug: 'Outputs the file contents during compilation lifecycles',
warning_level:
"Optionally sets closure's warning level to one of [quiet, default, verbose]",
};
|
var view = Ti.UI.createView({
backgroundColor:'#000',
top:0,
left:0,
width:'100%',
height:'100%',
layout:'vertical'
});
// create labels, buttons, text fields
var helpLabel = Titanium.UI.createLabel({
color:'#abcdef',
highlightedColor:'#0f0',
backgroundColor:'transparent',
width:'auto',
height:'auto',
text:'Pick your selection and touch submit'
});
var submitButton = Titanium.UI.createButton({
color:'#abcdef',
top: 20,
width:200,
height:40,
font:{fontSize:20,fontWeight:'bold',fontFamily:'Helvetica Neue'},
title:'Submit'
});
submitButton.addEventListener('click', function() {
// do nothing right now, next lab will submit via xhr
});
var radioGroup = [];
var radioGroupIndex = 0;
var radioSelected;
function createRadioGroupButton(itemName) {
var buttonView1 = Titanium.UI.createView({
top: 10, left: 0, height: 50, width: 200,
borderRadius: 10,
backgroundColor: '#fff',
index: radioGroupIndex
});
var selection1 = Titanium.UI.createLabel({
text : itemName,
color : '#f79e18',
font : {fontSize : 40},
textAlign: 'center' });
buttonView1.add(selection1);
buttonView1.addEventListener('click', function() {
buttonView1.backgroundColor = '#cef7ff';
radioSelected = selection1.text;
Ti.API.log("DEBUG",'selection1.text'+selection1.text);
for (var i=0; i < radioGroup.length; i++) {
deselect(i,index);
};
});
var index = radioGroupIndex;
deselect = function (i,j) {
//Ti.API.log("DEBUG",'deselect:'+radioGroup[i].index);
if (radioGroup[i].index != j) {
radioGroup[i].radioButton.backgroundColor = '#fff';
}
}
radioGroupIndex = radioGroupIndex +1;
var exportWidget = {
radioButton: buttonView1,
deselect: deselect,
index: index};
radioGroup.push(exportWidget);
return exportWidget;
}
view.add(helpLabel);
view.add(createRadioGroupButton('Fish').radioButton);
view.add(createRadioGroupButton('Vegetarian').radioButton);
view.add(createRadioGroupButton('Chicken').radioButton);
view.add(submitButton);
Ti.UI.currentWindow.add(view);
|
/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Relevance UI Team,
* Aug 2015
*/
//This is a global service and will be cache
angular.module('factory.appPermission', []).factory('uac', ['$http', '$log', '$q', 'session', function ($http, $log, $q, session) {
'use strict';
function getpermissionforcategory (category, permissionto, permissionset) {
var perms = [];
if (permissionset) {
for (var i = 0; i < permissionset.length; i++) {
var obj = permissionset[i].permissions;
for (var j = 0; j < obj.length; j++) {
if (obj[j].category === category) {
var acc = obj[j].access.toString().split(',');
for (var ac in acc) {
if (perms.indexOf(acc[ac]) < 0){
perms.push(acc[ac]);
}
}
}
}
}
if (perms.indexOf(permissionto) >= 0) {
return (true);
} else{
return (false);
}
} else {
return (false);
}
}
var permissionService = {
hasPermission: function(category, permissionto){
var retVal = '';
if (!session.getUser()) {
return false; // return permission denied
}else {
retVal = getpermissionforcategory(category, permissionto, session.getUser().permissionset);
return retVal;
}
}
};
return {
hasPermission: permissionService.hasPermission
};
}]);
|
Ext.namespace("Inubit.WebModeler");
Inubit.WebModeler.ModelNodesLoader = Ext.extend(Inubit.WebModeler.Loader, {
constructor : function (config) {
this.chunkSize = 25;
this.loaded = 0;
this.toLoad = 0;
this.currentChunk = 0;
this.chunks = new Array();
this.nodes = new Array();
this.mode = config.mode;
this.rootComponent = config.rootComponent;
Inubit.WebModeler.ModelNodesLoader.superclass.constructor.call(this, config);
},
load : function(baseUri, canvas) {
var handler = this;
Ext.Ajax.request({
method : 'GET',
url : baseUri + "/nodes",
disableCaching : false,
success : function(response) {
if (response.status == 200) {
var xmlDoc = response.responseXML;
var uris = xmlDoc.getElementsByTagName("uri");
handler.toLoad = Math.ceil(uris.length / handler.chunkSize);
if (handler.toLoad == 0)
handler.fireEvent("load");
for (var i = 0; i < handler.toLoad; i++) {
handler.chunks[i] = new Array();
}
for (i = 0; i < uris.length; i++) {
var ci = Math.floor(i / handler.chunkSize);
handler.chunks[ci].push(uris[i].firstChild.nodeValue);
}
handler.loadNextChunk(canvas);
} else if (response.status == 403) {
// forbidden..... do something
} else {
// do something on error
}
},
failure : function(){
this.fireEvent("error");
// do something on error
}
});
},
loadNextChunk : function( canvas ) {
var chunk = this.chunks[this.currentChunk];
if(!Ext.isDefined(chunk)) {
return;
}
for (var i = 0; i < chunk.length; i++) {
var newNode = null;
var config = {
uri: Util.getPath(chunk[i]),
model: null,
rootComponent: this.rootComponent,
listeners: {
load: function() {
this.nodeLoaded(canvas);
},
scope: this
}
};
if (this.mode == Inubit.WebModeler.ModelLoader.MODE_EDIT) {
newNode = new Inubit.WebModeler.EditableProcessNode(config);
} else if (this.mode == Inubit.WebModeler.ModelLoader.MODE_VIEW) {
newNode = new Inubit.WebModeler.model.viewer.AnnotatedProcessNode(config);
} else {
newNode = new Inubit.WebModeler.model.viewer.ReferenceNode(config);
}
newNode.load(canvas, true);
this.nodes.push(newNode);
}
},
nodeLoaded : function(canvas) {
this.loaded++;
if (this.loaded == this.chunks[this.currentChunk].length) {
this.currentChunk++;
if (this.currentChunk == this.chunks.length)
this.fireEvent("load");
this.loaded = 0;
this.loadNextChunk(canvas);
}
},
getNodes : function() {
return this.nodes;
}
});
|
<%#
Copyright 2013-2017 the original author or authors.
This file is part of the JHipster project, see https://jhipster.github.io/
for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-%>
(function() {
'use strict';
// DO NOT EDIT THIS FILE, EDIT THE GULP TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE
angular
.module('<%=angularAppName%>')
.constant('VERSION', '0.0.1-SNAPSHOT')
.constant('DEBUG_INFO_ENABLED', true);
})();
|
/*!
* ${copyright}
*/
sap.ui.define(['jquery.sap.global', './Matcher'], function ($, Matcher) {
"use strict";
/**
* BindingPath - checks if a control has a binding context with the exact same binding path.
*
* @class BindingPath - checks if a control has a binding context with the exact same binding path
* @extends sap.ui.test.matchers.Matcher
* @param {object} [mSettings] Map/JSON-object with initial settings for the new BindingPath.
* @public
* @name sap.ui.test.matchers.BindingPath
* @author SAP SE
* @since 1.32
*/
return Matcher.extend("sap.ui.test.matchers.BindingPath", /** @lends sap.ui.test.matchers.BindingPath.prototype */ {
metadata: {
publicMethods: ["isMatching"],
properties: {
/**
* The value of the binding path that is used for matching.
*/
path: {
type: "string"
},
/**
* The name of the binding model that is used for matching.
*/
modelName: {
type: "string"
}
}
},
/**
* Checks if the control has a binding context that matches the path
*
* @param {sap.ui.core.Control} oControl the control that is checked by the matcher
* @return {boolean} true if the binding path has a strictly matching value.
* @public
*/
isMatching: function (oControl) {
var oBindingContext;
// check if there is a binding path
if (!this.getPath()) {
throw new Error(this + " the path needs to be a not empty string");
}
// check if there is a model name
if (this.getModelName()) {
oBindingContext = oControl.getBindingContext(this.getModelName());
} else {
oBindingContext = oControl.getBindingContext();
}
// check if there is a binding context
if (!oBindingContext) {
this._oLogger.debug("The control " + oControl + " has no binding context for the model " + this.getModelName());
return false;
}
// check if the binding context is correct
var bResult = this.getPath() === oBindingContext.getPath();
if (!bResult) {
this._oLogger.debug("The control " + oControl + " does not " +
"have a matching binding context expected " + this.getPath() + " but got " +
oBindingContext.getPath());
}
return bResult;
}
});
}, /* bExport= */ true);
|
define(
//begin v1.x content
{
"days-standAlone-short": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"months-format-narrow": [
"j",
"f",
"m",
"a",
"m",
"j",
"j",
"a",
"s",
"o",
"n",
"d"
],
"quarters-standAlone-narrow": [
"1.",
"2.",
"3.",
"4."
],
"field-weekday": "dan u nedelji",
"$locale": "sr-latn",
"dateFormatItem-yQQQ": "QQQ. y",
"dateFormatItem-yMEd": "E, d. M. y.",
"dateFormatItem-MMMEd": "E d. MMM",
"eraNarrow": [
"p. n. e.",
"n. e."
],
"dateFormatItem-yMM": "MM.y",
"dateFormatItem-MMMdd": "dd.MMM",
"days-format-short": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"dateFormat-long": "dd. MMMM y.",
"months-format-wide": [
"januar",
"februar",
"mart",
"april",
"maj",
"jun",
"jul",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"dayPeriods-format-wide-pm": "popodne",
"dateFormat-full": "EEEE, dd. MMMM y.",
"dateFormatItem-Md": "d/M",
"dateFormatItem-yMd": "d. M. y.",
"field-era": "era",
"dateFormatItem-yM": "y-M",
"months-standAlone-wide": [
"januar",
"februar",
"mart",
"april",
"maj",
"jun",
"jul",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"timeFormat-short": "HH.mm",
"quarters-format-wide": [
"Prvo tromesečje",
"Drugo tromesečje",
"Treće tromesečje",
"Četvrto tromesečje"
],
"dateFormatItem-yQQQQ": "QQQQ. y",
"timeFormat-long": "HH.mm.ss z",
"field-year": "godina",
"dateFormatItem-yMMM": "MMM y.",
"field-hour": "čas",
"dateFormatItem-MMdd": "MM-dd",
"months-format-abbr": [
"januar",
"februar",
"mart",
"april",
"maj",
"jun",
"jul",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"timeFormat-full": "HH.mm.ss zzzz",
"field-day-relative+0": "danas",
"field-day-relative+1": "sutra",
"field-day-relative+2": "prekosutra",
"months-standAlone-abbr": [
"januar",
"februar",
"mart",
"april",
"maj",
"jun",
"jul",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"quarters-format-abbr": [
"Prvo tromesečje",
"Drugo tromesečje",
"Treće tromesečje",
"Četvrto tromesečje"
],
"quarters-standAlone-wide": [
"Prvo tromesečje",
"Drugo tromesečje",
"Treće tromesečje",
"Četvrto tromesečje"
],
"days-standAlone-wide": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"dateFormatItem-MMMMd": "d. MMMM",
"timeFormat-medium": "HH.mm.ss",
"dateFormatItem-yMMdd": "dd.MM.y",
"dateFormatItem-Hm": "HH.mm",
"quarters-standAlone-abbr": [
"Prvo tromesečje",
"Drugo tromesečje",
"Treće tromesečje",
"Četvrto tromesečje"
],
"eraAbbr": [
"p. n. e.",
"n. e."
],
"field-minute": "minut",
"field-dayperiod": "pre podne/popodne",
"days-standAlone-abbr": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"dateFormatItem-ms": "mm.ss",
"quarters-format-narrow": [
"1.",
"2.",
"3.",
"4."
],
"field-day-relative+-1": "juče",
"dateFormatItem-h": "hh a",
"field-day-relative+-2": "prekjuče",
"dateFormatItem-MMMd": "d. MMM",
"dateFormatItem-MEd": "E, M-d",
"dateFormatItem-yMMMM": "MMMM y.",
"field-day": "dan",
"days-format-wide": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"field-zone": "zona",
"dateFormatItem-y": "y.",
"months-standAlone-narrow": [
"j",
"f",
"m",
"a",
"m",
"j",
"j",
"a",
"s",
"o",
"n",
"d"
],
"field-year-relative+-1": "Prošle godine",
"field-month-relative+-1": "Prošlog meseca",
"dateFormatItem-hm": "hh.mm a",
"days-format-abbr": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"četvrtak",
"petak",
"subota"
],
"dateFormatItem-yMMMd": "d. MMM y.",
"eraNames": [
"p. n. e.",
"n. e."
],
"days-format-narrow": [
"n",
"p",
"u",
"s",
"č",
"p",
"s"
],
"field-month": "mesec",
"days-standAlone-narrow": [
"n",
"p",
"u",
"s",
"č",
"p",
"s"
],
"dayPeriods-format-wide-am": "pre podne",
"dateFormatItem-MMMMEd": "E d. MMMM",
"dateFormatItem-MMMMdd": "dd. MMMM",
"dateFormat-short": "d.M.yy.",
"field-second": "sekund",
"dateFormatItem-yMMMEd": "E, d. MMM y.",
"field-month-relative+0": "Ovog meseca",
"field-month-relative+1": "Sledećeg meseca",
"dateFormatItem-Ed": "E d.",
"field-week": "nedelja",
"dateFormat-medium": "dd.MM.y.",
"field-year-relative+0": "Ove godine",
"field-week-relative+-1": "Prošle nedelje",
"field-year-relative+1": "Sledeće godine",
"dateFormatItem-Hms": "HH.mm.ss",
"dateFormatItem-hms": "hh.mm.ss a",
"field-week-relative+0": "Ove nedelje",
"field-week-relative+1": "Sledeće nedelje"
}
//end v1.x content
);
|
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ux.PortalColumn = Ext.extend(Ext.Container, {
layout : 'anchor',
//autoEl : 'div',//already defined by Ext.Component
defaultType : 'portlet',
cls : 'x-portal-column'
});
Ext.reg('portalcolumn', Ext.ux.PortalColumn);
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var App = require('app');
// This logic is substituted by MainAdminView for now.
App.MainAdminMenuView = Em.CollectionView.extend({
//contentBinding: 'controller',
/*content: [
{
route:'user',
label:'Users'
},
{
route:'security',
label:'Security'
},
{
route:'cluster',
label:'Cluster'
}
/*,
{
route:'authentication',
label:'Authentication'
},
{
route: 'user',
label: 'Users'
},
{
route: 'security',
label: 'Security'
}/*,
{
route:'authentication',
label:'Authentication'
},
{
route:'audit',
label:'Audit'
}*/
/*,
{
route:'advanced',
label:'Advanced'
}
],
tagName: "ul",
classNames: ["nav", "nav-list"],
init: function () {
this._super();
this.activateView(); // default selected menu
},
activateView: function () {
var route = App.get('router.mainAdminController.category');
$.each(this._childViews, function () {
this.set('active', (this.get('content.route') == route ? "active" : ""));
});
}.observes('App.router.mainAdminController.category'),
itemViewClass:Em.View.extend({
classNameBindings:["active"],
active:"",
template:Ember.Handlebars.compile('<a class="text-center" {{action adminNavigate view.content.route }} href="#"> {{unbound view.content.label}}</a>')
})
*/
});
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import angular from 'angular';
import templateUrl from 'views/signin.tpl.pug';
angular
.module('ignite-console.states.login', [
'ui.router',
// services
'ignite-console.user'
])
.config(['$stateProvider', 'AclRouteProvider', function($stateProvider) {
// set up the states
$stateProvider
.state('signin', {
url: '/',
templateUrl,
resolve: {
user: ['$state', 'User', ($state, User) => {
return User.read()
.then(() => $state.go('base.configuration.clusters'))
.catch(() => {});
}]
},
controllerAs: '$ctrl',
controller() {},
metaTags: {
}
});
}]);
|
/*
Copyright 2013 - $Date $ by PeopleWare n.v.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
define(["contracts/doh",
"../SiScalarQuantitativeValue", "./ScalarQuantitativeValue",
"dojo/_base/declare", "dojo/_base/lang"],
function(doh,
SiScalarQuantitativeValue, testGeneratorScalarQuantitativeValue,
declare, lang) {
var SiSqvMock = declare([SiScalarQuantitativeValue], {});
SiSqvMock.mid = "pictoperfect-viewmodel/value/SiScalarQuantitativeValue";
SiSqvMock.baseUnit = "-BASE UNIT";
function testGeneratorSiScalarQuantitativeValue(Constructor, kwargs1, kwargs2, renameds) {
testGeneratorScalarQuantitativeValue(Constructor, kwargs1, kwargs2, renameds);
doh.register(Constructor.mid, [
function testGetBaseUnit() {
var result = Constructor.prototype.getBaseUnit();
// post
doh.t(result && true); // make it a boolean; doh evals strings
}
]);
var units = Constructor.prototype.getSupportedUnits();
units.forEach(function(unit) {
doh.register(Constructor.mid, [
{
name: "test getUnitPrefix of this (" + unit + ")",
setUp: function() {
this.instrumented = lang.clone(kwargs1);
this.instrumented.unit = unit;
this.subject = new Constructor(this.instrumented);
},
runTest: function() {
var result = this.subject.getUnitPrefix();
doh.invars(this.subject);
if (unit.indexOf(this.subject.getBaseUnit()) >= 0) {
doh.t(SiScalarQuantitativeValue.siPrefixes.contains(result));
doh.is(unit, result + this.subject.getBaseUnit());
}
else {
doh.is(null, result);
}
},
tearDown: function() {
delete this.instrumented;
delete this.subject;
}
},
{
name: "test getUnitPrefix of " + unit,
setUp: function() {
this.subject = new Constructor(kwargs1);
},
runTest: function() {
var result = this.subject.getUnitPrefix(unit);
doh.invars(this.subject);
// post
if (unit.indexOf(this.subject.getBaseUnit()) >= 0) {
doh.t(SiScalarQuantitativeValue.siPrefixes.contains(result));
doh.is(unit, result + this.subject.getBaseUnit());
}
else {
doh.is(null, result);
}
},
tearDown: function() {
delete this.subject;
}
}
]);
});
}
testGeneratorSiScalarQuantitativeValue(
SiSqvMock,
{
scalarValue: 123,
unit: "µ-BASE UNIT"
},
{
scalarValue: 456.789,
unit: "-BASE UNIT"
}
);
return testGeneratorSiScalarQuantitativeValue;
}
);
|
'use strict';
var test = require('tap').test;
var fs = require('fs');
var path = require('path');
var temp = require('temp');
var streamBuffers = require("stream-buffers");
var unzip = require('../');
var Stream = require('stream');
// Backwards compatibility for node 0.8
if (!Stream.Writable)
Stream = require('readable-stream');
test("pipe a single file entry out of a zip", function (t) {
var receiver = Stream.Transform({objectMode:true});
receiver._transform = function(entry,e,cb) {
if (entry.path === 'file.txt') {
var writableStream = new streamBuffers.WritableStreamBuffer();
writableStream.on('close', function () {
var str = writableStream.getContentsAsString('utf8');
var fileStr = fs.readFileSync(path.join(__dirname, '../testData/compressed-standard/inflated/file.txt'), 'utf8');
t.equal(str, fileStr);
t.end();
cb();
});
entry.pipe(writableStream);
} else {
entry.autodrain();
cb();
}
};
var archive = path.join(__dirname, '../testData/compressed-standard/archive.zip');
fs.createReadStream(archive)
.pipe(unzip.Parse())
.pipe(receiver);
});
|
var searchData=
[
['paikallaan',['PAIKALLAAN',['../namespace_julkinen.html#a81b50e3c6f21c0c1c46e186592107c3cafa60a1b03bc49af14fb90b7026f94957',1,'Julkinen']]]
];
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Check that setting a breakpoint in a line without code in the second child
* script will skip forward.
*/
var gDebuggee;
var gClient;
var gThreadClient;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function () {
attachTestGlobalClientAndResume(gClient,
"test-stack",
function (aResponse, aThreadClient) {
gThreadClient = aThreadClient;
test_second_child_skip_breakpoint();
});
});
do_test_pending();
}
function test_second_child_skip_breakpoint()
{
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
let path = getFilePath('test_breakpoint-07.js');
let location = { url: path, line: gDebuggee.line0 + 6};
gThreadClient.setBreakpoint(location, function (aResponse, bpClient) {
// Check that the breakpoint has properly skipped forward one line.
do_check_eq(aResponse.actualLocation.url, location.url);
do_check_eq(aResponse.actualLocation.line, location.line + 1);
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
// Check the return value.
do_check_eq(aPacket.type, "paused");
do_check_eq(aPacket.frame.where.url, path);
do_check_eq(aPacket.frame.where.line, location.line + 1);
do_check_eq(aPacket.why.type, "breakpoint");
do_check_eq(aPacket.why.actors[0], bpClient.actor);
// Check that the breakpoint worked.
do_check_eq(gDebuggee.a, 1);
do_check_eq(gDebuggee.b, undefined);
// Remove the breakpoint.
bpClient.remove(function (aResponse) {
gThreadClient.resume(function () {
finishClient(gClient);
});
});
});
// Continue until the breakpoint is hit.
gThreadClient.resume();
});
});
gDebuggee.eval("var line0 = Error().lineNumber;\n" +
"function foo() {\n" + // line0 + 1
" bar();\n" + // line0 + 2
"}\n" + // line0 + 3
"function bar() {\n" + // line0 + 4
" this.a = 1;\n" + // line0 + 5
" // A comment.\n" + // line0 + 6
" this.b = 2;\n" + // line0 + 7
"}\n" + // line0 + 8
"debugger;\n" + // line0 + 9
"foo();\n"); // line0 + 10
}
|
// @flow
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
import { ReducerRegistry } from '../redux';
import { USER_INTERACTION_RECEIVED } from './actionTypes';
ReducerRegistry.register('features/base/user-interaction', (state = {}, action) => {
switch (action.type) {
case APP_WILL_MOUNT:
case APP_WILL_UNMOUNT:
return {
...state,
interacted: false
};
case USER_INTERACTION_RECEIVED:
return {
...state,
interacted: true
};
}
return state;
});
|
// Copyright 2013 Selenium committers
// Copyright 2013 Software Freedom Conservancy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities for working with the browser window extension bar.
*/
goog.provide('safaridriver.extension.bar');
/**
* Sets the message to display to the user in the extension bar.
* @param {string} message The message text.
* @param {string=} opt_color The message color; defaults to black.
*/
safaridriver.extension.bar.setUserMessage = function(message, opt_color) {
var color = opt_color || 'black';
if (message.length > 75) {
message = message.substring(0, 75) + '...';
}
var bars = safari.extension.bars;
for (var i = 0, n = bars.length; i < n; ++i) {
var bar = bars[i];
var msgEl = bar.contentWindow.document.getElementById('message');
if (msgEl) {
msgEl.innerText = message;
msgEl.style.color = color;
}
}
};
|
/**
* @license
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
CLASS({
package: 'foam.ui',
name: 'CSSTransition',
requires: [
'foam.ui.CSSFunction',
'foam.ui.CSSTime',
],
properties: [
{
type: 'String',
name: 'property',
defaultValue: 'all',
required: true,
},
{
name: 'duration',
defaultValue: null,
},
{
name: 'timingFunction',
defaultValue: null,
},
{
name: 'delay',
defaultValue: null,
},
{
name: 'regExStr',
lazyFactory: function() {
var t = this.CSSTime.create().REG_EX_STR;
var f = this.CSSFunction.create().regExStr;
return '([a-zA-Z_-]+)\\s*(' + t + ')\\s*(' + f + ')?' + '(' + t + ')?';
},
},
],
methods: [
function fromString(s) {
var match = this.fromString_(s);
if ( ! match ) return null;
this.property = match[1];
this.duration = this.CSSTime.create().fromString(match[2]);
this.timingFunction = this.CSSFunction.create().fromString(match[7]);
return this;
},
function fromString_(s) {
var re = new RegExp('^' + this.regExStr + '$', 'gi');
return re.exec(s);
},
function toString() {
var seq = [this.property.toString(), this.duration.toString()];
if ( this.timingFunction ) seq.push(this.timingFunction.toString());
if ( this.delay ) seq.push(this.delay.toString());
return seq.join(' ');
},
],
});
|
/*
* Copyright 2021 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function spinny(element) {
$(element).update(' ');
$(element).addClassName('spinny');
}
function removeSpinny(element) {
$(element).removeClassName('spinny');
}
function showElement(ele,show){
if(show) ele.show();
else ele.hide();
}
function goToUrl(url) {
window.location = window.location.protocol + '//' + window.location.host + url;
}
function redirectToLoginPage(url) {
goToUrl(url);
}
|
define({
root: ({
}),
es: true,
it: true,
ru: true,
tr: true,
"zh-cn": true
});
|
(function() {
function Message($firebaseArray) {
var ref = firebase.database().ref().child("messages");
var messages = $firebaseArray(ref);
return {
getByRoomId: function(roomId) {
return $firebaseArray(ref.orderByChild('roomId').equalTo(roomId));
}
};
}
angular
.module('blocChat')
.factory('Message', ['$firebaseArray', Message]);
})();
|
// get the sample user connection
var connectionId = "cmis-sample-connection"
var cmisConnection = cmis.getConnection(connectionId)
if (cmisConnection == null) {
// if no connection exists, talk to the local server
cmisConnection = cmis.getConnection()
}
// get CMIS session
var cmisSession = cmisConnection.getSession();
model.cmisSession = cmisSession;
model.baseTypes = cmisSession.getTypeChildren(null, false).iterator();
if (args.id == null)
{
model.folder = cmisSession.getRootFolder();
}
else
{
model.folder = cmisSession.getObject(args.id);
}
model.connection = cmisConnection;
var operationContext = cmisSession.createOperationContext();
operationContext.setRenditionFilterString("cmis:thumbnail");
model.children = model.folder.getChildren(operationContext).iterator();
|
define(
//begin v1.x content
{
"KES_symbol": "Ksh",
"USD_displayName": "Ndola ya Marekani",
"TZS_displayName": "Silingi ya Tanzania",
"ZMW_displayName": "Kwacha ya Zambia",
"MAD_displayName": "Dirham ya Moroko",
"NGN_displayName": "Naira ya Nijeria",
"ZWD_displayName": "Ndola ya Zimbabwe",
"SDG_displayName": "Vaũndi ya Sudani",
"MWK_displayName": "Kwacha ya Malawi",
"KMF_displayName": "Faranga ya Komoro",
"SCR_displayName": "Rupia ya Shelisheli",
"EGP_displayName": "Vaundi ya Misili",
"CVE_displayName": "Eskudo ya Kepuvede",
"LYD_displayName": "Dinari ya Libya",
"CAD_displayName": "Ndola ya Kanada",
"INR_displayName": "Rupia ya India",
"JPY_displayName": "Sarafu ya Kijapani",
"LRD_displayName": "Dola ya Liberia",
"ZAR_displayName": "Randi ya Afrika Kusini",
"AOA_displayName": "Kwanza ya Angola",
"TND_displayName": "Ndinari ya Tunisia",
"GHC_displayName": "Sedi ya Ghana",
"BWP_displayName": "Pula ya Botswana",
"DZD_displayName": "Dinari ya Aljeria",
"ZMK_displayName": "Kwacha ya Zambia (1968-2012)",
"NAD_displayName": "Ndola ya Namibia",
"AED_displayName": "Dirham ya Falme za Kiarabu",
"ETB_displayName": "Bir ya Uhabeshi",
"MZM_displayName": "Metikali ya Msumbiji",
"BIF_displayName": "Faranga ya Burundi",
"RWF_displayName": "Faranga ya Rwanda",
"STD_displayName": "Dobra ya Sao Tome na Principe",
"SZL_displayName": "Lilangeni",
"EUR_displayName": "Yuro",
"ERN_displayName": "Nakfa ya Eritrea",
"SAR_displayName": "Riyal ya Saudia",
"DJF_displayName": "Faranga ya Jibuti",
"CDF_displayName": "Faranga ya Kongo",
"GBP_displayName": "Pauni ya Uingereza",
"CHF_displayName": "Faranga ya Uswisi",
"MUR_displayName": "Rupia ya Morisi",
"SOS_displayName": "Silingi ya Somalia",
"BHD_displayName": "Dinari ya Bahareni",
"XOF_displayName": "Faranga CFA BCEAO",
"GNS_displayName": "Faranga ya Gine",
"SLL_displayName": "Leoni",
"UGX_displayName": "Silingi ya Uganda",
"MGA_displayName": "Ariary ya Bukini",
"AUD_displayName": "Ndola ya Australia",
"KES_displayName": "Silingi ya Kenya",
"SHP_displayName": "Vaũndi ya Santahelena",
"XAF_displayName": "Faranga CFA BEAC",
"LSL_displayName": "Loti ya Lesoto",
"MRO_displayName": "Ugwiya ya Moritania",
"CNY_displayName": "Yuan Renminbi ya China",
"GMD_displayName": "Ndalasi ya Gambia"
}
//end v1.x content
);
|
/*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
import * as ActionTypes from '../constants/action-types';
import * as PagesSelectors from '../selectors/pages';
export function createPage(id, location, options) {
return {
type: ActionTypes.CREATE_PAGE,
id,
location,
options,
};
}
export function removePage(pageId) {
return {
type: ActionTypes.REMOVE_PAGE,
pageId,
};
}
export function setSelectedPage(pageId) {
return {
type: ActionTypes.SET_SELECTED_PAGE,
pageId,
};
}
export function setSelectedPageIndex(pageIndex) {
return (dispatch, getState) => {
dispatch(setSelectedPage(PagesSelectors.getPageIdByIndex(getState(), pageIndex)));
};
}
export function setSelectedPagePrevious() {
return (dispatch, getState) => {
const selectedIndex = PagesSelectors.getSelectedPageIndex(getState());
// Immutable handles looping for us via negative indexes.
const prevIndex = selectedIndex - 1;
dispatch(setSelectedPageIndex(prevIndex));
};
}
export function setSelectedPageNext() {
return (dispatch, getState) => {
const selectedIndex = PagesSelectors.getSelectedPageIndex(getState());
const pageCount = PagesSelectors.getPageCount(getState());
// Manually handle looping when going out of bounds rightward.
const nextIndex = selectedIndex === pageCount - 1 ? 0 : selectedIndex + 1;
dispatch(setSelectedPageIndex(nextIndex));
};
}
export function resetPageData(pageId) {
return {
type: ActionTypes.RESET_PAGE_DATA,
pageId,
};
}
export function setPageIndex(pageId, pageIndex) {
return {
type: ActionTypes.SET_PAGE_INDEX,
pageId,
pageIndex,
};
}
export function setPageDetails(pageId, pageDetails) {
return {
type: ActionTypes.SET_PAGE_DETAILS,
pageId,
pageDetails,
};
}
export function setPageMeta(pageId, pageMeta) {
return {
type: ActionTypes.SET_PAGE_META,
pageId,
pageMeta,
};
}
export function setPageState(pageId, pageState) {
return {
type: ActionTypes.SET_PAGE_STATE,
pageId,
pageState,
};
}
export function setPageUIState(pageId, pageUIState) {
return {
type: ActionTypes.SET_PAGE_UI_STATE,
pageId,
pageUIState,
};
}
export function preventInteractionForPage(pageId) {
return setPageUIState(pageId, { preventInteraction: true });
}
export function allowInteractionForPage(pageId) {
return setPageUIState(pageId, { preventInteraction: false });
}
export function setPagePinned(pageId) {
return (dispatch, getState) => {
// When there's no pinned pages, the "last pinned page index" will be -1.
const lastIndex = PagesSelectors.getLastPinnedPageIndex(getState());
dispatch(setPageIndex(pageId, lastIndex + 1));
// Set the `pinned` state *last*, so that the above selector
// actually does what we want.
dispatch(setPageUIState(pageId, { pinned: true }));
};
}
export function setPageUnpinned(pageId) {
return (dispatch, getState) => {
// When there's no pinned pages, the "last pinned page index" will be -1.
const lastIndex = PagesSelectors.getLastPinnedPageIndex(getState());
dispatch(setPageIndex(pageId, lastIndex));
// Set the `pinned` state *last*, so that the above selector
// actually does what we want.
dispatch(setPageUIState(pageId, { pinned: false }));
};
}
export function showPageSearch(pageId) {
return dispatch => {
dispatch(setPageUIState(pageId, { searchVisible: true }));
dispatch(setPageUIState(pageId, { searchFocused: true }));
};
}
export function hidePageSearch(pageId) {
return dispatch => {
dispatch(setPageUIState(pageId, { searchVisible: false }));
dispatch(setPageUIState(pageId, { searchFocused: false }));
};
}
export function showCurrentPageSearch() {
return (dispatch, getState) => {
dispatch(showPageSearch(PagesSelectors.getSelectedPageId(getState())));
};
}
export function hideCurrentPageSearch() {
return (dispatch, getState) => {
dispatch(hidePageSearch(PagesSelectors.getSelectedPageId(getState())));
};
}
export function setLocalPageHistory(pageId, history, historyIndex) {
return {
type: ActionTypes.SET_LOCAL_PAGE_HISTORY,
pageId,
history,
historyIndex,
};
}
export function popRecentlyClosedPage() {
return {
type: ActionTypes.POP_RECENTLY_CLOSED_PAGE,
};
}
export function saveRestorablePage(pageId, sessionId) {
return {
type: ActionTypes.SAVE_RESTORABLE_PAGE,
pageId,
sessionId,
};
}
|
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import { settings } from 'carbon-components';
const { prefix } = settings;
export default class TagSkeleton extends React.Component {
render() {
return <span className={`${prefix}--tag ${prefix}--skeleton`} />;
}
}
|
/* TODO: CLEAN THIS SHIT UP
*
**/
function setupVoteClickHandlers() {
/**
* Assign click handlers to all voting buttons.
*/
$('.vote').click(function() {
var quote_id = $(this).data('quote_id');
var direction = '';
if($(this).attr('class').indexOf('down') >= 0) {
direction = 'down';
} else {
direction = 'up';
}
if($(this).attr('class').indexOf('voted') >= 0) {
annulVote(quote_id, direction, this);
} else {
castVote(quote_id, direction, this);
}
});
}
function castVote(quote_id, direction, button) {
$.ajax({
url: '/api/v1/quotes/'+quote_id+'/vote/'+direction,
type: 'POST',
success: function(data, status, jqXHR){
$(button).addClass(data['status'] + ' voted');
changeScoreCount(button, direction, false);
}
});
}
function annulVote(quote_id, direction, button) {
$.ajax({
url: '/api/v1/quotes/'+quote_id+'/vote/'+direction,
type: 'DELETE',
success: function(data, status, jqXHR){
$(button).removeClass('success error voted');
changeScoreCount(button, direction, true);
}
});
}
function changeScoreCount(button, direction, cancelVote) {
if(direction == 'up') {
var scorefield = $(button).next();
var score = parseInt(scorefield.html());
if(cancelVote === true) {
scorefield.html(score - 1);
var upvotes = parseInt($(button).attr('title')) - 1 + ' upvote';
} else {
if($(button).next().next().attr('class').indexOf('voted') > -1) {
// quote has already been downvoted, remove that downvote
$(button).next().next().removeClass('voted success error');
scorefield.html(score + 2);
} else {
scorefield.html(score + 1);
}
var upvotes = parseInt($(button).attr('title')) + 1 + ' upvote';
}
if(parseInt(upvotes) !== 1) {
upvotes += 's';
}
$(button).attr('title', upvotes);
} else {
var scorefield = $(button).prev();
var score = parseInt(scorefield.html());
if(cancelVote === true) {
scorefield.html(score + 1);
var downvotes = parseInt($(button).attr('title')) - 1 + ' downvote';
} else {
if($(button).prev().prev().attr('class').indexOf('voted') > -1) {
// quote has already been upvoted, remove that upvote
$(button).prev().prev().removeClass('voted success error');
scorefield.html(score - 2);
} else {
scorefield.html(score - 1);
}
var downvotes = parseInt($(button).attr('title')) + 1 + ' downvote';
}
if(parseInt(downvotes) !== 1) {
downvotes += 's';
}
$(button).attr('title', downvotes);
}
}
|
var echarts = require("../echarts");
var zrUtil = require("zrender/lib/core/util");
var axisPointerModelHelper = require("./axisPointer/modelHelper");
var axisTrigger = require("./axisPointer/axisTrigger");
require("./axisPointer/AxisPointerModel");
require("./axisPointer/AxisPointerView");
require("./axisPointer/CartesianAxisPointer");
// CartesianAxisPointer is not supposed to be required here. But consider
// echarts.simple.js and online build tooltip, which only require gridSimple,
// CartesianAxisPointer should be able to required somewhere.
echarts.registerPreprocessor(function (option) {
// Always has a global axisPointerModel for default setting.
if (option) {
(!option.axisPointer || option.axisPointer.length === 0) && (option.axisPointer = {});
var link = option.axisPointer.link; // Normalize to array to avoid object mergin. But if link
// is not set, remain null/undefined, otherwise it will
// override existent link setting.
if (link && !zrUtil.isArray(link)) {
option.axisPointer.link = [link];
}
}
}); // This process should proformed after coordinate systems created
// and series data processed. So put it on statistic processing stage.
echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) {
// Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
// allAxesInfo should be updated when setOption performed.
ecModel.getComponent('axisPointer').coordSysAxesInfo = axisPointerModelHelper.collect(ecModel, api);
}); // Broadcast to all views.
echarts.registerAction({
type: 'updateAxisPointer',
event: 'updateAxisPointer',
update: ':updateAxisPointer'
}, axisTrigger);
|
var searchData=
[
['num_5fof_5fetalon',['NUM_OF_ETALON',['../analizer_8h.html#a39d05713f9a15de04077b8bea7b13f44',1,'analizer.h']]],
['num_5fof_5fled',['NUM_OF_LED',['../analizer_8h.html#a2bdaf37b88fc3b0920fffa2b6166be22',1,'analizer.h']]],
['num_5fof_5fpoints',['NUM_OF_POINTS',['../analizer_8h.html#a864b43588aed04ef9d694ec60ef7a9f1',1,'analizer.h']]]
];
|
/**
* Copyright 2014 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var assert = require('assert');
var googleapis = require('../lib/googleapis.js');
var google, drive, authClient, OAuth2;
describe('Query params', function() {
function noop() {}
beforeEach(function() {
google = new googleapis.GoogleApis();
OAuth2 = google.auth.OAuth2;
authClient = new OAuth2('CLIENT_ID', 'CLIENT_SECRET', 'REDIRECT_URL');
authClient.setCredentials({ access_token: 'abc123' });
drive = google.drive('v2');
});
it('should not append ? with no query parameters', function() {
var uri = drive.files.get({ fileId: 'ID' }, noop).uri;
assert.equal(-1, uri.href.indexOf('?'));
});
it('should be null if no object passed', function() {
var req = drive.files.list(noop);
assert.equal(req.uri.query, null);
});
it('should be null if params passed are in path', function() {
var req = drive.files.get({ fileId: '123' }, noop);
assert.equal(req.uri.query, null);
});
it('should be set if params passed are optional query params', function() {
var req = drive.files.get({ fileId: '123', updateViewedDate: true }, noop);
assert.equal(req.uri.query, 'updateViewedDate=true');
});
it('should be set if params passed are unknown params', function() {
var req = drive.files.get({ fileId: '123', madeThisUp: 'hello' }, noop);
assert.equal(req.uri.query, 'madeThisUp=hello');
});
it('should chain together with & in order', function() {
var req = drive.files.get({
fileId: '123',
madeThisUp: 'hello',
thisToo: 'world'
}, noop);
assert.equal(req.uri.query, 'madeThisUp=hello&thisToo=world');
});
it('should not include auth if auth is an OAuth2Client object', function() {
var req = drive.files.get({
fileId: '123',
auth: authClient
}, noop);
assert.equal(req.uri.query, null);
});
});
|
/**
* All channels used by angular's WebWorker components are listed here.
* You should not use these channels in your application code.
*/
export const SETUP_CHANNEL = "ng-WebWorkerSetup";
export const RENDERER_CHANNEL = "ng-Renderer";
export const XHR_CHANNEL = "ng-XHR";
export const EVENT_CHANNEL = "ng-events";
//# sourceMappingURL=messaging_api.js.map
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"ERANAMES": [
"Before Christ",
"Anno Domini"
],
"ERAS": [
"BC",
"AD"
],
"FIRSTDAYOFWEEK": 6,
"MONTH": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"SHORTDAY": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],
"SHORTMONTH": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"STANDALONEMONTH": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE, d MMMM y",
"longDate": "dd MMMM y",
"medium": "dd MMM y HH:mm:ss",
"mediumDate": "dd MMM y",
"mediumTime": "HH:mm:ss",
"short": "dd/MM/y HH:mm",
"shortDate": "dd/MM/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-\u00a4",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "en-mt",
"localeID": "en_MT",
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
export function timeout(duration = 0) {
return new Promise((resolve, reject) => {
setTimeout(resolve, duration);
})
}
|
/* Copyright (C) 2012, Code for America
* This is open source software, released under a standard 2-clause
* BSD-style license; see the file LICENSE for details.
*/
var ConfigBoston2 = {
center: [42.36299, -71.057348], // [lat, lon]
zoom: 13, // integer
endpoint: 'boston', // string
useCanvasMap: true,
maxMarkers: 1000,
title: 'Boston', // string
boundaryTitle: 'Neighborhood',
description: "Service requests available through the city's Open311 API.",
statusSelectorValues: {opened: true, closed: true, open: true}
};
|
/*
* Package: message.js
*
* Namespace: bbop.widget.message
*
* TODO: Code needs to be cleaned with <bbop.html>.
*
* BBOP object to produce a self-constructing/self-destructing
* sliding message/announcments/warnings.
*
* Note that this is a steal of some older code. We'll probably have
* to clean this up a bit at some point.
*
* These messages make use of the classes "bbop-js-message" and
* "bbop-js-message-CTYPE", where CTYPE is one of "error",
* "warning", or "notice".
*
* Initial placement and the likes should be manipulated through
* "bbop-js-message"--the created divs are append to the end of
* the body and will not be particularly useful unless styled.
*
* This is a completely self-contained UI.
*/
if ( typeof bbop == "undefined" ){ var bbop = {}; }
if ( typeof bbop.widget == "undefined" ){ bbop.widget = {}; }
/*
* Constructor: message
*
* Contructor for the bbop.widget.message object.
*
* A trivial invocation might be something like:
* : var m = new bbop.widget.message();
* : m.notice("Hello, World!");
*
* Arguments:
* n/a
*
* Returns:
* self
*/
bbop.widget.message = function(){
this._is_a = 'bbop.widget.message';
var anchor = this;
// Per-UI logger.
var logger = new bbop.logger();
logger.DEBUG = true;
function ll(str){ logger.kvetch('W (message): ' + str); }
// Generate tags.
function _generate_element(ctype, str){
var message_classes = ['bbop-js-message',
'bbop-js-message-' + ctype];
var message_elt =
new bbop.html.tag('div',
{'generate_id': true,
'class': message_classes.join(' ')},
'<h2>' + str + '</h2>');
jQuery("body").append(jQuery(message_elt.to_string()).hide());
// jQuery-ify the element.
var elt = jQuery('#' + message_elt.get_id());
return elt;
}
// Destroy tags.
function _destroy_element(){
jQuery(this).remove();
}
///
/// Notice and error handling.
///
// elt.show().fadeIn('slow').fadeOut('slow', _destroy_element);
/*
* Function: notice
*
* Temporarily display a messsage styled for notices.
*
* Parameters:
* msg - the message
*
* Returns
* n/a
*/
this.notice = function(msg){
var elt = _generate_element('notice', msg);
elt.show().slideDown('slow').slideUp('slow', _destroy_element);
};
/*
* Function: warning
*
* Temporarily display a messsage styled for warnings.
*
* Parameters:
* msg - the message
*
* Returns
* n/a
*/
this.warning = function(msg){
var elt = _generate_element('warning', msg);
elt.show().slideDown('slow').slideUp('slow', _destroy_element);
};
/*
* Function: error
*
* Temporarily display a messsage styled for errors.
*
* Parameters:
* msg - the message
*
* Returns
* n/a
*/
this.error = function(msg){
var elt = _generate_element('error', msg);
elt.show().fadeTo(2500, 0.9).fadeOut(1000, _destroy_element);
};
};
|
// Copyright (C) 2014, Microsoft Corporation. All rights reserved.
// This code is governed by the BSD License found in the LICENSE file.
module.exports = JSShellRunner;
var fs = require('fs');
var cp = require('child_process');
var ConsoleRunner = require('./console');
var counter = 0;
function JSShellRunner(args) {
args.consolePrintCommand = args.consolePrintCommand || "print";
ConsoleRunner.apply(this, arguments);
}
JSShellRunner.prototype = Object.create(ConsoleRunner.prototype);
JSShellRunner.prototype._createEnv = 'newGlobal()';
JSShellRunner.prototype._runBatched = 'env.evaluate(test);'
|
var chai = require('chai');
var sinon = require('sinon');
var chrome = require('sinon-chrome');
var expect = chai.expect;
describe('Chrome Dev Tools', function() {
it('should work', function() {
chrome.browserAction.setTitle({title: 'hello'});
sinon.assert.calledOnce(chrome.browserAction.setTitle);
});
});
|
/* global expect */
import { forumLocation } from '../../../../../config/env.json';
const { getGuideUrl } = require('./');
describe('index', () => {
describe('getGuideUrl', () => {
it('should use forum topic url when forumTopicId is supplied', () => {
const value = getGuideUrl({
forumTopicId: 12345,
title: 'a sample title'
});
expect(value).toEqual(`${forumLocation}/t/12345`);
});
it('should use search endpoint when no forumTopicId is supplied', () => {
const value = getGuideUrl({
title: '& a sample title?'
});
expect(value).toEqual(
`${forumLocation}/search?q=%26%20a%20sample%20title%3F%20in%3Atitle%20order%3Aviews`
);
});
});
});
|
var structarm__fir__decimate__instance__q31 =
[
[ "M", "structarm__fir__decimate__instance__q31.html#ad3d6936c36303b30dd38f1eddf248ae5", null ],
[ "numTaps", "structarm__fir__decimate__instance__q31.html#a37915d42b0dc5e3057ebe83110798482", null ],
[ "pCoeffs", "structarm__fir__decimate__instance__q31.html#a030d0391538c2481c5b348fd09a952ff", null ],
[ "pState", "structarm__fir__decimate__instance__q31.html#a0ef0ef9e265f7ab873cfc6daa7593fdb", null ]
];
|
/*global require, module*/
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
webpackConfig.plugins = webpackConfig.plugins || [];
webpackConfig.plugins.push(new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}));
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-karma');
grunt.initConfig({
webpack: {
options: webpackConfig,
build: {}
},
karma: {
singleRun: {
configFile: 'karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('build', ['webpack:build']);
grunt.registerTask('test', ['karma:singleRun']);
grunt.registerTask('default', ['build', 'test']);
};
|
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {accumulateEnterLeaveDispatches} from 'events/EventPropagators';
import {
TOP_MOUSE_OUT,
TOP_MOUSE_OVER,
TOP_POINTER_OUT,
TOP_POINTER_OVER,
} from './DOMTopLevelEventTypes';
import SyntheticMouseEvent from './SyntheticMouseEvent';
import SyntheticPointerEvent from './SyntheticPointerEvent';
import {
getClosestInstanceFromNode,
getNodeFromInstance,
} from '../client/ReactDOMComponentTree';
const eventTypes = {
mouseEnter: {
registrationName: 'onMouseEnter',
dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER],
},
mouseLeave: {
registrationName: 'onMouseLeave',
dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER],
},
pointerEnter: {
registrationName: 'onPointerEnter',
dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER],
},
pointerLeave: {
registrationName: 'onPointerLeave',
dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER],
},
};
const EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*/
extractEvents: function(
topLevelType,
targetInst,
nativeEvent,
nativeEventTarget,
) {
const isOverEvent =
topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
const isOutEvent =
topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (!isOutEvent && !isOverEvent) {
// Must not be a mouse or pointer in or out - ignoring.
return null;
}
let win;
if (nativeEventTarget.window === nativeEventTarget) {
// `nativeEventTarget` is probably a window object.
win = nativeEventTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
const doc = nativeEventTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
let from;
let to;
if (isOutEvent) {
from = targetInst;
const related = nativeEvent.relatedTarget || nativeEvent.toElement;
to = related ? getClosestInstanceFromNode(related) : null;
} else {
// Moving to a node from outside the window.
from = null;
to = targetInst;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
let eventInterface, leaveEventType, enterEventType, eventTypePrefix;
if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
eventInterface = SyntheticMouseEvent;
leaveEventType = eventTypes.mouseLeave;
enterEventType = eventTypes.mouseEnter;
eventTypePrefix = 'mouse';
} else if (
topLevelType === TOP_POINTER_OUT ||
topLevelType === TOP_POINTER_OVER
) {
eventInterface = SyntheticPointerEvent;
leaveEventType = eventTypes.pointerLeave;
enterEventType = eventTypes.pointerEnter;
eventTypePrefix = 'pointer';
}
const fromNode = from == null ? win : getNodeFromInstance(from);
const toNode = to == null ? win : getNodeFromInstance(to);
const leave = eventInterface.getPooled(
leaveEventType,
from,
nativeEvent,
nativeEventTarget,
);
leave.type = eventTypePrefix + 'leave';
leave.target = fromNode;
leave.relatedTarget = toNode;
const enter = eventInterface.getPooled(
enterEventType,
to,
nativeEvent,
nativeEventTarget,
);
enter.type = eventTypePrefix + 'enter';
enter.target = toNode;
enter.relatedTarget = fromNode;
accumulateEnterLeaveDispatches(leave, enter, from, to);
return [leave, enter];
},
};
export default EnterLeaveEventPlugin;
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
'use strict';
const glob = require('glob');
const path = require('path');
/**
* Find the main file for the C# project
*
* @param {String} folder Name of the folder where to seek
* @return {String}
*/
module.exports = function findMainFile(folder) {
let mainFilePath = glob.sync('MainReactNativeHost.cs', {
cwd: folder,
ignore: ['node_modules/**', '**/build/**', 'Examples/**', 'examples/**'],
});
if (mainFilePath.length === 0) {
mainFilePath = glob.sync('MainPage.cs', {
cwd: folder,
ignore: ['node_modules/**', '**/build/**', 'Examples/**', 'examples/**'],
});
}
return mainFilePath && mainFilePath.length > 0 ? path.join(folder, mainFilePath[0]) : null;
};
|
module.exports = {
settings: {
},
commands: {
},
};
|
var fs = require('fs');
var pkg = require('../package.json');
console.log('Creating dist/js-data-debug.js...');
var file = fs.readFileSync('dist/js-data-debug.js', { encoding: 'utf-8' });
var lines = file.split('\n');
var newLines = [];
lines.forEach(function (line) {
if (line.indexOf('logFn(') === -1) {
newLines.push(line);
}
});
file = newLines.join('\n');
file += '\n';
fs.writeFileSync('dist/js-data.js', file, { encoding: 'utf-8' });
console.log('Done!');
|
// "Borrowed" from node-inspector
var CallbackHandler = {
/**
* Create a callback container
* @return {Object} that wraps callbacks and returns a one-time id.
*/
create: function () {
var lastId = 1,
callbacks = {}
return Object.create({}, {
wrap: {
value: function (callback) {
var callbackId = lastId++
callbacks[callbackId] = callback || function () {
}
return callbackId
}
},
processResponse: {
value: function (callbackId, args) {
var callback = callbacks[callbackId]
if (callback) {
callback.apply(null, args)
}
delete callbacks[callbackId]
}
},
removeResponseCallbackEntry: {
value: function (callbackId) {
delete callbacks[callbackId]
}
}
})
}
}
var Net = require('net'),
Protocol = require('_debugger').Protocol,
inherits = require('util').inherits,
EventEmitter = require('events').EventEmitter,
debugProtocol = require('debug')('node-inspector:protocol:v8-debug'),
callbackHandler = CallbackHandler.create()
/**
* @param {Number} port
*/
function Debugger(port) {
this._port = port
this._connected = false
this._connection = null
this._lastError = null
this._setupConnection()
}
inherits(Debugger, EventEmitter)
Object.defineProperties(Debugger.prototype, {
/** @type {boolean} */
isRunning: {writable: true, value: true},
/** @type {boolean} */
connected: {
get: function () {
return this._connected
}
}
})
Debugger.prototype._setupConnection = function () {
var connection = Net.createConnection(this._port),
protocol = new Protocol()
protocol.onResponse = this._processResponse.bind(this)
connection
.on('connect', this._onConnectionOpen.bind(this))
.on('data', protocol.execute.bind(protocol))
.on('error', this._onConnectionError.bind(this))
.on('end', this.close.bind(this))
.on('close', this._onConnectionClose.bind(this))
.setEncoding('utf8')
this._connection = connection
}
Debugger.prototype._onConnectionOpen = function () {
this._connected = true
this.emit('connect')
}
/**
* @param {Error} err
*/
Debugger.prototype._onConnectionError = function (err) {
if (err.code == 'ECONNREFUSED') {
err.helpString = 'Is node running with --debug port ' + this._port + '?'
} else if (err.code == 'ECONNRESET') {
err.helpString = 'Check there is no other debugger client attached to port ' + this._port + '.'
}
this._lastError = err.toString()
if (err.helpString) {
this._lastError += '. ' + err.helpString
}
this.emit('error', err)
}
Debugger.prototype._onConnectionClose = function (hadError) {
this.emit('close', hadError ? this._lastError : 'Debugged process exited.')
this._port = null
this._connected = false
this._connection = null
this._lastError = null
}
Debugger.prototype._processResponse = function (message) {
var obj = message.body
if (typeof obj.running === 'boolean') {
this.isRunning = obj.running
}
if (obj.type === 'response' && obj.request_seq > 0) {
debugProtocol('response: ' + JSON.stringify(message.body))
callbackHandler.processResponse(obj.request_seq, [obj])
} else if (obj.type === 'event') {
debugProtocol('event: ' + JSON.stringify(message.body))
if (['break', 'exception'].indexOf(obj.event) > -1) {
this.isRunning = false
}
this.emit(obj.event, obj)
} else {
debugProtocol('unknown: ' + JSON.stringify(message.body))
}
}
/**
* @param {string} data
*/
Debugger.prototype.send = function (data) {
debugProtocol('request: ' + data)
if (this.connected) {
this._connection.write('Content-Length: ' + Buffer.byteLength(data, 'utf8') + '\r\n\r\n' + data)
}
}
/**
* @param {string} command
* @param {Object} params
* @param {function} callback
*/
Debugger.prototype.request = function (command, params, callback) {
var message = {
seq: 0,
type: 'request',
command: command
}
if (typeof callback === 'function') {
message.seq = callbackHandler.wrap(callback)
}
if (params) {
Object.keys(params).forEach(function (key) {
message[key] = params[key]
})
}
this.send(JSON.stringify(message))
}
/**
*/
Debugger.prototype.close = function () {
this._connection.end()
}
module.exports = function (debugPort, callback) {
// give the process time to start up
setTimeout(function () {
var debuggerClient = new Debugger(debugPort)
debuggerClient.on('error', callback)
debuggerClient.on('connect', function () {
debuggerClient.request('continue', undefined, function (response) {
debuggerClient.close()
if (!response.success) return callback(new Error('Could not continue process'))
callback()
})
})
}, 1000)
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:a5b63c6dfd15dccd31cce53e9713057b4a280de478598a0046a6b1221e6564d0
size 42396
|
import baseCallback from '../internal/baseCallback';
import basePullAt from '../internal/basePullAt';
/**
* Removes all elements from `array` that `predicate` returns truthy for
* and returns an array of the removed elements. The predicate is bound to
* `thisArg` and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* **Note:** Unlike `_.filter`, this method mutates `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to modify.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the new array of removed elements.
* @example
*
* var array = [1, 2, 3, 4];
* var evens = _.remove(array, function(n) {
* return n % 2 == 0;
* });
*
* console.log(array);
* // => [1, 3]
*
* console.log(evens);
* // => [2, 4]
*/
function remove(array, predicate, thisArg) {
var result = [];
if (!(array && array.length)) {
return result;
}
var index = -1,
indexes = [],
length = array.length;
predicate = baseCallback(predicate, thisArg, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result;
}
export default remove;
|
var roundTrip = module.exports = require('azure-mobile-apps').table();
roundTrip.update(function (context) {
return context.execute()
.catch(function (error) {
if(context.req.query.conflictPolicy === 'clientWins') {
context.item.version = error.item.version;
return context.execute();
} else if (context.req.query.conflictPolicy === 'serverWins') {
return error.item;
} else {
throw error;
}
});
});
roundTrip.columns = { name: 'string', date1: 'date', bool: 'boolean', integer: 'number', number: 'number' };
roundTrip.dynamicSchema = false;
|
app.service('programmingLandingService', function ($http) {
//get user profile information
this.getGymObj = function (gymId) {
return $http({
method: 'GET',
url: 'api/gyms/pathway/' + gymId,
})
.then(function (response) {
return response.data;
});
};
this.getStages = function (pathwayObj) {
return $http({
method: 'POST',
url: 'api/gyms/stage',
data: pathwayObj
})
.then(function (response) {
return response.data;
});
};
this.getEvals = function (stageObj) {
return $http({
method: 'POST',
url: 'api/gyms/evaluations',
data: stageObj
})
.then(function (response) {
return response.data;
});
};
this.getEvalDetails = function (evalObj) {
return $http({
method: 'POST',
url: '/api/gyms/evaluation/specifics',
data: evalObj
})
.then(function (response) {
return response.data;
});
};
this.addEvalObj = function (evalObj) {
return $http({
method: 'POST',
url: '/api/gyms/add/evaluation',
data: evalObj
})
.then(function (response) {
return response;
});
};
this.editEvaluation = function (evalObj) {
return $http({
method: 'PUT',
url: '/api/gyms/edit/evaluation',
data: evalObj
})
.then(function (response) {
return response.data;
});
};
this.deleteEval = function (evalObj) {
return $http({
method: 'PUT',
url: '/api/gyms/removeById',
data: evalObj
})
.then(function (response) {
return response;
});
};
});
|
define({
"add": "Κάντε κλικ για προσθήκη νέου",
"title": "Τίτλος",
"placeholderBookmarkName": "Όνομα σελιδοδείκτη",
"ok": "ΟΚ",
"cancel": "Ακύρωση",
"warning": "Ολοκληρώστε την επεξεργασία!",
"edit": "Επεξεργασία σελιδοδείκτη",
"errorNameExist": "Ο σελιδοδείκτης υπάρχει!",
"errorNameNull": "Μη έγκυρο όνομα σελιδοδείκτη!",
"addBookmark": "Δημιουργία νέου",
"thumbnail": "Μικρογραφία",
"thumbnailHint": "Κάντε κλικ στην εικόνα για ενημέρωση",
"displayBookmarksAs": "Παρουσίαση σελιδοδεικτών ως",
"cards": "Κάρτες",
"list": "Λίστα",
"cardsTips": "Προβολή σε κάρτες",
"listTips": "Προβολή σε λίστα",
"makeAsDefault": "Καθορισμός ως προεπιλεγμένης ρύθμισης",
"default": "Προεπιλεγμένη ρύθμιση",
"editable": "Να επιτρέπεται η προσθήκη σελιδοδεικτών στο widget.",
"alwaysSync": "Παρουσίαση σελιδοδεικτών από διαδικτυακό χάρτη",
"configCustom": "Παρουσίαση εξατομικευμένων σελιδοδεικτών",
"import": "Εισαγωγή",
"create": "Δημιουργία",
"importTitle": "Εισαγωγή σελιδοδεικτών",
"importFromWeb": "Εισαγωγή σελιδοδεικτών από τον τρέχοντα διαδικτυακό χάρτη",
"selectAll": "Επιλογή όλων",
"noBookmarkInConfig": "Για να προσθέσετε σελιδοδείκτες, κάντε κλικ στην επιλογή «Εισαγωγή» ή στην επιλογή «Δημιουργία νέου».",
"noBookmarkInWebMap": "Δεν έχει διαμορφωθεί κανένας σελιδοδείκτης στον χάρτη.",
"extent": "Έκταση",
"saveExtent": "Αποθήκευση έκτασης χάρτη στον σελιδοδείκτη",
"savelayers": "Αποθήκευση ορατότητας θεματικού επιπέδου",
"withVisibility": "Με ορατότητα θεματικών επιπέδων",
"bookmark": "Σελιδοδείκτης",
"addBtn": "Προσθήκη",
"deleteBtn": "Διαγραφή",
"editBtn": "Επεξεργασία",
"dragReorderTip": "Πιέστε παρατεταμένα και σύρετε για αναδιάταξη.",
"deleteBtnTip": "Διαγραφή του σελιδοδείκτη",
"editBtnTip": "Επεξεργασία του σελιδοδείκτη"
});
|
const DrawCard = require('../../drawcard.js');
class BrothersRobes extends DrawCard {
setupCardAbilities() {
this.attachmentRestriction({ trait: 'The Seven' });
this.reaction({
when: {
onCardKneeled: event => event.card === this.parent
},
target: {
activePrompTitle: 'Select a location or attachment',
cardCondition: card => card.location === 'play area' && ['location', 'attachment'].includes(card.getType())
},
handler: context => {
this.untilEndOfPhase(ability => ({
match: context.target,
effect: ability.effects.blankExcludingTraits
}));
this.game.addMessage('{0} uses {1} to treat the text box of {2} as blank until the end of the phase',
context.player, this, context.target);
}
});
}
}
BrothersRobes.code = '10043';
module.exports = BrothersRobes;
|
module.exports = {
tests: {
unit: ['test/unit/helpers/**/*.coffee', 'test/unit/**/*.coffee'],
integration: ['test/integration/**/*.coffee']
},
helpers: ['test/unit/helpers/**/*.coffee'],
lib: ['lib/**/*.js']
};
|
var Tape = function() {
var pos = 0, tape = [0];
this.inc = function() { tape[pos]++; }
this.dec = function() { tape[pos]--; }
this.advance = function() { pos++; if (tape.length <= pos) tape.push(0); }
this.devance = function() { if (pos > 0) pos--; }
this.get = function() { return tape[pos]; }
}
var Brainfuck = function(text) {
var me = this;
me.code = "";
me.bracket_map = function(text) {
var leftstack = [];
var bm = {};
for (var i = 0, pc = 0; i < text.length; i++) {
var c = text.charAt(i);
if ("+-<>[].,".indexOf(c) === -1) continue;
if (c === '[') leftstack.push(pc);
if (c === ']' && leftstack.length > 0) {
var left = leftstack.pop();
bm[left] = pc;
bm[pc] = left;
}
me.code += c;
pc++;
}
return bm;
}(text);
me.run = function() {
var pc = 0;
var tape = new Tape();
var code = this.code;
var bm = this.bracket_map;
for (var pc = 0; pc < code.length; pc++)
switch(code[pc]) {
case '+': tape.inc(); break;
case '-': tape.dec(); break;
case '>': tape.advance(); break;
case '<': tape.devance(); break;
case '[': if (tape.get() == 0) pc = bm[pc]; break;
case ']': if (tape.get() != 0) pc = bm[pc]; break;
case '.': process.stdout.write(String.fromCharCode(tape.get()));
default:
}
};
}
var text = require('fs').readFileSync(process.argv[2]).toString();
var brainfuck = new Brainfuck(text);
brainfuck.run();
|
var Image = require('./image');
var imageFields = ["fieldname", "originalname", "encoding", "mimetype", "destination",
"filename", "path", "size"];
module.exports = {
create: function (req, cb) {
var newImage = new Image();
//go through array fields which are the fields that are
//given from mutler and are part of the schema
for (var i = 0; i < imageFields.length; i++) {
newImage[imageFields[i]] = req.file[imageFields[i]];
};
newImage.save(function(err, image) {
if(err) {
req.flash('error', "Error Creating Image");
cb(err);
}
cb(null, image);
});
}, //close create
get: function (id, cb) {
Image.findById(id, function(err, image) {
if(err) {
cb(err);
}
if (!image) {
var error= new Error("Image not found");
error.type="image";
error.http_code = 404;
error.arguments ={id: id};
error.message="Image not found";
cb(error);
}
cb(null, image);
});
},
all: function (cb) {
Image.find(function(err, images) {
if(err) {
cb(err);
}
cb(null, images);
});
},
put: function (req, cb) {
Image.findById(req.params.id, function(err, image) {
if(err) {
cb(err);
}
//go through array fields which are the fields that are
//given from mutler and are part of the schema
for (var i = 0; i < imageFields.length; i++) {
newImage[imageFields[i]] = req.file[imageFields[i]];
};
image.save(function(err, image) {
if(err) {
cb(err);
}
cb(null,image);
});
});
},
delete: function (id, cb) {
Image.remove({
_id: id
}, function(err) {
if(err) {
cb(err);
}
});
}
}
|
/**
* @desc notify()
* - http://notifyjs.com/ for examples / docs
*
* @param {Function} fn - the function to curry
* @param {Number} [len] - specifies the number of arguments needed to call the function
*
* @return {Function} - the curried function
*/
const url = '//rawgit.com/clearhead/clearhead/master/bower_components/notifyjs/dist/notify-combined.min.js';
let script = null;
function notify(...args) {
// only notify in debug mode
if (!/clearhead-debug=true/.test(document.cookie)) {
return;
}
// wait for jQuery
if (!window.jQuery) {
return setTimeout(notify.bind(this, ...args), 1000);
}
script = script || jQuery.getScript(url); // promise
script.done(function () {
jQuery.notify.call(jQuery, args.join(': '));
});
}
export default notify;
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"nt\u0254\u0301ng\u0254\u0301",
"mp\u00f3kwa"
],
"DAY": [
"eyenga",
"mok\u0254l\u0254 mwa yambo",
"mok\u0254l\u0254 mwa m\u00edbal\u00e9",
"mok\u0254l\u0254 mwa m\u00eds\u00e1to",
"mok\u0254l\u0254 ya m\u00edn\u00e9i",
"mok\u0254l\u0254 ya m\u00edt\u00e1no",
"mp\u0254\u0301s\u0254"
],
"FIRSTDAYOFWEEK": 0,
"MONTH": [
"s\u00e1nz\u00e1 ya yambo",
"s\u00e1nz\u00e1 ya m\u00edbal\u00e9",
"s\u00e1nz\u00e1 ya m\u00eds\u00e1to",
"s\u00e1nz\u00e1 ya m\u00ednei",
"s\u00e1nz\u00e1 ya m\u00edt\u00e1no",
"s\u00e1nz\u00e1 ya mot\u00f3b\u00e1",
"s\u00e1nz\u00e1 ya nsambo",
"s\u00e1nz\u00e1 ya mwambe",
"s\u00e1nz\u00e1 ya libwa",
"s\u00e1nz\u00e1 ya z\u00f3mi",
"s\u00e1nz\u00e1 ya z\u00f3mi na m\u0254\u030ck\u0254\u0301",
"s\u00e1nz\u00e1 ya z\u00f3mi na m\u00edbal\u00e9"
],
"SHORTDAY": [
"eye",
"ybo",
"mbl",
"mst",
"min",
"mtn",
"mps"
],
"SHORTMONTH": [
"yan",
"fbl",
"msi",
"apl",
"mai",
"yun",
"yul",
"agt",
"stb",
"\u0254tb",
"nvb",
"dsb"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "FrCD",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "ln-cd",
"pluralCat": function(n, opt_precision) { if (n >= 0 && n <= 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
/*!
* jQuery JavaScript Library v@VERSION
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: @DATE
*/
(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper window is present,
// execute the factory and get jQuery
// For environments that do not inherently posses a window with a document
// (such as Node.js), expose a jQuery-making factory as module.exports
// This accentuates the need for the creation of a real window
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//
|
'use strict';
const chalk = require('chalk');
const detect = require('detect-port-alt');
const getProcessForPort = require('./getProcessForPort');
function isRoot() {
return process.getuid && process.getuid() === 0;
}
function checkDetectPort(port, host) {
port = parseInt(port, 10) || 0;
return new Promise((resolve, reject) => {
detect(port, host, (err, _port) => {
if (err) {
reject(err);
} else {
if (port === _port) {
resolve(port);
} else {
let message = `目前 ${chalk.bold(port)} 端口被占用`;
if (
process.platform !== 'win32' &&
port < 1024 &&
!isRoot()
) {
message =
'`在1024以下的端口上运行服务器需要管理员权限`';
}
const existingProcess = getProcessForPort(port);
if (existingProcess) {
message += `,该端口使用情况:\n ${existingProcess}`;
}
reject({
message: chalk.yellow(message),
});
}
}
});
});
}
module.exports = checkDetectPort;
|
const middleware = {}
export default middleware
|
// Generated by CoffeeScript 1.3.3
(function() {
var nock, should, wd;
wd = require('../common/wd-with-cov');
nock = require('nock');
should = require('should');
describe("wd", function() {
return describe("unit", function() {
return describe("callback tests", function() {
var server;
server = null;
before(function(done) {
server = nock('http://127.0.0.1:5555').filteringRequestBody(/.*/, '*');
if (process.env.WD_COV == null) {
server.log(console.log);
}
server.post('/wd/hub/session', '*').reply(303, "OK", {
'Location': '/wd/hub/session/1234'
});
return done(null);
});
return describe("simplecallback empty returns", function() {
var browser;
browser = null;
describe("browser initialization", function() {
return it("should initialize browser", function(done) {
browser = wd.remote({
port: 5555
});
return browser.init({}, function(err) {
should.not.exist(err);
return done(null);
});
});
});
describe("simplecallback with empty return", function() {
return it("should get url", function(done) {
server.post('/wd/hub/session/1234/url', '*').reply(200, "");
return browser.get("www.google.com", function(err) {
should.not.exist(err);
return done(null);
});
});
});
describe("simplecallback with 200 OK", function() {
return it("should get url", function(done) {
server.post('/wd/hub/session/1234/url', '*').reply(200, "OK");
return browser.get("www.google.com", function(err) {
should.not.exist(err);
return done(null);
});
});
});
return describe("simplecallback with empty JSON data", function() {
return it("should get url", function(done) {
server.post('/wd/hub/session/1234/url', '*').reply(200, '{"sessionId":"1234","status":0,"value":{}}');
return browser.get("www.google.com", function(err) {
should.not.exist(err);
return done(null);
});
});
});
});
});
});
});
}).call(this);
|
'use strict';
const path = require('path');
const webpack = require('webpack');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
module.exports = {
bail : true,
entry : path.join(__dirname, 'src/main/main.js'),
target: 'electron-main',
output: {
path : path.join(__dirname, 'dist'),
filename : 'main.js',
publicPath : '/dist/',
libraryTarget: 'commonjs2'
},
resolve: {
modules : ['node_modules'],
extensions : ['.js'],
descriptionFiles: ['package.json']
},
externals: {
'7zip': '7zip'
},
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new CaseSensitivePathsPlugin()
],
node: {
__dirname : false,
__filename: false
}
};
|
//分页插件
/**
2014-08-05 ch
**/
(function($){
var ms = {
init:function(obj,args){
return (function(){
ms.fillHtml(obj,args);
ms.bindEvent(obj,args);
})();
},
//填充html
fillHtml:function(obj,args){
return (function(){
obj.empty();
//上一页
if(args.current > 1){
obj.append('<a href="javascript:;" class="prevPage">上一页</a>');
}else{
obj.remove('.prevPage');
obj.append('<span class="disabled">上一页</span>');
}
//中间页码
if(args.current != 1 && args.current >= 4 && args.pageCount != 4){
obj.append('<a href="javascript:;" class="tcdNumber">'+1+'</a>');
}
if(args.current-2 > 2 && args.current <= args.pageCount && args.pageCount > 5){
obj.append('<span>...</span>');
}
var start = args.current -2,end = args.current+2;
if((start > 1 && args.current < 4)||args.current == 1){
end++;
}
if(args.current > args.pageCount-4 && args.current >= args.pageCount){
start--;
}
for (;start <= end; start++) {
if(start <= args.pageCount && start >= 1){
if(start != args.current){
obj.append('<a href="javascript:;" class="tcdNumber">'+ start +'</a>');
}else{
obj.append('<span class="current">'+ start +'</span>');
}
}
}
if(args.current + 2 < args.pageCount - 1 && args.current >= 1 && args.pageCount > 5){
obj.append('<span>...</span>');
}
if(args.current != args.pageCount && args.current < args.pageCount -2 && args.pageCount != 4){
obj.append('<a href="javascript:;" class="tcdNumber">'+args.pageCount+'</a>');
}
//下一页
if(args.current < args.pageCount){
obj.append('<a href="javascript:;" class="nextPage">下一页</a>');
}else{
obj.remove('.nextPage');
obj.append('<span class="disabled">下一页</span>');
}
})();
},
//绑定事件
bindEvent:function(obj,args){
return (function(){
obj.on("click","a.tcdNumber",function(){
var current = parseInt($(this).text());
ms.fillHtml(obj,{"current":current,"pageCount":args.pageCount});
if(typeof(args.backFn)=="function"){
args.backFn(current);
}
});
//上一页
obj.on("click","a.prevPage",function(){
var current = parseInt(obj.children("span.current").text());
ms.fillHtml(obj,{"current":current-1,"pageCount":args.pageCount});
if(typeof(args.backFn)=="function"){
args.backFn(current-1);
}
});
//下一页
obj.on("click","a.nextPage",function(){
var current = parseInt(obj.children("span.current").text());
ms.fillHtml(obj,{"current":current+1,"pageCount":args.pageCount});
if(typeof(args.backFn)=="function"){
args.backFn(current+1);
}
});
})();
}
}
$.fn.createPage = function(options){
var args = $.extend({
pageCount : 10,
current : 1,
backFn : function(){}
},options);
ms.init(this,args);
}
})(jQuery);
//代码整理:懒人之家 www.lanrenzhijia.com
|
var optionValueKeyMarkdown = require('../markdown/js/properties/optionValueKey').body;
var optionValueKeyProp = {
nameAttr: "optionValueKey",
renderString: optionValueKeyMarkdown
};
module.exports = optionValueKeyProp;
|
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
module.exports = function () {
return {
sql: "CREATE TABLE [__types] ([table] TEXT, [name] TEXT, [type] TEXT)"
};
};
|
module.exports = {
description: 'auto-indents with indent: true',
options: {
moduleName: 'foo',
indent: true
}
};
|
TEST('GRAPHICSMAGICK_READ_METADATA', (check) => {
GRAPHICSMAGICK_READ_METADATA('UPPERCASE-CORE/sample.png', (metadata) => {
console.log(metadata);
});
GRAPHICSMAGICK_READ_METADATA('UPPERCASE-CORE/sample.png', {
error : () => {
console.log('ERROR!');
},
success : (metadata) => {
console.log(metadata);
}
});
});
|
/**
* Created by Pencroff on 04-Sep-16.
*/
window.test = {
id: '384A61CA-DA2E-4FD2-A113-080010D4A42B',
name: 'object literal iteration',
description: 'Performance case for iteration object properties. Comparison for StackOverflow question: How do I loop through or enumerate a JavaScript object? (<a href=\"https://goo.gl/0QEGHB\" target=\"_blank\">link</a>)',
tags: ['object', 'iteration', 'basic'],
url: 'tests/object-iteration.js',
fill: function (suite) {
return new Promise(function (resolve) {
var result, a, b, c;
var obj;
suite.add('by Object.keys', function () {
result = '';
var arr = Object.keys(obj);
var len = arr.length;
var i, key;
for (i = 0; i < len; i += 1) {
key = arr[i];
result += key + ': ' + obj[key] + ' ';
}
a = b;
b = c;
c = result;
});
suite.add('by Object.keys with native forEach', function () {
result = '';
Object.keys(obj).forEach(function(key) {
result += key + ': ' + obj[key] + ' ';
});
a = b;
b = c;
c = result;
});
suite.add('by for..in', function () {
result = '';
for (var key in obj) {
result += key + ': ' + obj[key] + ' ';
}
a = b;
b = c;
c = result;
});
suite.add('by for..in and hasOwnProperty', function () {
result = '';
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
result += key + ': ' + obj[key] + ' ';
}
}
a = b;
b = c;
c = result;
});
suite.add('lodash v4.15.0 - _.forEach', function () {
result = '';
_.forEach(obj, function (value, key) {
result += key + ': ' + value + ' ';
});
a = b;
b = c;
c = result;
});
suite.on('start cycle', function () {
var len = 100;
var i;
obj = {};
for (i = 0; i < len; i += 1) {
obj['prop'+i] = 'value' + i;
}
});
suite.on('cycle', function () {
console.log('cycle', result);
});
resolve(suite);
});
}
};
|
(function(){
up.Font = Font;
up.Font.NORMAL = "normal";
up.Font.ITALIC = "italic";
up.Font.OBLIQUE = "oblique";
up.Font.BOLD = "bold";
up.Font.SMALL_CAPS = "small-caps";
function Font(_family, _size, _lineHeight, _style, _weight, _variant){
this.family = "Arial";
this.size = 12;
this.lineHeight = 12;
this.style = up.Font.NORMAL;
this.variant = up.Font.NORMAL;
this.weight = up.Font.NORMAL;
if(_family!=null) this.family = _family;
if(_size!=null) this.size = _size;
if(_lineHeight!=null) this.lineHeight = _lineHeight;
else this.lineHeight = this.size;
if(_style!=null) this.style = _style;
if(_weight!=null) this.weight = _weight;
if(_variant!=null) this.variant = _variant;
}//constructor
Font.prototype.toCssString = function(){
return this.style+' '+this.variant+' '+this.weight+' '+this.size+'px/'+this.lineHeight+'px '+this.family+' ';
}//toCssString
Font.loadFont = function(_name, _url){
var fontFace =
"@font-face {"+
"font-family: '"+_name+"';"+
"src: url('"+_url+"/"+_name+".ttf') format('truetype');"+
"}";
var styleNode = document.createElement('style');
styleNode.type = "text/css";
if(styleNode.styleSheet){
styleNode.styleSheet.cssText = fontFace;
}else{
styleNode.appendChild(document.createTextNode(fontFace));
}
document.head.appendChild(styleNode);
}//loadFont
})();
|
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['pending-invitation']
});
|
import React from 'react'
import styles from './weather.less'
function Weather (props) {
const {city, icon, dateTime, temperature, name} = props
return <div className={styles.weather}>
<div className={styles.left}>
<div className={styles.icon} style={{
backgroundImage: `url(${icon})`
}} />
<p>{name}</p>
</div>
<div className={styles.right}>
<h1 className={styles.temperature}>{temperature + '°'}</h1>
<p className={styles.description}>{city},{dateTime}</p>
</div>
</div>
}
export default Weather
|
/**
* Copyright 2013 Ionică Bizău
*
* A Node.JS module, which provides an object oriented wrapper for the Youtube v3 API.
* Author: Ionică Bizău <bizauionica@gmail.com>
*
**/
var Util = require("../../util");
function list (options, callback) {
var self = this;
var url = Util.createUrl.apply(self, ["playlists", options]);
var reqOptions = {
url: url,
};
self.Client.request(reqOptions, callback);
}
function insert (options, callback) {
callback(null, {"error": "Not yet implemented"});
}
function update (options, callback) {
callback(null, {"error": "Not yet implemented"});
}
function deleteItem (options, callback) {
callback(null, {"error": "Not yet implemented"});
}
module.exports = {
list: list,
insert: insert,
update: update,
delete: deleteItem
};
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols
var v0 = new WeakMap;
var v1 = {};
v0.set(v1, 1);
var sym = Symbol();
v1[sym] = 1;
var symbols = Object.getOwnPropertySymbols(v1);
assertArrayEquals([sym], symbols);
|
module.exports = {
description: 'throw an error when accessing members of null or undefined'
};
|
var $path = require('path');
module.exports = function(grunt) {
grunt.initConfig({
localBase : $path.resolve(__dirname),
pkg: grunt.file.readJSON('package.json'),
litheConcat : {
options : {
cwd: '<%=localBase%>'
},
publish : {
src : 'public/js/',
dest : 'public/js/dist/',
walk : true,
alias : 'config.js',
global : 'conf/global.js',
withoutGlobal : [
],
target : 'conf/'
}
},
litheCompress : {
options : {
cwd: '<%=localBase%>'
},
publish : {
src : 'public/js/dist/',
dest : 'public/js/dist/'
}
}
});
grunt.loadTasks('tasks/lithe');
grunt.registerTask(
'publish',
'[COMMON] pack and compress files, then distribute',
[
'litheConcat:publish',
'litheCompress:publish'
]
);
grunt.registerTask(
'default',
'the default task is publish',
[
'publish'
]
);
};
|
flock.synth({
synthDef: {
ugen: "flock.ugen.sin",
freq: {
ugen: "flock.ugen.value",
rate: "audio",
value: 400,
add: {
ugen: "flock.ugen.sin",
freq: {
ugen: "flock.ugen.mouse.cursor",
mul: 124,
add: 62,
},
mul: {
ugen: "flock.ugen.mouse.cursor",
mul: 100,
add: 100,
options: {
axis: "y"
}
}
}
},
mul: 0.3
}
});
|
import cn from 'classnames'
import Image from 'next/image'
import Link from 'next/link'
export default function CoverImage({ title, url, slug }) {
const image = (
<Image
width={2000}
height={1000}
alt={`Cover Image for ${title}`}
src={url}
className={cn('shadow-small', {
'hover:shadow-medium transition-shadow duration-200': slug,
})}
/>
)
return (
<div className="sm:mx-0">
{slug ? (
<Link href={slug}>
<a aria-label={title}>{image}</a>
</Link>
) : (
image
)}
</div>
)
}
|
{
"ALLOWED_FILE_TYPE": "Only following files are allowed : ",
"AUTHORIZATION_REQUIRED": "No estás autorizado para usar el administrador de archivos.",
"DIRECTORY_ALREADY_EXISTS": "La carpeta '%s' ya existe.",
"DIRECTORY_NOT_EXIST": "La carpeta %s no existe.",
"DISALLOWED_FILE_TYPE": "Following files are not allowed : ",
"ERROR_RENAMING_DIRECTORY": "Error al intentar renombrar la carpeta %s a %s.",
"ERROR_RENAMING_FILE": "Error al intentar renombrar el archivo %s a %s.",
"FILE_ALREADY_EXISTS": "El archivo '%s' ya existe.",
"FILE_DOES_NOT_EXIST": "El archivo %s no existe.",
"INVALID_ACTION": "Acción inválida.",
"INVALID_DIRECTORY_OR_FILE": "Carpeta o archivo invalido.",
"INVALID_FILE_TYPE": "File upload is not allowed.",
"INVALID_FILE_UPLOAD": "Transferencia de archivo inválida.",
"INVALID_VAR": "Variable %s inválida.",
"LANGUAGE_FILE_NOT_FOUND": "Archivo de idioma no encontrado.",
"MODE_ERROR": "Error de modo.",
"UNABLE_TO_CREATE_DIRECTORY": "No se ha podido crear la carpeta %s.",
"UNABLE_TO_OPEN_DIRECTORY": "No se ha podido abrir la carpeta %s.",
"UPLOAD_FILES_SMALLER_THAN": "Por favor, sube solo imágenes con tamaño inferior a %s.",
"UPLOAD_IMAGES_ONLY": "Por favor, sube solo imágenes, no se admiten otro tipo de archivos.",
"UPLOAD_IMAGES_TYPE_JPEG_GIF_PNG": "Por favor, sube solo imágenes de tipo JPEG, GIF o PNG.",
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Cancelar",
"confirmation_delete": "¿Estás seguro de eliminar este archivo?",
"could_not_retrieve_folder": "No se ha podido recuperar el contenido de la carpeta.",
"create_folder": "Crear carpeta",
"created": "Creado",
"current_folder": "Carpeta actual: ",
"default_foldername": "Mi carpeta",
"del": "Eliminar",
"dimensions": "Dimensiones",
"download": "Descargar",
"fck_select_integration": "La función 'Seleccionar' solo se puede utilizar desde FCKEditor.",
"file_size_limit": "The file size limit is : ",
"file_too_big": "The file is too big.",
"gb": "gb",
"grid_view": "Cambiar a vista de cuadrícula.",
"kb": "kb",
"list_view": "Cambiar a vista de lista.",
"loading_data": "Transferring data ...",
"mb": "mb",
"modified": "Modificado",
"move": "Move to ...",
"name": "Nombre",
"new_filename": "Introduce un nuevo nombre para el archivo",
"new_folder": "Nueva carpeta",
"no": "No",
"no_foldername": "No se ha indicado un nombre para la carpeta.",
"parentfolder": "Directorio padre",
"prompt_foldername": "Introduce el nombre de la nueva carpeta",
"rename": "Renombrar",
"search": "Search",
"search_reset": "Reset",
"select": "Seleccionar",
"select_from_left": "Selecciona un elemento de la izquierda.",
"size": "tamaño",
"successful_added_file": "Nuevo archivo añadido.",
"successful_added_folder": "Nueva carpeta creada.",
"successful_delete": "Eliminación completada.",
"successful_moved": "Move successful.",
"successful_rename": "Renombrado con éxito.",
"upload": "Subir",
"yes": "Sí"
}
|
export default function promiseMiddleware() {
return next => action => {
const { promise, type, ...rest } = action;
if (!promise) return next(action);
const SUCCESS = type + '_SUCCESS';
const REQUEST = type + '_REQUEST';
const FAILURE = type + '_FAILURE';
next({ ...rest, type: REQUEST });
return promise
.then(req => {
next({ ...rest, req, type: SUCCESS });
return true;
})
.catch(error => {
next({ ...rest, error, type: FAILURE });
console.log(error);
return false;
});
};
}
|
(function() {
var def,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
def = require('./utils').def;
Object["new"] = function(a) {
var o;
o = {};
a.step(2, function(k, v) {
return o[k] = v;
});
return o;
};
def(Object, {
concat: function(m) {
var k, o, v;
o = {};
for (k in this) {
v = this[k];
o[k] = v;
}
return o.merge(m || {});
}
});
def(Object, {
destroy: function(key) {
var res;
if (this.hasKey(key)) {
res = this[key];
delete this[key];
return res;
}
return null;
}
});
def(Object, {
each: function(f) {
var k, v;
if (f != null) {
for (k in this) {
v = this[k];
f(k, v);
}
}
return this;
}
});
def(Object, {
empty: function() {
return this.keys().empty();
}
});
def(Object, {
first: function() {
if (this.empty()) {
return null;
} else {
return this.flatten().group(2).first();
}
}
});
def(Object, {
flatten: function() {
var a, k, v;
a = [];
for (k in this) {
v = this[k];
a = a.concat([k, v]);
}
return a;
}
});
def(Object, {
has: function(value) {
return __indexOf.call(this.values(), value) >= 0;
}
});
def(Object, {
hasKey: function(key) {
return this[key] != null;
}
});
def(Object, {
keys: function() {
var k, _results;
_results = [];
for (k in this) {
_results.push(k);
}
return _results;
}
});
def(Object, {
length: function() {
return this.keys().length;
}
});
def(Object, {
last: function() {
if (this.empty()) {
return null;
} else {
return this.flatten().group(2).last();
}
}
});
def(Object, {
map: function(f) {
var k, v;
return Object["new"](((function() {
var _results;
_results = [];
for (k in this) {
v = this[k];
_results.push(f(k, v));
}
return _results;
}).call(this)).flatten());
}
});
def(Object, {
merge: function(o) {
var k, v;
for (k in o) {
v = o[k];
this[k] = v;
}
return this;
}
});
def(Object, {
reject: function(f) {
var k, o, v;
o = {};
for (k in this) {
v = this[k];
if (!(typeof f === "function" ? f(k, v) : void 0)) {
o[k] = v;
}
}
return o;
}
});
def(Object, {
select: function(f) {
var k, o, v;
o = {};
for (k in this) {
v = this[k];
if (typeof f === "function" ? f(k, v) : void 0) {
o[k] = v;
}
}
return o;
}
});
def(Object, {
size: function() {
return this.length();
}
});
def(Object, {
sort: function(f) {
var k, o, _i, _len, _ref;
if ((f == null) || typeof f !== 'function') {
f = function(a, b) {
if (a > b) {
return 1;
} else if (b < a) {
return -1;
} else {
return 0;
}
};
}
o = {};
_ref = this.keys().sort(f);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
o[k] = this[k];
}
return o;
}
});
def(Object, {
sortedKeys: function() {
return this.keys().sort();
}
});
def(Object, {
sortedValues: function() {
var k, _i, _len, _ref, _results;
_ref = this.sortedKeys();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
_results.push(this[k]);
}
return _results;
}
});
def(Object, {
tap: function(block) {
block.call(this, this);
return this;
}
});
def(Object, {
type: function() {
return Object.prototype.toString.call(this).toLowerCase().replace(/\[object (\w+)\]/, "$1");
}
});
def(Object, {
update: Object.prototype.merge
});
def(Object, {
values: function() {
var k, _i, _len, _ref, _results;
_ref = this.keys();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
_results.push(this[k]);
}
return _results;
}
});
def(Object, {
quacksLike: function(type) {
var definition, k, v, _ref;
if (type.__definition__ != null) {
definition = type.__definition__;
if (typeof definition === "function") {
return definition(this);
}
for (k in definition) {
v = definition[k];
switch (typeof v) {
case "function":
if (!v(this[k])) {
return false;
}
break;
default:
if (!(v === "*" || ((_ref = this[k]) != null ? _ref.type() : void 0) === v)) {
return false;
}
}
}
return true;
} else {
return false;
}
}
});
}).call(this);
|
describe('CreateController', function() {
beforeEach(module('mainModule'));
var $scope, $controller, $httpBackend, $state;
beforeEach(inject(function(_$controller_, _$httpBackend_, _$state_) {
$httpBackend = _$httpBackend_;
$state = _$state_;
$scope = {};
$controller = _$controller_('CreateController', { $scope: $scope });
$httpBackend.whenGET('/header').respond(200);
$httpBackend.whenGET('/filters').respond(200);
$httpBackend.flush();
}));
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('initial parameter of cleanNewCheck is custom object', function() {
expect($scope.cleanNewCheck).toBeDefined();
});
it('function resetNewCheck should copy to object custom template', function() {
$scope.cheque = {};
$scope.resetNewCheck();
expect($scope.cheque).toEqual($scope.cleanNewCheck);
});
it('function addKit should return object with key "kit"', function() {
expect($scope.addKit('example')).toEqual({'kit': 'example'});
});
it('should add note and diagnostic to cheque and send items to server', function() {
$scope.cheque = {"id":1, "name":'Bob', "notes":[], diagnostics:[]};
$scope.note = {"text":'text'};
$scope.diagnostic = {"text":'text'};
$httpBackend.expectPOST('/cheques', {"id":1, "name":'Bob', "notes":[{"text":'text'}], diagnostics:[{"text":'text'}]}).respond(200);
$scope.sendCheque();
$httpBackend.flush();
});
it('should create mdDialog for datepicker and take response', inject(function($mdDialog, $q, $rootScope) {
angular.extend($scope, {$new: function() {} });
var deferred = $q.defer();
spyOn($mdDialog, 'show').and.returnValue(deferred.promise);
$scope.introducedPicker();
$scope.guaranteePicker();
deferred.resolve('test');
$rootScope.$apply();
expect($scope.cheque.introducedFrom).toEqual('test');
expect($scope.cheque.guarantee).toEqual('test');
expect($mdDialog.show).toHaveBeenCalled();
}));
});
|
import * as React from 'react';
import { assert } from 'chai';
function assertDOMNode(node) {
// duck typing a DOM node
assert.ok(node.nodeName);
}
/**
* Utility method to make assertions about the ref on an element
* @param {React.ReactElement} element - The element should have a component wrapped
* in withStyles as the root
* @param {function} mount - Should be returnvalue of createMount
* @param {function} onRef - Callback, first arg is the ref.
* Assert that the ref is a DOM node by default
*/
export default function testRef(element, mount, onRef = assertDOMNode) {
const ref = React.createRef();
const wrapper = mount(React.createElement(React.Fragment, null, React.cloneElement(element, {
ref
})));
onRef(ref.current, wrapper);
}
|
jQuery(document).ready(function($){
//var timings
//var fade_rand
var blocked = false;
var slide_names = "fade_"+fade_rand+"_slide_";
var current_slide = 0;
$(document).oneTime(timings[0],fade_rand+"_timer", function(){
change_slide(null);
});
$("#fade_"+fade_rand+" div.fade_bullets_bullets ul li").click(function(){
var id = $(this).attr("data-id");
if(id != current_slide){
$(document).stopTime(fade_rand+"_timer");
change_slide(id);
}
});
function change_slide(next_slide){
if(blocked == false){
blocked = true;
if(next_slide != null){
var nextnum = next_slide;
}
else{
var nextnum = parseInt(current_slide) +1;
}
next = $("#"+slide_names+nextnum);
next_id = next.attr("id");
if(next_slide == null){
if(typeof(next_id) == "undefined"){
next = $("#"+slide_names+"0");
nextnum = 0;
}
}
var current = $("#"+slide_names+current_slide);
if(current.attr("id") != next.attr("id")){
$("#fade_"+fade_rand+" div.fade_bullets_bullets ul li#fade_bullet_"+current_slide).removeClass("active");
current.fadeOut(500,function(){
$("#fade_"+fade_rand+" div.fade_bullets_bullets ul li#fade_bullet_"+nextnum).addClass("active");
next.fadeIn(500, function(){
current_slide = nextnum;
blocked = false;
$(document).oneTime(timings[current_slide],fade_rand+"_timer", function(){
change_slide(null);
});
});
});
}
else{
blocked = false;
}
}
}
});
|
//require <xatajax.ui.tk.js>
/**
* The ComponentListener interface that should be implemented by any
* object that wishes to register to receive notifications from
* Components when child components are added or removed.
*
* @created Feb. 7, 2011
* @author Steve Hannah <steve@weblite.ca>
*/
(function(){
var ComponentEvent = XataJax.ui.tk.ComponentEvent;
/**
* Register the Public API
*/
XataJax.ui.tk.ComponentListener = ComponentListener;
/**
* Implementation Details Below this line =========
*/
var $ = jQuery;
/**
* An interface for objects that wish to be notified of changes to a component.
* @override-params any
*
* @constructor
*/
function ComponentListener(o){
XataJax.publicAPI(this, publicAPI);
if ( typeof(o) == 'object' ){
$.extend(this, o);
}
}
var publicAPI = {
beforeChildAdded: beforeChildAdded,
beforeChildRemoved: beforeChildRemoved,
childAdded: childAdded,
childRemoved: childRemoved,
beforeUpdate: beforeUpdate,
afterUpdate: afterUpdate
};
ComponentListener.prototype = publicAPI;
ComponentListener.constructor = ComponentListener;
/**
* Method called before a child is added to a component. This gives an
* opportunity for the listener to veto the add by throwing an exception.
*
* @param ComponentEvent event
* @throws XataJax.Exception
*/
function beforeChildAdded(event){}
/**
* Method called before a child is removed from the compoennt. This
* gives an opportunity for the listener to veto the removal by
* throwing an exception.
*
* @param {ComponentEvent} event
* @throws XataJax.Exception
*/
function beforeChildRemoved(event){}
/**
* Method called after a child component has successfully been added to
* the component.
*
* @param ComponentEvent event
*/
function childAdded(event){}
/**
* Method called after a child component has successfully been removed from
* the component.
*
* @param ComponentEvent event
*/
function childRemoved(event){}
function beforeUpdate(event){}
function afterUpdate(event){}
})();
|
//>>built
define("dojox/widget/nls/hu/FilePicker",({name:"Név",path:"Elérési út",size:"Méret (byte)"}));
|
function act() {
rm.killMonster(6090001);
}
|
// StickyJS Plugin for jQuery
// =============
// Author: Sebastian Dawidziak <sebastian@dawidziak.eu>
// Created: 6/20/2014
// Version: 0.0.6
(function($) {
"use strict";
var defaults = {
zIndex: null,
stopper: null,
topSpacing: 0,
bottomSpacing: 0,
className: 'is-sticky',
wrapperClassName: 'sticky-wrapper',
center: false,
getWidthFrom: null
},
$window = $(window),
$document = $(document),
sticked = [],
windowHeight = $window.height(),
scroller = function() {
var scrollTop = $window.scrollTop(),
documentHeight = $document.height(),
dwh = documentHeight - windowHeight,
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
for (var i = 0; i < sticked.length; i++) {
var s = sticked[i],
elementTop = s.stickyWrapper.offset().top,
etse = elementTop - s.topSpacing - extra,
inside = s.stopper != null ? $(s.stopper).find(s.stickyElement).length > 0 : false,
newStop = s.stopper != null ? (inside ? $(s.stopper).offset().top + $(s.stopper).outerHeight(true) : $(s.stopper).offset().top) : null,
newBottom = s.stickyElement.offset().top - s.stickyElement.outerHeight(true),
isStop = s.stopper != null ? ((scrollTop - newStop) + (scrollTop - newBottom) + s.topSpacing > 0) : false;
if (scrollTop <= etse) {
if (s.currentTop !== null) {
s.stickyElement
.css('position', '')
.css('top', '');
s.stickyElement.parent().removeClass(s.className);
s.currentTop = null;
}
} else {
var newTop = documentHeight - s.stickyElement.outerHeight(true) - s.topSpacing - s.bottomSpacing - scrollTop - extra;
if (newTop == 0) {
newTop = newTop + s.topSpacing;
} else if (isStop) {
newTop = (newStop - scrollTop) - s.stickyElement.outerHeight(true);
} else {
newTop = s.topSpacing;
}
if (s.currentTop != newTop) {
s.stickyElement
.css('position', 'fixed')
.css('top', newTop);
if (typeof s.getWidthFrom !== 'undefined') {
s.stickyElement.css('width', $(s.getWidthFrom).width());
}
s.stickyElement.parent().addClass(s.className);
s.currentTop = newTop;
}
}
}
},
resizer = function() {
windowHeight = $window.height();
},
methods = {
init: function(options) {
var o = $.extend(defaults, options);
return this.each(function() {
var stickyElement = $(this);
var stickyId = stickyElement.attr('id');
var wrapper = $('<div></div>')
.attr('id', stickyId + '-sticky-wrapper')
.addClass(o.wrapperClassName);
stickyElement.wrapAll(wrapper);
if (o.center) {
stickyElement.parent().css({
width: wrapper.outerWidth(true),
marginLeft: "auto",
marginRight: "auto"
});
}
stickyElement.parent().css({
width: stickyElement.outerWidth(true)
});
if (stickyElement.css("float") == "right") {
stickyElement.css({
"float": "none"
}).parent().css({
"float": "right"
});
}
var stickyWrapper = stickyElement.parent();
stickyWrapper.css('height', stickyElement.outerHeight(true));
sticked.push({
zIndex: o.zIndex,
stopper: o.stopper,
topSpacing: o.topSpacing,
bottomSpacing: o.bottomSpacing,
stickyElement: stickyElement,
currentTop: null,
stickyWrapper: stickyWrapper,
className: o.className,
getWidthFrom: o.getWidthFrom
});
if (typeof o.getWidthFrom !== 'undefined') {
stickyElement.css('width', $(o.getWidthFrom).width());
}
});
},
update: scroller,
unstick: function(options) {
return this.each(function() {
var unstickyElement = $(this);
removeIdx = -1;
for (var i = 0; i < sticked.length; i++) {
if (sticked[i].stickyElement.get(0) == unstickyElement.get(0)) {
removeIdx = i;
}
}
if (removeIdx != -1) {
sticked.splice(removeIdx, 1);
unstickyElement.unwrap();
unstickyElement.removeAttr('style');
}
});
}
};
if (window.addEventListener) {
window.addEventListener('scroll', scroller, false);
window.addEventListener('resize', resizer, false);
} else if (window.attachEvent) {
window.attachEvent('onscroll', scroller);
window.attachEvent('onresize', resizer);
}
$.fn.sticky = function(method) {
if (methods[method]) return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
else if (typeof method === 'object' || !method) return methods.init.apply(this, arguments);
else $.error('Method ' + method + ' does not exist on StickyJS');
};
$.fn.unstick = function(method) {
if (methods[method]) return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
else if (typeof method === 'object' || !method) return methods.unstick.apply(this, arguments);
else $.error('Method ' + method + ' does not exist on StickyJS');
};
$(function() {
setTimeout(scroller, 0);
});
})(jQuery);
|
// extends src/nodes/image.js which extends src/node-box-native-view.js
$(function(){
Iframework.NativeNodes["image-rectangle"] = Iframework.NativeNodes["image"].extend({
info: {
title: "rectangle",
description: "draw a rectangle"
},
initializeModule: function(){
},
inputrect: function (rect) {
this._x = rect[0];
this._y = rect[1];
this._w = rect[2];
this._h = rect[3];
},
inputfill: function (color) {
this._triggerRedraw = true;
this._fill = color;
this.context.fillStyle = this._fill;
},
inputstroke: function (color) {
this._triggerRedraw = true;
this._stroke = color;
this.context.strokeStyle = this._stroke;
},
inputstrokewidth: function (w) {
this._triggerRedraw = true;
this._strokewidth = w;
this.context.lineWidth = this._strokewidth;
},
disconnectEdge: function(edge) {
// Called from Edge.disconnect();
if (edge.Target.id === "background") {
this._background = null;
this._triggerRedraw = true;
}
},
canvasSettings: function () {
this.context.fillStyle = this._fill;
this.context.strokeStyle = this._stroke;
this.context.lineWidth = this._strokewidth;
},
redraw: function(){
// Called from NodeBoxNativeView.renderAnimationFrame()
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
var setSettings = false;
if (this._background) {
if (this.canvas.width !== this._background.width || this.canvas.height !== this._background.height) {
this.canvas.width = this._background.width;
this.canvas.height = this._background.height;
setSettings = true;
}
} else {
var width = this._w + 2*this._x;
if (this.canvas.width !== width) {
this.canvas.width = this._w + 2*this._x;
setSettings = true;
}
var height = this._h + 2*this._y;
if (this.canvas.height !== height) {
this.canvas.height = this._h + 2*this._y;
setSettings = true;
}
}
if (setSettings) {
this.canvasSettings();
}
// BG
if (this._background) {
this.context.drawImage(this._background, 0, 0);
}
// Angle
// if (this._angle !== undefined) {
// this.context.translate(this._x, this._y);
// this.context.rotate(this._angle);
// // Fill
// if (this._fill && this._fill!=="") {
// this.context.fillRect(0-(this._w/2), 0-(this._h/2), this._w, this._h);
// }
// // Stroke
// if (this._stroke && this._stroke!=="" && this._strokewidth && this._strokewidth>0) {
// this.context.strokeRect(0-(this._w/2), 0-(this._h/2), this._w, this._h);
// }
// this.context.rotate(0-this._angle);
// this.context.translate(0-this._x, 0-this._y);
// this.inputsend();
// return;
// }
// Fill
if (this._fill && this._fill!=="") {
this.context.fillRect(this._x, this._y, this._w, this._h);
}
// Stroke
if (this._stroke && this._stroke!=="" && this._strokewidth && this._strokewidth>0) {
this.context.strokeRect(this._x, this._y, this._w, this._h);
}
this.inputsend();
},
inputsend: function () {
this.send("image", this.canvas);
},
inputs: {
background: {
type: "image",
description: "first image layer"
},
rect: {
type: "array:f4",
description: "a rectangle array with x, y, width, height"
},
x: {
type: "float",
description: "x of top-left corner",
"default": 75
},
y: {
type: "float",
description: "y of top-left corner",
"default": 75
},
w: {
type: "float",
description: "rectangle width",
"default": 350
},
h: {
type: "float",
description: "rectangle height",
"default": 350
},
fill: {
type: "color",
description: "fill color",
"default": ""
},
stroke: {
type: "color",
description: "stroke color",
"default": "black"
},
strokewidth: {
type: "float",
description: "stroke width",
"default": 1
},
// clear: {
// type: "bang",
// description: "clear the canvas"
// },
send: {
type: "bang",
description: "send the combined canvas"
}
},
outputs: {
image: {
type: "image"
}
}
});
});
|
var namespace_py_a_r_t_o_s_1_1_g_u_i_1_1_annotation_dialog =
[
[ "AnnotationDialog", "class_py_a_r_t_o_s_1_1_g_u_i_1_1_annotation_dialog_1_1_annotation_dialog.html", "class_py_a_r_t_o_s_1_1_g_u_i_1_1_annotation_dialog_1_1_annotation_dialog" ]
];
|
// Constructing calls should throw if !callee->isInterpretedConstructor().
// This tests the polymorphic call path.
for (var i=0; i<20; i++)
Function.prototype();
var funs = [
function() { return 1; },
function() { return 2; },
function() { return 3; },
function() { return 4; },
function() { return 5; },
function() { return 6; },
function() { return 7; },
function() { return 8; },
function() { return 9; },
function() { return 10; },
Function.prototype
];
function f(callee) {
new callee;
}
function g() {
var c = 0;
for (var i=0; i<50; i++) {
try {
f(funs[i % funs.length]);
} catch (e) {
assertEq(e.message.contains("not a constructor"), true);
c++;
}
}
assertEq(c, 4);
}
g();
|
'use strict';
var mongoose = require('mongoose');
exports.register = function(server, options, next) {
server.route({
method: 'GET',
path: '/account',
handler: function(request, reply) {
var User = mongoose.model('User');
User.findById(request.auth.credentials.userId, function(err, user) {
if (err) {
return reply(err);
}
reply.view('account/index', {
user: user,
script: 'account/public'
});
});
}
});
next();
};
exports.register.attributes = {
name: 'web/account'
};
|
var path = require('path');
module.exports = function(project_dir){
return {
'cordova':
{ 'platform':'*', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-plugman':
{ 'platform':'*', 'currentVersion': require('../../../package.json').version },
'cordova-android':
{ 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-ios':
{ 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-blackberry10':
{ 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-wp7':
{ 'platform':'wp7', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-wp8':
{ 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version') },
'cordova-windows8':
{ 'platform':'windows8', 'scriptSrc': path.join(project_dir,'cordova','version') },
'apple-xcode' :
{ 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple_xcode_version') },
'apple-ios' :
{ 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple_ios_version') },
'apple-osx' :
{ 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple_osx_version') },
'blackberry-ndk' :
{ 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','bb10-ndk-version') },
'android-sdk' :
{ 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','android_sdk_version') },
'windows-os' :
{ 'platform':'wp7|wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_os_version') },
'windows-sdk' :
{ 'platform':'wp7|wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_sdk_version') }
}
};
|
var rpc = require('../src/jsonrpc');
/*
Each uses a different syntax
Responses can not be assigned to a source request if the socket version
... it sucks
Moreover jsonrpc2 knows no stream ... it may be helpful, but it is not JSON-RPC2
Michal <misablaha@gmail.com>
*/
/*
Connect to HTTP server
*/
var client = rpc.Client.create(8088, 'localhost');
client.stream('listen', [], function (err, connection){
if (err) {
return printError(err);
}
var counter = 0;
connection.expose('event', function (params){
console.log('Streaming #' + counter + ': ' + params[0]);
counter++;
if (counter > 4) {
connection.end();
}
});
console.log('start listening');
});
/*
Connect to Raw socket server
*/
var socketClient = rpc.Client.create(8089, 'localhost');
socketClient.connectSocket(function (err, conn){
if (err) {
return printError(err);
}
var counter = 0;
socketClient.expose('event', function (params){
console.log('Streaming (socket) #' + counter + ': ' + params[0]);
counter++;
if (counter > 4) {
conn.end();
}
});
conn.call('listen', [], function (err){
if (err) {
return printError(err);
}
});
});
function printError(err){
console.error('RPC Error: ' + err.toString());
}
|
'use strict';
var _ = require('lodash');
module.exports = function calcDelta (oldData, newData) {
var delta = {'delta': true};
var changesFound = false;
// if there's no updates done so far, just return the full set
if (!oldData.sgvs) { return newData; }
function nsArrayTreatments(oldArray, newArray) {
var result = [];
// check for add, change
var l = newArray.length;
var m = oldArray.length;
var found, founddiff, no, oo, i, j;
for (i = 0; i < l; i++) {
no = newArray[i];
found = false;
founddiff = false;
for (j = 0; j < m; j++) {
oo = oldArray[j];
no._id = no._id.toString();
if (no._id === oo._id) {
found = true;
var oo_copy = _.clone(oo);
var no_copy = _.clone(no);
delete oo_copy.mgdl;
delete no_copy.mgdl;
if (!_.isEqual(oo_copy, no_copy)) {
founddiff = true;
}
break;
}
}
if (founddiff) {
var nno = _.clone(no);
nno.action = 'update';
result.push(nno);
}
if (!found) {
result.push(no);
}
}
//check for delete
for (j = 0; j < m; j++) {
oo = oldArray[j];
found = false;
for (i = 0; i < l; i++) {
no = newArray[i];
if (no._id === oo._id) {
found = true;
break;
}
}
if (!found) {
result.push({ _id: oo._id, action: 'remove' });
}
}
return result;
}
function nsArrayDiff(oldArray, newArray) {
var seen = {};
var l = oldArray.length;
for (var i = 0; i < l; i++) {
seen[oldArray[i].mills] = true;
}
var result = [];
l = newArray.length;
for (var j = 0; j < l; j++) {
if (!seen.hasOwnProperty(newArray[j].mills)) {
result.push(newArray[j]);
}
}
return result;
}
function sort(values) {
values.sort(function sorter(a, b) {
return a.mills - b.mills;
});
}
function compressArrays(delta, newData) {
// array compression
var compressibleArrays = ['sgvs', 'treatments', 'mbgs', 'cals', 'devicestatus'];
var changesFound = false;
for (var array in compressibleArrays) {
if (compressibleArrays.hasOwnProperty(array)) {
var a = compressibleArrays[array];
if (newData.hasOwnProperty(a)) {
// if previous data doesn't have the property (first time delta?), just assign data over
if (!oldData.hasOwnProperty(a)) {
delta[a] = newData[a];
changesFound = true;
continue;
}
// Calculate delta and assign delta over if changes were found
var deltaData = (a === 'treatments' ? nsArrayTreatments(oldData[a], newData[a]) : nsArrayDiff(oldData[a], newData[a]));
if (deltaData.length > 0) {
console.log('delta changes found on', a);
changesFound = true;
sort(deltaData);
delta[a] = deltaData;
}
}
}
}
return {'delta': delta, 'changesFound': changesFound};
}
function deleteSkippables(delta,newData) {
// objects
var skippableObjects = ['profiles'];
var changesFound = false;
for (var object in skippableObjects) {
if (skippableObjects.hasOwnProperty(object)) {
var o = skippableObjects[object];
if (newData.hasOwnProperty(o)) {
if (JSON.stringify(newData[o]) !== JSON.stringify(oldData[o])) {
console.log('delta changes found on', o);
changesFound = true;
delta[o] = newData[o];
}
}
}
}
return {'delta': delta, 'changesFound': changesFound};
}
delta.lastUpdated = newData.lastUpdated;
var compressedDelta = compressArrays(delta, newData);
delta = compressedDelta.delta;
if (compressedDelta.changesFound) { changesFound = true; }
var skippedDelta = deleteSkippables(delta, newData);
delta = skippedDelta.delta;
if (skippedDelta.changesFound) { changesFound = true; }
if (changesFound) { return delta; }
return newData;
};
|
'use strict';
var expect = require('chai').expect;
var bitcore = require('bitcore-lib');
var Message = require('bitcore-message');
var secp256k1 = require('secp256k1');
var KeyPair = require('../../lib/crypto-tools/keypair');
var prvk = '4d548b387bed22aff9ca560416d7b13ecbad16f28bc41ef5acaff3019bfa5134';
var prvk2 = '00008b387bed22aff9ca560416d7b13ecbad16f28bc41ef5acaff3019bfa5134';
var pubk = '02ad47e0d4896cd794f5296a953f897c426b3f9a58f5203b8baace8952a291cf6b';
describe('KeyPair', function() {
describe('@constructor', function() {
it('should work without the new keyword', function() {
expect(KeyPair()).to.be.instanceOf(KeyPair);
});
});
describe('#getPrivateKey', function() {
it('should use the private key supplied if provided', function() {
var kp = KeyPair(prvk);
expect(kp.getPrivateKey()).to.be.equal(prvk);
});
});
describe('#getPrivateKeyPadded', function() {
it('should use the private key supplied if provided', function() {
var kp = KeyPair(prvk2);
expect(kp.getPrivateKeyPadded()).to.be.equal(prvk2);
expect(kp.getPrivateKeyPadded().length).to.equal(64);
});
});
describe('#getPublicKey', function() {
it('should use the private key supplied if provided', function() {
var kp = KeyPair(prvk);
expect(kp.getPublicKey()).to.be.equal(pubk);
});
});
describe('#getNodeID', function() {
it('should return a bitcoin compatible address', function() {
var addr = KeyPair().getNodeID();
expect(addr.length).to.equal(40);
});
});
describe('#getAddress', function() {
it('should return a bitcoin compatible address', function() {
var addr = KeyPair().getAddress();
expect(addr.length).to.be.lte(35);
expect(addr.length).to.be.gte(26);
expect(['1', '3']).to.include(addr.charAt(0));
});
});
describe('#sign', function() {
var k = 'd1b1d083ddbcf92aa665a77379a0e32ef7cc5a4ccfc4b2a30214ebcdfd34d846';
var m = 'a test message';
it('should return a bitcoin-style compact signature', function() {
var keypair = new KeyPair(k);
var signature = keypair.sign(m, { compact: true });
expect(signature).to.have.lengthOf(88);
});
it('should return valid compact signature', function() {
var keypair = new KeyPair(k);
var signature = keypair.sign(m, { compact: true });
expect(signature).to.have.lengthOf(88);
// recover the public key and check the signature
var hash = Message(m).magicHash();
var sigbuf = new Buffer(signature, 'base64');
var sigobj = bitcore.crypto.Signature.fromCompact(sigbuf);
var sigimp = secp256k1.signatureImport(sigobj.toBuffer());
var pubkey = secp256k1.recover(hash, sigimp, sigobj.i, true);
var res = secp256k1.verify(hash, sigimp, pubkey);
expect(res).to.equal(true);
});
it('should return a regular hex signature from string', function() {
var keypair = new KeyPair(k);
var signature = keypair.sign(m, { compact: false });
expect(signature).to.equal(
'3045022100fc2cc9dcfa01fef0c8c78942f057f6d2930e9308bd5e43072c56098' +
'34d938cad022007f1179aace5810c9c4ba0461980aa2bcdfac6a40a900443b018' +
'b09e5ced5e1f'
);
});
it('should return a regular hex signature from buffer', function() {
var keypair = new KeyPair(k);
var signature = keypair.sign(Buffer(m), { compact: false });
expect(signature).to.equal(
'3045022100fc2cc9dcfa01fef0c8c78942f057f6d2930e9308bd5e43072c56098' +
'34d938cad022007f1179aace5810c9c4ba0461980aa2bcdfac6a40a900443b018' +
'b09e5ced5e1f'
);
});
});
});
|
var classambhas_1_1stats_1_1SpatOutlier =
[
[ "__init__", "classambhas_1_1stats_1_1SpatOutlier.html#ae600249e9fcbda069e9fbad0ba6983ef", null ],
[ "fill_with_nan", "classambhas_1_1stats_1_1SpatOutlier.html#a826d8579b25e76a53c18617ff226f575", null ],
[ "index", "classambhas_1_1stats_1_1SpatOutlier.html#a4b5bb747042f8c4e0228afa60c358bbb", null ],
[ "outliers", "classambhas_1_1stats_1_1SpatOutlier.html#a212e9d519dd3efa62ed8467d0f77c8cf", null ],
[ "rain", "classambhas_1_1stats_1_1SpatOutlier.html#aec2b15b0062794eee851810e08fdd99a", null ]
];
|
/**
* @class UITile
* @extends UIElement
* 是瓦片游戏地图控件,只需要放一个UITile到场景中,地图自动与场景关联。UITile支持由Map Editor Tiled制作的地图。场景中有多个地图时,可以通过UITile的setEnable函数,或用场景的setMap来设置场景当前的地图。
*
* 注意:
*
* 1.在新建地图时请选择CSV格式作为tile layer format,保存时使用JSON格式保存,图片与数据放在同一目录下。
*
* 2.启用物理引擎的方法:在tiled中新建立一个图层,给图层加几个自定义的属性。physics为true表示启用物理引擎,friction表示刚体的摩擦力系数,restitution表示刚体的弹力系数。
*
* 参考:http://www.mapeditor.org
*
*/
/**
* @method getMapWidth
* 获取地图的宽度。
* @return {Number} 返回地图的宽度。
*
*/
/**
* @method getMapHeight
* 获取地图的高度。
* @return {Number} 返回地图的高度。
*
*/
/**
* @method getLayerNr
* 获取地图的层数。
* @return {Number} 返回地图的层数。
*
*/
/**
* @method getLayerByIndex
* 获取地图某层的数据。
* @param {Number} index 层数索引。
* @return {Object} 返回地图某层的数据。layer.info里是tiled生成的原始数据。
*
*/
/**
* @method setClipRegion
* 只显示指定区域的地图。有的游戏中只显示玩家视力范围类的地图,这时可以用本函数实现。
* @param {Array} rects
* @return {UIElement} 返回控件本身。
*
* @example small frame
* var tile = this.win.find("tile");
* tile.setClipRegion([{x:40, y:50, w:100, h:200},{x:200, y:200, w:100, h:200}]);
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.