text
stringlengths 2
6.14k
|
|---|
'use strict';
describe('Main view End-2-End', function() {
var brickTable
beforeEach(function() {
browser.get("http://cfalguiere.github.io/Presentations/2014/DemoBrickInventory/");
brickTable = element.all(by.repeater('brick in bricksList'))
})
describe('When Main view appears', function() {
it('should show all the bricks', function() {
expect(brickTable.count()).toBe(76)
})
});
});
|
module.exports = (req, res) => res.json(req.query)
|
'use strict';
exports.__esModule = true;
exports.default = {
el: {
colorpicker: {
confirm: '確認',
clear: '清空'
},
datepicker: {
now: '現在',
today: '今天',
cancel: '取消',
clear: '清空',
confirm: '確認',
selectDate: '選擇日期',
selectTime: '選擇時間',
startDate: '開始日期',
startTime: '開始時間',
endDate: '結束日期',
endTime: '結束時間',
year: '年',
month1: '1 月',
month2: '2 月',
month3: '3 月',
month4: '4 月',
month5: '5 月',
month6: '6 月',
month7: '7 月',
month8: '8 月',
month9: '9 月',
month10: '10 月',
month11: '11 月',
month12: '12 月',
// week: '周次',
weeks: {
sun: '日',
mon: '一',
tue: '二',
wed: '三',
thu: '四',
fri: '五',
sat: '六'
},
months: {
jan: '一月',
feb: '二月',
mar: '三月',
apr: '四月',
may: '五月',
jun: '六月',
jul: '七月',
aug: '八月',
sep: '九月',
oct: '十月',
nov: '十一月',
dec: '十二月'
}
},
select: {
loading: '加載中',
noMatch: '無匹配資料',
noData: '無資料',
placeholder: '請選擇'
},
cascader: {
noMatch: '無匹配資料',
loading: '加載中',
placeholder: '請選擇'
},
pagination: {
goto: '前往',
pagesize: '項/頁',
total: '共 {total} 項',
pageClassifier: '頁'
},
messagebox: {
title: '提示',
confirm: '確定',
cancel: '取消',
error: '輸入的資料不符規定!'
},
upload: {
deleteTip: '按delete鍵可刪除',
delete: '刪除',
preview: '查看圖片',
continue: '繼續上傳'
},
table: {
emptyText: '暫無資料',
confirmFilter: '篩選',
resetFilter: '重置',
clearFilter: '全部',
sumText: 'Sum' // to be translated
},
tree: {
emptyText: '暫無資料'
},
transfer: {
noMatch: '無匹配資料',
noData: '無資料',
titles: ['List 1', 'List 2'], // to be translated
filterPlaceholder: 'Enter keyword', // to be translated
noCheckedFormat: '{total} items', // to be translated
hasCheckedFormat: '{checked}/{total} checked' // to be translated
}
}
};
|
(function () {
'use strict';
angular
.module('hz.dashboard', [
'hz.dashboard.launch-instance'
])
.config(config);
config.$inject = ['$provide', '$windowProvider'];
function config($provide, $windowProvider) {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/';
$provide.constant('dashboardBasePath', path);
}
})();
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var visitor_1 = require("graphql/language/visitor");
var ts_invariant_1 = require("ts-invariant");
var storeUtils_1 = require("./storeUtils");
function getDirectiveInfoFromField(field, variables) {
if (field.directives && field.directives.length) {
var directiveObj_1 = {};
field.directives.forEach(function (directive) {
directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables);
});
return directiveObj_1;
}
return null;
}
exports.getDirectiveInfoFromField = getDirectiveInfoFromField;
function shouldInclude(selection, variables) {
if (variables === void 0) { variables = {}; }
if (!selection.directives) {
return true;
}
var res = true;
selection.directives.forEach(function (directive) {
if (directive.name.value !== 'skip' && directive.name.value !== 'include') {
return;
}
var directiveArguments = directive.arguments || [];
var directiveName = directive.name.value;
ts_invariant_1.invariant(directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.");
var ifArgument = directiveArguments[0];
ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.");
var ifValue = directiveArguments[0].value;
var evaledValue = false;
if (!ifValue || ifValue.kind !== 'BooleanValue') {
ts_invariant_1.invariant(ifValue.kind === 'Variable', "Argument for the @" + directiveName + " directive must be a variable or a boolean value.");
evaledValue = variables[ifValue.name.value];
ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directiveName + " directive.");
}
else {
evaledValue = ifValue.value;
}
if (directiveName === 'skip') {
evaledValue = !evaledValue;
}
if (!evaledValue) {
res = false;
}
});
return res;
}
exports.shouldInclude = shouldInclude;
function getDirectiveNames(doc) {
var names = [];
visitor_1.visit(doc, {
Directive: function (node) {
names.push(node.name.value);
},
});
return names;
}
exports.getDirectiveNames = getDirectiveNames;
function hasDirectives(names, doc) {
return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; });
}
exports.hasDirectives = hasDirectives;
function hasClientExports(document) {
return (document &&
hasDirectives(['client'], document) &&
hasDirectives(['export'], document));
}
exports.hasClientExports = hasClientExports;
//# sourceMappingURL=directives.js.map
|
var CMLog=Packages.com.planet_ink.coffee_mud.core.Log;
CMLog.infoOut(getParms());
mob().tell("Done.");
|
"use strict";
const helper = require("../../../helper.js");
const mw = helper.requireModule('./mw/cors/index');
const assert = require('assert');
describe("Unit test for: mw - cors", function () {
let req = {
"soajs": {
"registry": {
"serviceConfig": {
"cors": {
"enabled": true,
"origin": "*",
"credentials": "true",
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"headers": "key,soajsauth,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type",
"maxage": 1728000
}
}
}
}
};
let res = {
"setHeader": (msg, data) => {
res.header[msg] = data;
},
"header": {},
"end": () => {
}
};
it("Install & Use the MW", function (done) {
let mw_use = mw({});
mw_use(req, res, () => {
assert.ok(true);
done();
});
});
it("Run MW with OPTION as method", function (done) {
req.method = "OPTIONS";
res.end = () => {
done();
};
let mw_use = mw({});
mw_use(req, res, () => {
});
});
});
|
import {createActions} from 'redux-actions';
export default createActions({
LOAD_FORM_DATA: () => ({}),
MERGE_DISPLAY: display => ({display}),
RESET_DATA: () => ({}),
SET_FORM_DATA: csv => ({csv}),
});
|
class ProfileService {
constructor($http, $state, $rootScope, $q, TabsService, AddressService) {
this.$http = $http
this.$state = $state
this.$rootScope = $rootScope
this.$q = $q
this.TabsService = TabsService
this.AddressService = AddressService
this.username = 'User'
this.profile_set = false
this.profile = {
mobileno: '',
password: '',
first_name: 'User',
last_name: '',
male: true,
female: false,
email_id: '',
referral_id: ''
}
this.credits = {
profile_credits : 0,
promo_credits: 0,
referral_credits : 0
}
this.gender = "M"
}
submitProfile(){
if(this.profile_set){
this.set_user_profile()
}else{
this.TabsService.myaccountTabs(false, false, false, false, false, false, false, false, false, false, true)
}
}
changeGender (male, female){
this.profile.male = male
this.profile.female = female
this.gender = "F"
if (male){
this.gender = "M"
}
}
update_profile(){
this.$http({
url : '/api/profile',
method: 'PUT',
data: {
'mobileno' : this.profile.mobileno,
'client_id' : "5",
'email_id': this.profile.email_id,
'gender': this.gender,
'first_name': this.profile.first_name,
'last_name': this.profile.last_name,
}
}).then((response) =>{
if(response.data.status === 'success'){
this.get_user_profile()
this.profile_set = true
this.$state.go("app.profile")
this.AddressService.getAddresses()
this.TabsService.myaccountTabs(false, false, false, false, false, true, false, false, false, false, false)
}
}, (error)=>{
})
}
set_user_profile(){
this.$http({
url : '/api/profile',
method: 'POST',
data: {
'mobileno' : this.profile.mobileno,
'client_id' : "5",
'email_id': this.profile.email_id,
'gender': this.gender,
'first_name': this.profile.first_name,
'last_name': this.profile.last_name,
}
}).then((response) =>{
if(response.data.status === 'success'){
this.get_user_profile()
this.profile_set = true
this.$state.go("app.profile")
this.AddressService.getAddresses()
this.TabsService.myaccountTabs(false, false, false, false, false, true, false, false, false, false, false)
}
}, (error)=>{
})
}
get_user_profile(){
let mobileno = localStorage.mobileno
this.profile.mobileno = mobileno
this.profile.password = '********'
let client_id = localStorage.client_id
this.$http({
url: `/api/profile?mobileno=${mobileno}&client_id=${client_id}`,
method: 'GET'
}).then((response)=>{
if(response.data.status === 'success'){
this.profile_set = true
let info = response.data.data.personal_info
let saved_address = response.data.data.saved_address
let credits = response.data.data.credits
this.profile = {
email_id : info.email_id,
mobileno : info.mobileno,
first_name : info.first_name,
last_name : info.last_name,
male : true,
female : false,
referral_id : response.data.data.referral_id
}
localStorage.mobileno = info.mobileno
this.credits = {
profile_credits : credits.profile_credits,
promo_credits : credits.promo_credits,
referral_credits : credits.referral_credits
}
this.gender = info.gender
if (this.gender === "F"){
this.profile.male = false
this.profile.female = true
}
this.username = this.profile.first_name
this.AddressService.getAddresses()
}else if(response.data.status === 'failed'){
this.profile_set = false
this.$state.go("app.profile")
this.TabsService.myaccountTabs(false, false, false, false, false, false, false, false, false, true, false)
}
}, (error)=>{
})
}
}
ProfileService.$inject = ['$http', '$state', '$rootScope', '$q', 'TabsService', 'AddressService']
angular.module('zigfo').service('ProfileService', ProfileService)
|
//// [emitClassDeclarationWithThisKeywordInES6.ts]
class B {
x = 10;
constructor() {
this.x = 10;
}
static log(a: number) { }
foo() {
B.log(this.x);
}
get X() {
return this.x;
}
set bX(y: number) {
this.x = y;
}
}
//// [emitClassDeclarationWithThisKeywordInES6.js]
class B {
constructor() {
this.x = 10;
this.x = 10;
}
static log(a) { }
foo() {
B.log(this.x);
}
get X() {
return this.x;
}
set bX(y) {
this.x = y;
}
}
|
/**
* @license Apache-2.0
*
* Copyright (c) 2020 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// MAIN //
/**
* Computes the variance of a strided array ignoring `NaN` values and using Welford's algorithm.
*
* ## References
*
* - Welford, B. P. 1962. "Note on a Method for Calculating Corrected Sums of Squares and Products." _Technometrics_ 4 (3). Taylor & Francis: 419–20. doi:[10.1080/00401706.1962.10490022](https://doi.org/10.1080/00401706.1962.10490022).
* - van Reeken, A. J. 1968. "Letters to the Editor: Dealing with Neely's Algorithms." _Communications of the ACM_ 11 (3): 149–50. doi:[10.1145/362929.362961](https://doi.org/10.1145/362929.362961).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @param {NonNegativeInteger} offset - starting index
* @returns {number} variance
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ];
* var N = floor( x.length / 2 );
*
* var v = nanvariancewd( N, 1, x, 2, 1 );
* // returns 6.25
*/
function nanvariancewd( N, correction, x, stride, offset ) {
var delta;
var mu;
var M2;
var ix;
var nc;
var v;
var n;
var i;
if ( N <= 0 ) {
return NaN;
}
if ( N === 1 || stride === 0 ) {
v = x[ offset ];
if ( v === v && N-correction > 0.0 ) {
return 0.0;
}
return NaN;
}
ix = offset;
M2 = 0.0;
mu = 0.0;
n = 0;
for ( i = 0; i < N; i++ ) {
v = x[ ix ];
if ( v === v ) {
delta = v - mu;
n += 1;
mu += delta / n;
M2 += delta * ( v - mu );
}
ix += stride;
}
nc = n - correction;
if ( nc <= 0.0 ) {
return NaN;
}
return M2 / nc;
}
// EXPORTS //
module.exports = nanvariancewd;
|
//// 0. Describe this demo
window.demoDescription = "Draw three kinds of grids: with fixed size cells, with flexible size cells, and with cell sizes based on grid's rows and columns. Resize the browser window to update grid layouts.";
//// 1. Define Space and Form
var colors = {
a1: "#ff2d5d", a2: "#42dc8e", a3: "#2e43eb", a4: "#ffe359",
b1: "#96bfed", b2: "#f5ead6", b3: "#f1f3f7", b4: "#e2e6ef"
};
var space = new CanvasSpace("pt").setup( {bgcolor: colors.a4} );
var form = new Form( space );
//// 2. Create Elements
// three kinds of grids
var grids = [
new Grid( space.size.$multiply( 0.1 ) ).to( space.size.$multiply(0.9, 0.3) ).init(50, 50, "fix", "fix"),
new Grid( space.size.$multiply( 0.1, 0.4 ) ).to( space.size.$multiply(0.9, 0.6 ) ).init( 50, 50, "flex", "flex"),
new Grid( space.size.$multiply( 0.1, 0.7 ) ).to( space.size.$multiply(0.9, 0.9 ) ).init( 5, 8, "stretch", "stretch")
];
// Use grid.generate() to specify a callback function to render each grid cell
for (var i=0; i<grids.length; i++) {
grids[i].generate( function ( size, position, row, column, type, isOccupied ) {
form.stroke( colors.b1 ).fill( false ).rect( new Rectangle( position ).resizeTo( size ) );
form.fill( colors.b1 ).font( 9 ).text( position.$add( 5, 12 ), row + ", " + column );
}.bind( grids[i] ) );
}
//// 3. Visualize, Animate, Interact
space.add({
animate: function(time, fps, context) {
for (var i = 0; i < grids.length; i++) {
form.fill( "#9ab" ).font( 12 );
form.text( grids[i].$subtract( 0, 15 ), ["Fix (50px by 50px cells)", "Flex (~50px by ~50px cells)", "Stretch (5 columns and 8 rows)"][i % 3] );
form.stroke( false ).fill( "#fff" ).rect( grids[i] ); // draw grid area
grids[i].create(); // draw grid cells (via generate() callback)
}
},
// callback to reset grid when space is resized
onSpaceResize: function(w, h) {
grids[0].set( space.size.$multiply( 0.1 ) ).to( space.size.$multiply( 0.9, 0.3 ) ).init( 50, 50, "fix", "fix" );
grids[1].set( space.size.$multiply( 0.1, 0.4 ) ).to( space.size.$multiply( 0.9, 0.6 ) ).init( 50, 50, "flex", "flex" );
grids[2].set( space.size.$multiply( 0.1, 0.7 ) ).to( space.size.$multiply( 0.9, 0.9 ) ).init( 5, 8, "stretch", "stretch" );
}
});
// 4. Start playing
space.bindMouse();
space.play();
|
SVGCalendar = function (root_width, root_height, i_options) {
var DEFAULTS = {
start_date: new Date()// Date : default is today
//--- end_date
, end_date: null// Date : default is today
, day_num: null// int : active when end_date is null
, week_num: 4// int : active when end_date and day_num is null
//--- layouts
, day_name_height: 30 // int
, day_name_transform: 'translate(0, ${height})' // str
//-- options
, start_day: 'monday' // str or null : if null, calendar start today
, table_options: {} //
, cell_hook: null//
};
var SVGNS = 'http://www.w3.org/2000/svg';
var that = this;
var CLASSES = {
selecting: 'selecting',
active: 'active',
cell: 'svg_cell',
table: 'svg_calendar',
row_name: 'row_name',
column_name: 'column_name',
even_month:'even_month',
odd_month:'odd_month',
holiday: 'holiday',
disabled:'disabled'
};
// extend args d:jquery
var args = (function () {
var options = $.extend(true, {}, DEFAULTS);
$.extend(true, options, i_options);
return options;
})();
// args
$.extend(true, CLASSES, args.CLASSES);
this.options = args;
// week of days
var day2int = function (day_str) {
// if invalid input, return -1
day_str = day_str.toLowerCase().slice(0, 3);
return ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'].indexOf(day_str);
};
var int2day = function (day_int, is_short) {
// if invalid input, return undefined
day_str = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][day_int%7];
if(is_short){
day_str = day_str.slice(0,3);
}
return day_str;
};
var get_date_delta_by_day = function (date1,date2) {
var diff = Math.abs(date1.getTime() - date2.getTime());
return Math.ceil(diff/(24*60*60*1000))
};
// today
var today = new Date();
//--- gen start and end
// - assigned_start_date
// - assigned_end_date
// - table_start_date
// - table_end_date
var assigned_start_date = args.start_date;
var table_start_date = (function () {
if (args.start_day === null) {
return assigned_start_date;
}
var week_of_day = day2int(args.start_day);
var delta_day = (today.getDay() + 7 - week_of_day) % 7;
var res_day = new Date();
res_day.setDate(today.getDate() - delta_day);
return res_day;
})();
var assigned_end_date = (function () {
var res_date = new Date(assigned_start_date.getTime());
if (args.end_date !== null) {
return args.end_date;
}
if (args.day_num !== null) {
res_date.setDate(res_date.getDate() + args.day_num);
return res_date;
}
if (args.week_num !== null) {
res_date.setDate(table_start_date.getDate() + 7 * args.week_num-1);
return res_date;
}
})();
var table_end_date = (function () {
var last_week_of_day = (7 + table_start_date.getDay() - 1)%7;
var delta_day = 7-(assigned_end_date.getDay() - last_week_of_day) % 7;
var res_date = new Date(assigned_end_date.getTime());
res_date.setDate(res_date.getDate() + delta_day);
return res_date;
})();
var row_num = Math.ceil(get_date_delta_by_day(table_start_date, table_end_date)/7);
// init calendar text value
var cell_texts = new Array(7);
(function(){
var ptr_date = new Date(table_start_date.getTime());
for(var row=0;row<row_num;row++){
cell_texts[row] = new Array(7);
for(var col=0;col<7;col++){
if((row==0&&col==0) || ptr_date.getDate()==1){
cell_texts[row][col] = ""+(ptr_date.getMonth()+1)+"/"+ptr_date.getDate();
}else{
cell_texts[row][col] = ""+ptr_date.getDate();
}
ptr_date.setDate(ptr_date.getDate()+1);
}
}
})();
// init column_name
var column_names = new Array(7);
(function(){
var offset = table_start_date.getDay();
for(var i = 0;i<7;i++){
column_names[i] = int2day(i+offset)
}
})();
var cell_hook = function (cell_elem, that_table) {
var delta = cell_elem.data('row')*7+cell_elem.data('col');
var date = new Date(table_start_date.getTime()+delta*24*60*60*1000);
cell_elem.data('date', date);
cell_elem.addClass([CLASSES.even_month,CLASSES.odd_month][(date.getMonth()+1)%2]);
if(date.getDay()==6 ||date.getDay()==0){
cell_elem.addClass(CLASSES.holiday);
}
if(args.cell_hook !== null){
args.cell_hook(cell_elem, that_table)
}
};
// table options
var table_options = {
column_num:7,
row_num:row_num,
cell_texts: cell_texts,
cell_texts_is_row_col:true,
CLASSES:CLASSES,
column_names: column_names,
column_name_height: args.day_name_height,
column_name_text_transform: args.day_name_transform,
select_mode:'horizontal',
cell_hook: cell_hook
};
// over write
$.extend(true, table_options, args.table_options);
// init table
this.table = new SVGTable(root_width, root_height, table_options);
};
SVGCalendar.prototype.get_root_elem = function () {
return this.table.get_root_elem();
};
SVGCalendar.prototype.get_active_dates = function(){
var active_cells = this.table.get_active_cells();
var active_dates = [];
for(var i=active_cells.length;i--;){
var date = new Date(active_cells[i].data('date').getTime());
active_dates.push(date)
}
return active_dates;
};
|
document.addEventListener('DOMContentLoaded', function() {
var YouTubeButton = document.getElementById('YouTube');
YouTubeButton.addEventListener('click', function() {
chrome.tabs.getSelected(null, function(tab) {
d = document;
var f = d.createElement('form');
f.action = 'http://youtube.com';
f.method = 'post';
var i = d.createElement('input');
i.type = 'hidden';
i.name = 'url';
i.value = tab.url;
f.appendChild(i);
d.body.appendChild(f);
f.submit();
});
}, false);
}, false);
document.addEventListener('DOMContentLoaded', function() {
var RedditButton = document.getElementById('Reddit');
RedditButton.addEventListener('click', function() {
chrome.tabs.getSelected(null, function(tab) {
d = document;
var f = d.createElement('form');
f.action = 'http://reddit.com';
f.method = 'post';
var i = d.createElement('input');
i.type = 'hidden';
i.name = 'url';
i.value = tab.url;
f.appendChild(i);
d.body.appendChild(f);
f.submit();
});
}, false);
}, false);
|
layui.define(['layer', 'carousel'], function (exports) {
var $ = layui.jquery;
var layer = layui.layer;
var carousel = layui.carousel;
// 添加步骤条dom节点
var renderDom = function (elem, stepItems, postion) {
var stepDiv = '<div class="lay-step">';
for (var i = 0; i < stepItems.length; i++) {
stepDiv += '<div class="step-item">';
// 线
if (i < (stepItems.length - 1)) {
if (i < postion) {
stepDiv += '<div class="step-item-tail"><i class="step-item-tail-done"></i></div>';
} else {
stepDiv += '<div class="step-item-tail"><i class=""></i></div>';
}
}
// 数字
var number = stepItems[i].number;
if (!number) {
number = i + 1;
}
if (i == postion) {
stepDiv += '<div class="step-item-head step-item-head-active"><i class="layui-icon">' + number + '</i></div>';
} else if (i < postion) {
stepDiv += '<div class="step-item-head"><i class="layui-icon layui-icon-ok"></i></div>';
} else {
stepDiv += '<div class="step-item-head "><i class="layui-icon">' + number + '</i></div>';
}
// 标题和描述
var title = stepItems[i].title;
var desc = stepItems[i].desc;
if (title || desc) {
stepDiv += '<div class="step-item-main">';
if (title) {
stepDiv += '<div class="step-item-main-title">' + title + '</div>';
}
if (desc) {
stepDiv += '<div class="step-item-main-desc">' + desc + '</div>';
}
stepDiv += '</div>';
}
stepDiv += '</div>';
}
stepDiv += '</div>';
$(elem).prepend(stepDiv);
// 计算每一个条目的宽度
var bfb = 100 / stepItems.length;
$('.step-item').css('width', bfb + '%');
};
var step = {
// 渲染步骤条
render: function (param) {
param.indicator = 'none'; // 不显示指示器
param.arrow = 'always'; // 始终显示箭头
param.autoplay = false; // 关闭自动播放
if (!param.stepWidth) {
param.stepWidth = '400px';
}
// 渲染轮播图
carousel.render(param);
// 渲染步骤条
var stepItems = param.stepItems;
renderDom(param.elem, stepItems, 0);
$('.lay-step').css('width', param.stepWidth);
//监听轮播切换事件
carousel.on('change(' + param.filter + ')', function (obj) {
$(param.elem).find('.lay-step').remove();
renderDom(param.elem, stepItems, obj.index);
$('.lay-step').css('width', param.stepWidth);
});
// 隐藏左右箭头按钮
$(param.elem).find('.layui-carousel-arrow').css('display', 'none');
// 去掉轮播图的背景颜色
$(param.elem).css('background-color', 'transparent');
},
// 下一步
next: function (elem) {
$(elem).find('.layui-carousel-arrow[lay-type=add]').trigger('click');
},
// 上一步
pre: function (elem) {
$(elem).find('.layui-carousel-arrow[lay-type=sub]').trigger('click');
}
};
layui.link(layui.cache.base + 'step-lay/step.css');
exports('step', step);
});
|
Ext.define('PF.view.PizzaShopMap', {
extend:'PF.view.EsriMap',
xtype:'pizzashopmap',
config:{
// Override some config which the base EsriMap will use...
basemapLayer:"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
mapHeight:"140px",
// And provide a bit of our own.
pizzaShop:null
},
pizzaShopGraphicsLayer: null,
initialize: function() {
this.callParent();
var pizzaShopSymbol = new esri.symbol.PictureMarkerSymbol(
{
"angle":0,
"xoffset":0,"yoffset":11,"type":"esriPMS",
"url":"http://static.arcgis.com/images/Symbols/Shapes/RedPin1LargeB.png","contentType":"image/png",
"width":28,"height":28
});
this.pizzaShopGraphicsLayer = new esri.layers.GraphicsLayer();
var pizzaShopRenderer = new esri.renderer.SimpleRenderer(pizzaShopSymbol);
this.pizzaShopGraphicsLayer.setRenderer(pizzaShopRenderer);
},
// Inherit from EsriMap, and implement this function to add config to your map beyond the basemap.
initMap:function () {
var map = this.getMap();
map.addLayer(this.pizzaShopGraphicsLayer);
var me = this;
dojo.connect(map, 'onLoad', function (e) {
map.disablePan();
me.zoomToPizzaShop();
});
},
applyPizzaShop: function (pizzaShop) {
this.pizzaShopGraphicsLayer.clear();
if (pizzaShop != null)
{
this.pizzaShopGraphicsLayer.add(new esri.Graphic(pizzaShop.geometry));
this.zoomToPizzaShop();
}
return pizzaShop;
},
zoomToPizzaShop: function() {
var map = this.getMap();
if (map)
{
var pizzaShop = this.getPizzaShop();
if (pizzaShop)
{
map.centerAndZoom(pizzaShop.geometry, 17);
}
}
}
});
|
'use strict';
/**
* Vertex segment.
* @exception {Error} Messages.CONSTRUCT_ERROR
*
* @class VtxSegment
*
* @param {Vertex} startVertex Optional. start vertex.
* @param {Vertex} endVertex Optional. end vertex.
*/
var VtxSegment = function(startVertex, endVertex)
{
if (!(this instanceof VtxSegment))
{
throw new Error(Messages.CONSTRUCT_ERROR);
}
/**
* start vertex.
* @type {Vertex}
*/
this.startVertex;
/**
* end vertex.
* @type {Vertex}
*/
this.endVertex;
if (startVertex)
{ this.startVertex = startVertex; }
if (endVertex)
{ this.endVertex = endVertex; }
};
/**
* set start, end vertex.
* @param {Vertex} startVertex
* @param {Vertex} endVertex
*/
VtxSegment.prototype.setVertices = function(startVertex, endVertex)
{
this.startVertex = startVertex;
this.endVertex = endVertex;
};
/**
* get direction between start vertex and end vertex.
* @param {Point3d} resultDirection if undefined , set new Point3D instance.
* @returns {Point3d} resultDirection
*/
VtxSegment.prototype.getDirection = function(resultDirection)
{
// the direction is an unitary vector.
var resultDirection = this.getVector();
if (resultDirection === undefined)
{ return undefined; }
resultDirection.unitary();
return resultDirection;
};
/**
* get vector point between start vertex and end vertex.
* @param {Point3d} resultVector if undefined , set new Point3D instance.
* @returns {Point3d} resultVector
*/
VtxSegment.prototype.getVector = function(resultVector)
{
if (this.startVertex === undefined || this.endVertex === undefined)
{ return undefined; }
var startPoint = this.startVertex.point3d;
var endPoint = this.endVertex.point3d;
if (startPoint === undefined || endPoint === undefined)
{ return undefined; }
resultVector = startPoint.getVectorToPoint(endPoint, resultVector);
return resultVector;
};
/**
* get line between start vertex and end vertex.
* @param {Line} resultLine if undefined , set new Line instance.
* @returns {Line} resultLine
*/
VtxSegment.prototype.getLine = function(resultLine)
{
if (resultLine === undefined)
{ resultLine = new Line(); }
var dir = this.getDirection(); // unitary direction.
var strPoint = this.startVertex.point3d;
resultLine.setPointAndDir(strPoint.x, strPoint.y, strPoint.z, dir.x, dir.y, dir.z);
return resultLine;
};
/**
* get squared length.
* @returns {Number} squared length
*
* @see Point3D#squareDistToPoint
*/
VtxSegment.prototype.getSquaredLength = function()
{
return this.startVertex.point3d.squareDistToPoint(this.endVertex.point3d);
};
/**
* get length.
* @returns {Number} square root of squared length
*/
VtxSegment.prototype.getLength = function()
{
return Math.sqrt(this.getSquaredLength());
};
/**
* get intersection info with point.
* @param {Point3D} point
* @param {Number} error default is 10E-8.
* @returns {Number} Constant.INTERSECTION_*
* Constant.INTERSECTION_OUTSIDE = 0
* Constant.INTERSECTION_INTERSECT= 1
* Constant.INTERSECTION_INSIDE = 2
* Constant.INTERSECTION_POINT_A = 3
* Constant.INTERSECTION_POINT_B = 4
*
* @see Constant
* @see Line#isCoincidentPoint
* @see Point3D#distToPoint
*/
VtxSegment.prototype.intersectionWithPoint = function(point, error)
{
// check if the point intersects the vtxSegment's line.
var line = this.getLine();
if (error === undefined)
{ error = 10E-8; }
if (!line.isCoincidentPoint(point, error))
{ return Constant.INTERSECTION_OUTSIDE; } // no intersection.
// now, check if is inside of the segment or if is coincident with any vertex of segment.
var distA = this.startVertex.point3d.distToPoint(point);
var distB = this.endVertex.point3d.distToPoint(point);
var distTotal = this.getLength();
if (distA < error)
{ return Constant.INTERSECTION_POINT_A; }
if (distB < error)
{ return Constant.INTERSECTION_POINT_B; }
if (distA> distTotal || distB> distTotal)
{
return Constant.INTERSECTION_OUTSIDE;
}
if (Math.abs(distA + distB - distTotal) < error)
{ return Constant.INTERSECTION_INSIDE; }
};
|
/**
* Copyright 2020 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.
*/
export default ['src1', 'src2'].map(src => ({
input: src + '/index.js',
output: {
entryFileNames: '[name]-[hash].js',
dir: 'build/' + src,
format: 'esm',
},
}));
|
(function ($) {
function doSearch() {
var url = '/v0.1/search/?q=' + document.getElementsByName('q')[0].value;
window.location.assign(url);
}
$(document).ready(function() {
$('#searchbox_demo').on('submit', function(e) {
e.preventDefault();
doSearch();
});
$('.btn-search').on('click', function(e) {
e.preventDefault();
doSearch();
});
function setSearchBoxSize() {
var width = screen.width < 1024 ? "20" : "30";
$("input[name='q']").attr("size", width);
}
var resizeTimeout;
function resizeThrottler() {
function timeoutHandler() {
resizeTimeout = null;
actualResizeHandler();
}
// ignore resize events as long as an actualResizeHandler execution is in the queue
if ( !resizeTimeout ) {
resizeTimeout = setTimeout(timeoutHandler, 66);
}
}
function actualResizeHandler() {
setSearchBoxSize();
}
$(window).on('resize', resizeThrottler);
setSearchBoxSize();
});
}(jQuery));
|
/******************************************************************************
Slack integration
*******************************************************************************/
'use strict';
var _ = require('underscore'),
request = require('request'),
logger = require('../../server/logger');
var fruum_username = 'Fruum',
fruum_icon_url = 'https://fruum.github.io/static/slack.png';
function Slack(options, instance) {
// ---------------------------------- COMMANDS -------------------------------
// respond to /fruum slack command
instance.server.post('/slack/:app_id', function(req, res) {
var app_id = req.params.app_id,
text = req.body.text,
token = req.body.token;
// get app
instance.storage.get_app(app_id, function(application) {
if (!application) {
res.send('*Fruum:* Invalid app_id, check your slack integration');
return;
}
var app_token = application.getProperty('slack:command_token');
if (app_token && app_token != token) {
res.send('*Fruum:* Permission denied, check your slack integration');
logger.error(app_id, 'slack_command_token_failed', {
server_token: token,
app_token: app_token,
});
return;
}
if (!text) {
var fullpage_url = application.get('fullpage_url');
if (!fullpage_url) {
res.send('Setup a <https://fruum.github.io/#v/setting-up-full-page-forums|full page fruum> to enable all features');
} else {
res.send('Click <' + fullpage_url + '|here> to open Fruum and share your thoughts');
}
} else {
// perform search
instance.storage.search(app_id, { text: text, permission: 1 }, function(results) {
if (!results.length) {
res.send('*Fruum:* No search results');
return;
}
var response = 'Fruum search results for: *' + text + '*\n';
_.each(results, function(document) {
var link = '';
if (document.get('type') == 'post') {
link = application.getShareURL(document.get('parent'));
} else {
link = application.getShareURL(document.get('id'));
}
response += '<' + link + '|' + document.get('header') + '>\n';
});
res.send(response);
}, {
skipfields: ['attachments', 'body'],
});
}
});
});
// ---------------------------------- WEBHOOKS ------------------------------
// Report to slack when a new document has been added
this.afterAdd = function(payload, callback) {
// do not block operation
callback(null, payload);
// check if we have an outgoing webhook registered in the app
var document = payload.document,
app_id = payload.app_id;
// skip chat messages
if (document.get('parent_type') == 'channel') return;
// get application instance
instance.storage.get_app(app_id, function(application) {
if (!application) return;
var webhook = application.getProperty('slack:incoming_webhook');
if (!webhook) return;
var pretext = document.get('user_displayname') || document.get('user_username'),
link = '';
if (document.get('type') == 'post') {
link = application.getShareURL(document.get('parent'));
pretext += ' replied to ' + document.get('parent_type');
} else {
link = application.getShareURL(document.get('id'));
pretext += ' created new ' + document.get('type');
}
var body = document.get('body') || '';
// remove images
body = body.replace(/!\[.*?\)/g, '');
// extract links
body = body.replace(/\[(.*)]\((.*)\)/, '$2');
var json_payload = {
attachments: [{
pretext: pretext,
title: document.get('header'),
title_link: link,
text: body,
mrkdwn_in: ['text', 'pretext'],
}],
};
// add bot details
if (!application.getProperty('slack:custom_bot')) {
json_payload.username = fruum_username;
json_payload.icon_url = fruum_icon_url;
}
request({
url: webhook,
method: 'POST',
json: json_payload,
}, function(error, response, body) {
if (error) logger.error(app_id, 'slack_incoming_webhook_failed', error);
});
});
};
}
module.exports = Slack;
|
//rest-client.js
var _pulse = require('request');
var _internal = require('./conf/conf.json');
var _conf = require('../param.json');
var exports = module.exports = {};
var pulseAPI = _conf.pulseAPI;
exports.call = function( apiContext, callback) {
//console.log("Calling External API");
var callOptions = {
url: apiContext
};
_pulse.get(callOptions, callback);
}
exports.pulseAPICall = function( apiContext, postData, callback) {
//console.log("Calling Pulse API");
var callOptions = {
url: pulseAPI + apiContext,
body: postData,
auth: {
user: _conf.user,
pass: _conf.pass,
sendImmediately: true
},
headers: {
'Content-type' : 'application/json; charset=UTF-8'
}
};
if (! postData) { _pulse.get(callOptions, callback); return }
_pulse.post(callOptions, callback);
}
|
'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": 0,
"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"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-\u00a4",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "en-lc",
"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;}
});
}]);
|
import React, { Component } from 'react';
import {
Modal,
Row,
Col,
FormGroup,
FormControl,
Button
} from 'react-bootstrap';
import md5 from 'md5';
import api from './../api';
import Error from './../Error';
export default class Login extends Component {
constructor(props) {
super(props);
this.state = {
usuario: '',
senha: ''
}
this.handleChange = this.handleChange.bind(this);
this.handleCloseDialog = this.handleCloseDialog.bind(this);
this.handleLogin = this.handleLogin.bind(this);
}
handleChange(element) {
this.setState({[element.target.name]: element.target.value})
}
handleCloseDialog() {
this.setState({dialog: null});
}
handleLogin() {
api.usuario.login(this.state.usuario, md5(this.state.senha), this.handleAuthenticate.bind(this))
}
handleAuthenticate(user) {
if (user.nome) {
this.props.onLogin && this.props.onLogin(user);
} else {
let err = {mensagem: 'Usuário e senha não encontrado. Verifique se digitou a senha corretamente.'}
this.setState({dialog: <Error {...err} onClose={this.handleCloseDialog.bind(this)} />})
}
}
render() {
return(
<div className="static-modal">
<Modal.Dialog>
<Modal.Header>
<Modal.Title>Controle de Acesso</Modal.Title>
</Modal.Header>
<Modal.Body>
<Row>
<Col md={4}>Usuario</Col>
<Col md={8}>
<FormGroup validationState="success">
{/*<ControlLabel>Input with success and feedback icon</ControlLabel>*/}
<FormControl type="text" name="usuario" value={this.state.usuario} onChange={this.handleChange} />
<FormControl.Feedback />
</FormGroup>
</Col>
</Row>
<Row>
<Col md={4}>Senha</Col>
<Col md={8}>
<FormGroup validationState="success">
{/*<ControlLabel>Input with success and feedback icon</ControlLabel>*/}
<FormControl type="password" name="senha" value={this.state.senha} onChange={this.handleChange} />
<FormControl.Feedback />
</FormGroup>
</Col>
</Row>
</Modal.Body>
<Modal.Footer>
<Button bsStyle="primary" onClick={this.handleLogin} >Acessar</Button>
</Modal.Footer>
{this.state.dialog}
</Modal.Dialog>
</div>
);
}
}
|
var searchData=
[
['call',['call',['../select2_8js.html#aed63747d658b9ef1878fda471c519855',1,'select2.js']]],
['cleardropdownalignmentpreference',['clearDropdownAlignmentPreference',['../select2_8js.html#a720684602e142b73d3f2c3bc8a9abfa6',1,'select2.js']]],
['clearsearch',['clearSearch',['../select2_8js.html#a0daa3a419e750a83f25eae438fd78e7f',1,'select2.js']]],
['click',['click',['../select2_8js.html#afc4f810ddf843d199e01f73c790c47d9',1,'select2.js']]],
['close',['close',['../select2_8js.html#afaff1af430762c8f59afd2326157c9e0',1,'select2.js']]],
['createaward',['createAward',['../awards_8php.html#a9907ea6ed2f9c3953ced2eb213555825',1,'awards.php']]],
['createcategory',['createCategory',['../categories_8php.html#a938139f39c4b1b632aa6d3ccfe41436c',1,'categories.php']]],
['createevent',['createEvent',['../event_8php.html#a859e985dd79c3d1f4df016906a2bdc19',1,'event.php']]],
['createform',['createForm',['../form_8php.html#aede244e7daf130e33ee27fe4ff788cb5',1,'form.php']]],
['createproject',['createProject',['../project_8php.html#affa057947b4f40ec28061d9c2e84aed1',1,'project.php']]],
['createuser',['createUser',['../user_8php.html#a121d44623c67932b3a0bd08bb766bfca',1,'user.php']]],
['css',['css',['../select2_8js.html#ab0e706c905ff737007bda5949ae94902',1,'select2.js']]]
];
|
docsearch({
apiKey: '6c42f30d9669d8e42f6fc92f44028596',
indexName: 'docs-ray',
appId: 'LBHF0PABBL',
inputSelector: '#search-input',
debug: false,
});
|
var interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry =
[
[ "setBytes", "interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry.html#abcee4c5061efc787a287d076123efd1d", null ],
[ "setLastSeen", "interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry.html#acb36228a788838ba7138144b79c4aa68", null ],
[ "setLife", "interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry.html#a420b51bf06d87a3aca3a78a7256176e9", null ],
[ "setPackets", "interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry.html#aec00b06ee9dc6adf1ce4f841e11713b4", null ],
[ "setState", "interfaceorg_1_1onosproject_1_1net_1_1flow_1_1StoredFlowEntry.html#aa3ec6f5b30996739a2541dceb76c6f75", null ]
];
|
// test for comments in templates
test('comments', 8, function() {
var template = '{!this won\'t show up!}';
equal(whiskers.render(template, {}), '')
var template = '{!!}';
equal(whiskers.render(template, {}), '')
var template = '{!this won\'t show up\neither!}';
equal(whiskers.render(template, {}), '')
var template = '{!this won\'t {show} up!}';
equal(whiskers.render(template, {}), '')
var template = '\\{!this will show up!}';
equal(whiskers.render(template, {}), '{!this will show up!}')
var template = '{!this will also show up}';
equal(whiskers.render(template, {}), '{!this will also show up}')
var template = '{!this won\'t, but!}this part will show up!}';
equal(whiskers.render(template, {}), 'this part will show up!}')
var template = '{also, {!this} part won\'t show up!}';
equal(whiskers.render(template, {}), '{also, ')
});
|
var platform = require('platformSupport');
var alloyAnimation = require('alloy/animation');
var screenWidth ;
if(OS_IOS){
screenWidth = platform.getScreenWidth();
}else{
screenWidth = platform.convertDptoPx(platform.getScreenWidth());
}
var screenHeight ;
if(OS_IOS){
screenHeight = platform.getScreenHeight();
}else{
screenHeight = platform.convertDptoPx(platform.getScreenHeight());
}
//alert(screenWidth);
exports.in = function(form){
form.left = screenWidth;
form.right = -(screenWidth);
form.opacity = 0;
form.open();
form.animate({
left : screenWidth,
right : -(screenWidth),
duration : 1
}, function() {
form.opacity = 1;
form.animate({
left : 0,
right : 0,
duration : 200
});
});
};
exports.inAndClose = function(form, closeForm){
form.left = screenWidth;
form.right = -(screenWidth);
form.opacity = 0;
form.open();
form.animate({
left : screenWidth,
right : -(screenWidth),
duration : 1
}, function() {
form.opacity = 1;
form.animate({
left : 0,
right : 0,
duration : 200
}, function(){
closeForm.close();
});
});
};
exports.out = function(form){
form.animate({
left : screenWidth,
right : -(screenWidth),
duration : 200
}, function() {
form.close();
});
};
exports.slowlyAppear = function(obj){
obj.animate({
opacity : 0,
duration : 20
},function(){
obj.animate({
opacity : 1,
duration : 2000
});
});
};
exports.appearFromLeft = function(obj) {
obj.animate({
opacity : 0,
left : obj.left + 8,
duration : 20
}, function() {
obj.animate({
left : obj.left,
opacity : 1,
duration : 1000
});
});
};
exports.inShake = function(form){
form.left = screenWidth;
form.right = -(screenWidth);
form.opacity = 0;
form.open();
form.animate({
left : screenWidth,
right : -(screenWidth),
duration : 2
}, function() {
form.animate({
left : 0,
right : 0,
duration : 200
}, function() {
alloyAnimation.shake(form, 200, null);
form.opacity = 1;
});
});
};
|
import mysql from 'mysql2/promise';
import * as Rx from "rxjs";
export default class MysqlPool {
constructor({config}){
this._config = config;
}
getPool(){
return Rx.Observable.of(mysql.createPool({
...this._config.mysql
}));
}
}
|
/* eslint-disable */
var webpack = require('webpack');
var path = require('path');
var PATHS = {
CONTEXT: __dirname,
BUILD: path.join(__dirname, 'dist')
};
module.exports = {
context: PATHS.CONTEXT,
entry: './playground',
output: {
path: PATHS.BUILD,
filename: 'bundle.js',
chunkFilename: '[name].[chunkhash].js'
},
devtool: 'cheap-eval-source-map',
module: {
loaders: [
{test: /\.js$/, loader: 'babel', exclude: /node_modules|(redocs\/lib)/},
{test: /\-fixture\.js$/, loader: 'babel!redocs/lib/webpack/manifest-loader', exclude: /node_modules/},
]
},
plugins: [
new webpack.DefinePlugin({
// would be nice to use minimatch or similar in future
MATCH_COMPONENTS: process.env.MATCH ? '/' + process.env.MATCH + '/' : '/\\-fixture\\\.js$/'
}),
new webpack.optimize.DedupePlugin()
]
};
|
(function () {
'use strict';
angular.module('components.provider')
.controller('ProvidersController', Controller);
/** @ngInject */
function Controller() {
var ctrl = this;
ctrl.$onChanges = onChanges;
ctrl.doEvent = doEvent;
function onChanges(changes) {
if (changes.providers) {
ctrl.providers = angular.copy(ctrl.providers);
}
}
function doEvent(event, provider) {
return ctrl['on' + event]({
$event: {
provider: provider
}
});
}
}
})();
|
var config,
_ = require('underscore'),
https = require('https'),
futils = require('./fhutils'),
fhutils;
module.exports = function(cfg) {
config = cfg;
fhutils = new futils(config);
return call;
};
//
// $fh.call() : Call back to millicore from our Node.js code.
// NOT a public function but may be one day.
// TODO - note that it uses hardcoded https here.
var call = function call(path, params, callback) {
var headers = {
"accept": "application/json"
};
var props = fhutils.getMillicoreProps();
headers["content-type"] = "application/json; charset=utf-8";
fhutils.addAppApiKeyHeader(headers);
var options = {
host: props.millicore,
port: props.port,
path: '/box/srv/1.1/' + path,
method: 'POST',
headers: headers
};
var addParams = (params === undefined || params === null) ? {} : _.clone(params);
addParams["instance"] = props.instId;
addParams["widget"] = props.widgId;
var fhResp = {};
var req = https.request(options, function(res) {
fhResp.status = res.statusCode;
// TODO - *both* of these are recommended ways of setting timeout on http requests..
// needs further investigation (and proper test case!!)
// bob build didnt like below..above suggests it was never verified?? ... changed to this to add timeout
//req.socket && req.socket.setTimeout(config.socketTimeout);
//req.connection.setTimeout && req.connection.setTimeout(config.socketTimeout);
req.on('socket', function(socket) {
socket.setTimeout(config.socketTimeout);
});
req.on('connect', function(res, socket) {
socket.setTimeout(config.socketTimeout);
});
var data = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
data += chunk;
});
res.on('end', function() {
fhResp.body = data;
callback(undefined, fhResp);
});
});
req.on('error', function(e) {
console.error('Problem invoking: %s', e.message);
callback(e);
});
req.write(JSON.stringify(addParams) + "\n");
req.end();
};
|
var obj_a = {
a: "hi",
b: "no",
c: {
h: { j:0, k:1 },
i: { j:0, k:1 },
},
d: [0, 1, 2],
e: [0, 1, 2],
f: ["a","b","c"],
g: ["a","b","c"],
x: 1,
};
var obj_b = {
a: "hi",
b: "no",
c: {
h: { j:0, k:1 },
i: { j:0, k:1 },
},
d: [0, 1, 2],
e: [1, 1, 2],
f: ["a","b","c"],
g: ["a","b","d"],
z: 1,
};
var a = {a:1, b:2};
var b = {a:2, c: {a:1, b:2}}
var c = {a:2, b:2, c: {a:1, b:2}}
var combined = Aux.combine(a,b);
Test.expect(c.a, combined.a);
Test.expect(c.b, combined.b);
Test.expect(c.c.a, combined.c.a);
function f(a,b,c) {
return a+b-c;
}
f_parse = Aux.parse_function(f);
expect(f_parse.args, ["a","b","c"]);
expect(f_parse.body, "return a+b-c;");
//var a_b_template = Aux.make_template(obj_a, obj_b);
//
//var expected_template = {
// base: {
// a: "hi",
// b: null,
// c: {
// h: {j: null, k: 1},
// i: {j: 0, k: 1},
// },
// d: [0, 1, 2],
// e: null,
// f: ["a","b","c"],
// g: null,
// x: undefined,
// z: undefined,
// },
// vars: [
// {field:"b", type:"string"},
// {field:"c.h.j", type:"void"},
// {field:"e", type:["number"]},
// {field:"g", type:["string"]},
// ],
//}
//
//// doing these individually because they are implemented
//this.// separately in the make_template() function
//var fields_to_check = ["a","b","d","f","g","c.h.j","c.i.j","c.h.k","c.i.k"];
//for(var i in fields_to_check) {
// var expected_v = eval("expected_template.base."+fields_to_check[i]);
// var resulted_v = eval("resulted_template.base."+fields_to_check[i]);
// Test.expect(expected_v, resulted_v);
//}
//
//for(var i in expected_template.vars) {
// var expected_v = expected_template.vars[i];
// var resulted_v = a_b_template.vars[i];
// Test.note_result("make_template()", {field:resulted_v.field, type:resulted_v.type});
// Test.expect(resulted_v.field, expected_v.field);
// Test.expect(resulted_v.field, expected_v.field);
//}
//
//var well_formed_obj = Aux.fill_template(expected_template,
// ["good",{u:0,v:1},[3,45],["so","well","formed"]]);
//
//Test.expect(well_formed_obj.a, "hi");
//Test.expect(well_formed_obj.b, "good");
//Test.expect(well_formed_obj.c.h.j, {u:0,v:1});
//Test.expect(well_formed_obj.e, [3,45]);
//Test.expect(well_formed_obj.f, ["a","b","c"]);
//Test.expect(well_formed_obj.g, ["so","well","formed"]);
//
//try {
// var malformed_obj = Aux.fill_template(expected_template,
// [0,{u:0,v:1},[3,45],["so","well","formed"]]);
//} catch(err) {
// Test.note_result("Found error while trying to fill template badly.");
//}
//
//var object_list_a = {
// a: [{b:1,c:"3",d:5}]
//};
//var object_list_b = {
// a: [{b:2,c:"4",d:5}]
//};
//
//var list_template = {
// base: {
// a: null
// },
// vars: [
// {
// field:a,
// type:[{
// base: {b:1,c:null,d:5},
// vars: [{field:"c", type:"string"} ]
// }]
// },
// ],
//};
|
var searchData=
[
['time',['time',['../group__lib__time.html',1,'']]],
['thread',['thread',['../group__thread.html',1,'']]]
];
|
UserSettings = new Mongo.Collection( 'user-settings' );
UserSettings.allow({
insert: function () {
return true
},
update: function () {
// TODO move this server side. Only allow the owner to edit
return true
}
});
|
var Jsonix = require('../jsonix').Jsonix;
module.exports = {
"Type": function(test) {
test.equal(true, Jsonix.Util.Type.isString('abc'));
test.equal(false, Jsonix.Util.Type.isString(1));
test.equal(false, Jsonix.Util.Type.isString(null));
test.equal(false, Jsonix.Util.Type.isString(undefined));
//
test.equal(true, Jsonix.Util.Type.isBoolean(true));
test.equal(true, Jsonix.Util.Type.isBoolean(true));
test.equal(false, Jsonix.Util.Type.isBoolean('true'));
//
test.equal(true, Jsonix.Util.Type.isNumber(0));
test.equal(true, Jsonix.Util.Type.isNumber(1.2));
test.equal(false, Jsonix.Util.Type.isNumber(Number('1..2')));
test.equal(false, Jsonix.Util.Type.isNumber('1.2'));
test.equal(true, Jsonix.Util.Type.isArray([]));
test.equal(true, Jsonix.Util.Type.isArray([0]));
test.equal(false, Jsonix.Util.Type.isArray(0));
test.equal(true, Jsonix.Util.Type.isNumberOrNaN(Number.NaN));
test.equal(true, Jsonix.Util.Type.isNaN(Number.NaN));
test.equal(false, Jsonix.Util.Type.isNumber(Number.NaN));
test.equal("undefined", typeof Jsonix.Util.Type.defaultValue());
test.equal(1, Jsonix.Util.Type.defaultValue(1));
test.equal(1, Jsonix.Util.Type.defaultValue(1, undefined, 2));
test.equal(2, Jsonix.Util.Type.defaultValue(undefined, 2, 3));
test.equal(3, Jsonix.Util.Type.defaultValue("1", {t:2}, 3));
test.equal(false, Jsonix.Util.Type.defaultValue(false, undefined, true));
test.equal(false, Jsonix.Util.Type.defaultValue("true", false, true));
test.equal(false, Jsonix.Util.Type.defaultValue("true", null, false));
test.done();
},
"StringUtils" : function(test) {
test.equal('a b c', Jsonix.Util.StringUtils.trim(' a b c '));
test.equal(true, Jsonix.Util.StringUtils.isEmpty(' '));
test.done();
}
};
|
// This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-prop-obj-init.case
// - src/dstr-binding/default/cls-decl-meth-dflt.template
/*---
description: Object binding pattern with "nested" object binding pattern using initializer (class expression method (default parameter))
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
es6id: 14.5.15
features: [destructuring-binding, default-parameters]
flags: [generated]
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
14.3.8 Runtime Semantics: DefineMethod
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
[...]
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
scope, strict). If functionPrototype was passed as a parameter then pass its
value as the functionPrototype optional argument of FunctionCreate.
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
[...]
3. If Initializer is present and v is undefined, then
a. Let defaultValue be the result of evaluating Initializer.
b. Let v be GetValue(defaultValue).
c. ReturnIfAbrupt(v).
4. Return the result of performing BindingInitialization for BindingPattern
passing v and environment as arguments.
---*/
var callCount = 0;
class C {
method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
assert.sameValue(x, 4);
assert.sameValue(y, 5);
assert.sameValue(z, 6);
assert.throws(ReferenceError, function() {
w;
});
callCount = callCount + 1;
}
};
new C().method();
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
'use strict';
var react = require('react')
, document = require('./components/document');
module.exports.renderView = function renderView(req, res, props) {
var html = react.renderComponentToString(document(props));
res.end(html);
}
|
// This file was procedurally generated from the following sources:
// - src/annex-b-fns/global-existing-global-init.case
// - src/annex-b-fns/global/block.template
/*---
description: Variable binding is left in place by legacy function hoisting. CreateGlobalVariableBinding leaves the binding as non-enumerable even if it has the chance to change it to be enumerable. (Block statement in the global scope containing a function declaration)
esid: sec-web-compat-globaldeclarationinstantiation
es6id: B.3.3.2
flags: [generated, noStrict]
includes: [fnGlobalObject.js, propertyHelper.js]
info: |
B.3.3.3 Changes to GlobalDeclarationInstantiation
[...]
Perform ? varEnvRec.CreateGlobalVarBinding(F, true).
[...]
---*/
var global = fnGlobalObject();
Object.defineProperty(global, 'f', {
value: 'x',
enumerable: true,
writable: true,
configurable: false
});
$262.evalScript(`
assert.sameValue(f, 'x');
verifyProperty(global, 'f', {
enumerable: true,
writable: true,
configurable: false
}, { restore: true });
`);
$262.evalScript(`
{
function f() { return 'inner declaration'; }
}
`);
$262.evalScript(`
verifyProperty(global, 'f', {
enumerable: true,
writable: true,
configurable: false
});
`);
|
db.addUser('admin','admin');
|
'use strict';
/**
* Karma unit tests.
*/
describe('<%= componentName %>Service', function(){
var <%= componentName %>service;
beforeEach(module('<%= appName %>.<%= moduleName %>'));
beforeEach(inject(function($injector) {
service = $injector.get('<%= componentName %>');
}));
});
|
// Generated by CoffeeScript 1.3.3
var binding, exports, leveldb;
leveldb = exports = module.exports = require('./leveldb/handle');
binding = require('./leveldb.node');
leveldb.version = '0.6.2';
leveldb.bindingVersion = "" + binding.majorVersion + "." + binding.minorVersion;
leveldb.Batch = require('./leveldb/batch').Batch;
/*
Create a partitioned bitwise comparator for use with opening a database.
@param {Array} partitions Partition configuration data.
@param {Array} partitions[] Slice configuration.
@param {Integer} partitions[][0] Number of bytes in this slice. Use
zero to set the sorting direction for all bytes from the current
offset until the next slice or the end of the key.
@param {Boolean} partitions[][1] If true, use reverse bitwise
sorting until the next slice or the end of the key.
*/
leveldb.partitionedBitwiseComparator = function() {
var args, bounds, limit, reverse, _i, _len, _ref;
args = Array.prototype.slice.call(arguments);
args = Array.isArray(args[0][0]) ? args[0] : args;
bounds = [];
for (_i = 0, _len = args.length; _i < _len; _i++) {
_ref = args[_i], limit = _ref[0], reverse = _ref[1];
bounds.push(parseInt(limit));
bounds.push(!!reverse);
}
return binding.createPartitionedBitwiseComparator(bounds);
};
|
var app = angular.module("pinguApp", []);
console.log("Fired up angular ...");
|
//Wrapped in an outer function to preserve global this
(function (root) { var amdExports; define([], function () { (function () {
// by tauren
// https://github.com/Modernizr/Modernizr/issues/191
Modernizr.addTest('cookies', function () {
// Quick test if browser has cookieEnabled host property
if (navigator.cookieEnabled) return true;
// Create cookie
document.cookie = "cookietest=1";
var ret = document.cookie.indexOf("cookietest=") != -1;
// Delete cookie
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
return ret;
});
}.call(root));
return amdExports;
}); }(this));
|
(function() {
var imageLoaderExample, myapp, oflib, window;
oflib = require('lib/of');
oflib._.extend(this, oflib);
imageLoaderExample = (function() {
function imageLoaderExample() {
this.bikers = new ofImage;
this.gears = new ofImage;
this.tdf = new ofImage;
this.tdfSmall = new ofImage;
this.transparency = new ofImage;
this.bikeIcon = new ofImage;
}
imageLoaderExample.prototype.setup = function() {
ofSetWindowTitle("Javascript image loader");
this.bikers.loadImage("images/bikers.jpg");
this.gears.loadImage("images/gears.gif");
this.tdf.loadImage("images/tdf_1972_poster.jpg");
this.tdfSmall.loadImage("images/tdf_1972_poster.jpg");
this.tdfSmall.resize(Math.round(this.tdf.width / 4), Math.round(this.tdf.height / 4));
this.tdfSmall.setImageType(OF_IMAGE_GRAYSCALE);
this.transparency.loadImage("images/transparency.png");
this.bikeIcon.loadImage("images/bike_icon.png");
this.bikeIcon.setImageType(OF_IMAGE_GRAYSCALE);
return this.oIndex = new Indexable();
};
imageLoaderExample.prototype.update = function() {
return ofBackground(255, 255, 255);
};
imageLoaderExample.prototype.draw = function() {
var h, i, j, pct, pixels, value, w;
ofSetColor(0xFFFFFF);
this.bikers.draw(0, 0);
this.gears.draw(600, 0);
this.tdf.draw(600, 300);
ofSetColor(0xDD3333);
this.tdfSmall.draw(200, 300);
ofSetColor(0xFFFFFF);
ofEnableAlphaBlending();
this.transparency.draw(Math.sin(ofGetElapsedTimeMillis() / 1000.0) * 100 + 500, 20);
ofDisableAlphaBlending();
ofSetColor(0x000000);
w = this.bikeIcon.width;
h = this.bikeIcon.height;
pixels = this.oIndex.setPtr(this.bikeIcon.getPixels(), w * h * this.bikeIcon.bpp, kExternalUnsignedByteArray);
i = 0;
while (i++ < w) {
j = 0;
while (j++ < h) {
value = pixels[j * w + i];
pct = 1 - (value / 255.0);
ofCircle(i * 10, 500 + j * 10, 1 + 5 * pct);
}
}
ofSetColor(0xFFFFFF);
return this.bikeIcon.draw(300, 500, 20, 20);
};
return imageLoaderExample;
})();
_.extend(this, ofAppRunner);
_.extend(this, ofGraphics);
_.extend(this, ofMath);
_.extend(this, OpenGL);
_.extend(this, ofImage);
_.extend(this, ofUtils);
window = new ofAppGlutWindow;
ofSetupOpenGL(window, 1024, 768, OF_WINDOW);
myapp = _.extend(new ofBaseApp, new imageLoaderExample);
ofRunApp(myapp);
}).call(this);
|
var config = {
apiKey: "AIzaSyCVr8kNbA_47LwbKBesa4PzggiQoMtD6nA",
authDomain: "absen-143db.firebaseapp.com",
databaseURL: "https://absen-143db.firebaseio.com",
projectId: "absen-143db",
storageBucket: "absen-143db.appspot.com",
messagingSenderId: "993994713726"
};
firebase.initializeApp(config);
var date = new Date(),
year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate(),
submit_date = year + '-' + month + '-' + day;
function initializeAbsent() {
firebase.database().ref('absen/' + submit_date).update({
ACHMAD_RIFKI: 'none',
ADI_PRATAMA: 'none',
ADINDA_CHANTIKA_LUBIS: 'none',
AHMAD_ROMADHANI: 'none',
AMMAR_ABDULLAH_ALZAHID: 'none',
ANDRE_CHRISTOGA_PRAMADITYA: 'none',
ARIEFIN_NUGROHO: 'none',
AVRYLIYANAH_DEWY: 'none',
BAYU_AJI: 'none',
EDO_YUDHA_WASKITA: 'none',
FAATHIR_RAMADHAN_ALFIRAH: 'none',
FADHLI_FADHILAH: 'none',
JULIDAR_FATIANI: 'none',
KRIS_DAMAYANTI: 'none',
M_AKHSIN_PRASETYO: 'none',
MATHIUS: 'none',
MOCHAMAD_RECHAN_ICHSANUL_KAMIL: 'none',
MUHAMAD_KAMAL_BACRUR_ROZIKIN: 'none',
MUHAMAD_RACHMAT_HIDAYAT: 'none',
MUHAMAD_RESMI_AJI: 'none',
MUHAMMAD_ABID_MULYANA: 'none',
MUHAMMAD_AKBAR_HABIBY_KHALID: 'none',
MUHAMMAD_ELVAN: 'none',
MUHAMMAD_FADHIL_RABBANI: 'none',
MUHAMMAD_RIVAN_AL_RASYID: 'none',
NAHDA_KHAIRUNNISA: 'none',
NAHLA_TARISAFITRI: 'none',
NUR_AENI: 'none',
RAMADHANU: 'none',
REZA_SAFPUTRA: 'none',
RISKI_RANDANTI: 'none',
RIZKI_RAMADHAN_IMAN_MUDA: 'none',
RIZKI_SALSA_BILLA: 'none',
SYAHRUL_LESMANA: 'none',
WINDI_AYU_WULANDARI: 'none',
YAZID_AMIRULLAH: 'none'
}, function(error) {
if (!error) {
alert('It\'s up bro!')
}
})
}
function completeAbsence() {
firebase.database().ref('absen/' + submit_date).update({
ACHMAD_RIFKI: 'hadir',
ADI_PRATAMA: 'hadir',
ADINDA_CHANTIKA_LUBIS: 'hadir',
AHMAD_ROMADHANI: 'hadir',
AMMAR_ABDULLAH_ALZAHID: 'hadir',
ANDRE_CHRISTOGA_PRAMADITYA: 'hadir',
ARIEFIN_NUGROHO: 'hadir',
AVRYLIYANAH_DEWY: 'hadir',
BAYU_AJI: 'hadir',
EDO_YUDHA_WASKITA: 'hadir',
FAATHIR_RAMADHAN_ALFIRAH: 'hadir',
FADHLI_FADHILAH: 'hadir',
JULIDAR_FATIANI: 'hadir',
KRIS_DAMAYANTI: 'hadir',
M_AKHSIN_PRASETYO: 'hadir',
MATHIUS: 'hadir',
MOCHAMAD_RECHAN_ICHSANUL_KAMIL: 'hadir',
MUHAMAD_KAMAL_BACRUR_ROZIKIN: 'hadir',
MUHAMAD_RACHMAT_HIDAYAT: 'hadir',
MUHAMAD_RESMI_AJI: 'hadir',
MUHAMMAD_ABID_MULYANA: 'hadir',
MUHAMMAD_AKBAR_HABIBY_KHALID: 'hadir',
MUHAMMAD_ELVAN: 'hadir',
MUHAMMAD_FADHIL_RABBANI: 'hadir',
MUHAMMAD_RIVAN_AL_RASYID: 'hadir',
NAHDA_KHAIRUNNISA: 'hadir',
NAHLA_TARISAFITRI: 'hadir',
NUR_AENI: 'hadir',
RAMADHANU: 'hadir',
REZA_SAFPUTRA: 'hadir',
RISKI_RANDANTI: 'hadir',
RIZKI_RAMADHAN_IMAN_MUDA: 'hadir',
RIZKI_SALSA_BILLA: 'hadir',
SYAHRUL_LESMANA: 'hadir',
WINDI_AYU_WULANDARI: 'hadir',
YAZID_AMIRULLAH: 'hadir'
}, function(error) {
if (!error) {
alert('It\'s up bro!')
}
})
}
function editAbsent() {
var nama = $('#studentName').val();
var status = $('#studentStatus').val();
firebase.database().ref('absen/' + submit_date).update({
[nama]: status
}, function(error) {
if (!error) {
alert('It\'s up bro!')
}
})
}
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The Date.prototype has the property "getFullYear"
esid: sec-properties-of-the-date-prototype-object
es5id: 15.9.5_A10_T1
description: The Date.prototype has the property "getFullYear"
---*/
if (Date.prototype.hasOwnProperty("getFullYear") !== true) {
$ERROR('#1: The Date.prototype has the property "getFullYear"');
}
|
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-put-prop-ref-user-err.case
// - src/dstr-assignment/error/assignment-expr.template
/*---
description: Any error raised as a result of setting the value should be forwarded to the runtime. (AssignmentExpression)
esid: sec-variable-statement-runtime-semantics-evaluation
es6id: 13.3.2.4
features: [destructuring-binding]
flags: [generated]
info: |
VariableDeclaration : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let rval be GetValue(rhs).
3. ReturnIfAbrupt(rval).
4. Return the result of performing BindingInitialization for
BindingPattern passing rval and undefined as arguments.
---*/
var x = {
set y(val) {
throw new Test262Error();
}
};
assert.throws(Test262Error, function() {
0, [x.y] = [23];
});
|
/**
* Datasets module includes some standard toy datasets. In addition, this module also includes various
* random sample generators that can be used to build artificial datasets of controlled size and complexity.
* @module datasets
* @example <caption>Asynchronous loading</caption>
* var qm = require('qminer');
* var datasets = qm.datasets;
*
* // Create clean base
* var base = new qm.Base({ mode: 'createClean' });
*
* // Load Iris dataset in async way
* datasets.loadIris(base, function (err, store) {
* if (err) throw err;
* // Sucessfully loaded database
* base.close();
* });
*
* @example <caption>Synchronous loading</caption>
* var qm = require('qminer');
* var datasets = qm.datasets;
*
* // Create clean base
* var base = new qm.Base({ mode: 'createClean' });
*
* // Load Iris in sync way.
* var Iris = datasets.loadIrisSync(base);
* // Sucessfully loaded database
* base.close();
*/
/**
* Loads Iris dataset in asynchronous way. Returns link to the created Irsi store.
* @param {module:qm.Base} base
* @returns {module:qm.Store} Store with Iris dataset.
*/
exports.loadIris = function (_base, callback) {
var options = {
file: __dirname + '/data/iris.csv',
store: 'Iris',
base: _base
}
_base.loadCSV(options, function (err) {
if (err) return callback(err);
var Iris = _base.store(options.store);
return callback(null, Iris)
})
}
/**
* Loads Iris dataset in synchronous way. Returns link to the created Iris store.
* @param {module:qm.Base} base
* @returns {module:qm.Store} Store with Iris dataset.
*/
exports.loadIrisSync = function (_base) {
var options = {
file: __dirname + '/data/iris.csv',
store: 'Iris',
base: _base
}
_base.loadCSV(options);
return _base.store(options.store);
}
// Module description
exports.description = function () {
return ("Module includes functions to load and make datasets.");
}
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {$} from 'chrome://resources/js/util.m.js';
import {GetSsrcFromReport, SsrcInfoManager} from './ssrc_info_manager.js';
/**
* Maintains the stats table.
* @param {SsrcInfoManager} ssrcInfoManager The source of the ssrc info.
*/
export class StatsTable {
/**
* @param {SsrcInfoManager} ssrcInfoManager The source of the ssrc info.
*/
constructor(ssrcInfoManager) {
/**
* @type {SsrcInfoManager}
* @private
*/
this.ssrcInfoManager_ = ssrcInfoManager;
}
/**
* Adds |report| to the stats table of |peerConnectionElement|.
*
* @param {!Element} peerConnectionElement The root element.
* @param {!Object} report The object containing stats, which is the object
* containing timestamp and values, which is an array of strings, whose
* even index entry is the name of the stat, and the odd index entry is
* the value.
*/
addStatsReport(peerConnectionElement, report) {
if (report.type === 'codec') {
return;
}
const statsTable = this.ensureStatsTable_(peerConnectionElement, report);
if (report.stats) {
this.addStatsToTable_(
statsTable, report.stats.timestamp, report.stats.values);
}
}
clearStatsLists(peerConnectionElement) {
const containerId = peerConnectionElement.id + '-table-container';
const container = $(containerId);
if (container) {
peerConnectionElement.removeChild(container);
this.ensureStatsTableContainer_(peerConnectionElement);
}
}
/**
* Ensure the DIV container for the stats tables is created as a child of
* |peerConnectionElement|.
*
* @param {!Element} peerConnectionElement The root element.
* @return {!Element} The stats table container.
* @private
*/
ensureStatsTableContainer_(peerConnectionElement) {
const containerId = peerConnectionElement.id + '-table-container';
let container = $(containerId);
if (!container) {
container = document.createElement('div');
container.id = containerId;
container.className = 'stats-table-container';
const head = document.createElement('div');
head.textContent = 'Stats Tables';
container.appendChild(head);
peerConnectionElement.appendChild(container);
}
return container;
}
/**
* Ensure the stats table for track specified by |report| of PeerConnection
* |peerConnectionElement| is created.
*
* @param {!Element} peerConnectionElement The root element.
* @param {!Object} report The object containing stats, which is the object
* containing timestamp and values, which is an array of strings, whose
* even index entry is the name of the stat, and the odd index entry is
* the value.
* @return {!Element} The stats table element.
* @private
*/
ensureStatsTable_(peerConnectionElement, report) {
const tableId = peerConnectionElement.id + '-table-' + report.id;
let table = $(tableId);
if (!table) {
const container = this.ensureStatsTableContainer_(peerConnectionElement);
const details = document.createElement('details');
container.appendChild(details);
const summary = document.createElement('summary');
summary.textContent = report.id + ' (' + report.type + ')';
details.appendChild(summary);
table = document.createElement('table');
details.appendChild(table);
table.id = tableId;
table.border = 1;
table.appendChild($('trth-template').content.cloneNode(true));
table.rows[0].cells[0].textContent = 'Statistics ' + report.id;
if (report.type === 'ssrc') {
table.insertRow(1);
table.rows[1].appendChild(
$('td-colspan-template').content.cloneNode(true));
this.ssrcInfoManager_.populateSsrcInfo(
table.rows[1].cells[0], GetSsrcFromReport(report));
}
}
return table;
}
/**
* Update |statsTable| with |time| and |statsData|.
*
* @param {!Element} statsTable Which table to update.
* @param {number} time The number of milliseconds since epoch.
* @param {Array<string>} statsData An array of stats name and value pairs.
* @private
*/
addStatsToTable_(statsTable, time, statsData) {
const date = new Date(time);
this.updateStatsTableRow_(statsTable, 'timestamp', date.toLocaleString());
for (let i = 0; i < statsData.length - 1; i = i + 2) {
this.updateStatsTableRow_(statsTable, statsData[i], statsData[i + 1]);
}
}
/**
* Update the value column of the stats row of |rowName| to |value|.
* A new row is created is this is the first report of this stats.
*
* @param {!Element} statsTable Which table to update.
* @param {string} rowName The name of the row to update.
* @param {string} value The new value to set.
* @private
*/
updateStatsTableRow_(statsTable, rowName, value) {
const trId = statsTable.id + '-' + rowName;
let trElement = $(trId);
const activeConnectionClass = 'stats-table-active-connection';
if (!trElement) {
trElement = document.createElement('tr');
trElement.id = trId;
statsTable.firstChild.appendChild(trElement);
const item = $('td2-template').content.cloneNode(true);
item.querySelector('td').textContent = rowName;
trElement.appendChild(item);
}
trElement.cells[1].textContent = value;
// Highlights the table for the active connection.
if (rowName === 'googActiveConnection') {
if (value === true) {
statsTable.parentElement.classList.add(activeConnectionClass);
} else {
statsTable.parentElement.classList.remove(activeConnectionClass);
}
}
}
}
|
import instanceCreate from './instanceCreate';
import instanceGet from './instanceGet';
import instanceCommitGet from './instanceCommitsGet';
export default {
init(app) {
app.post('/api/instances', instanceCreate);
app.get('/api/instances/:instanceId', instanceGet);
app.get('/api/:instanceId/commits/tags/versionone/workitem', instanceCommitGet);
}
};
|
// This is the base browser library for dy.js. It is all that is needed in the
// browser for modules written for dy.js to work.
//
// In development you'd probably also want to include the dy/ext/reload
// extension to add dynamic reloading functionality. However, in production
// this is the *only* code you need (plus a `dy.load()` somewhere) for your
// dy.js-compatible code to work.
(function (window) {
var dy = function (name, dependencies, initializer) {
var self = dy.retrieveOrCreateModule(name)
// Ensure all the dependencies exist
dependencies = dependencies.map(function (dep) {
return dy.retrieveOrCreateModule(dep)
})
initializer.apply(self, dependencies)
}
// Registry of all active modules
dy.modules = {}
dy.retrieveOrCreateModule = function (name) {
if (dy.modules[name] === undefined) {
// Set up new instance
dy.modules[name] = {}
}
// Retrieve the instance of the module
return dy.modules[name]
}
// Trigger _load() hook on all loaded modules
dy.load = function () {
for (var name in dy.modules) {
if (dy.modules.hasOwnProperty(name) && dy.modules[name]._load !== undefined) {
dy.modules[name]._load()
}
}
}
if (window) {
window.dy = dy;
}
})(window);
|
var logging = require('logging');
var Events = function(options) {
options = options || {};
};
Events.prototype.on = function(event, fn) {
var _this = this;
_this._events = _this._events || {};
_this._events[event] = this._events[event] || [];
_this._events[event].push(fn);
};
Events.prototype.off = function(event, fn) {
var _this = this;
_this._events = _this._events || {};
if (event in _this._events === false) {
return;
}
_this._events[event].splice(_this._events[event].indexOf(fn), 1);
};
Events.prototype.trigger = function(event) {
var _this = this;
_this._events = _this._events || {};
if (event in _this._events === false) {
return;
}
logging.debug("Events.trigger()", event, arguments);
for(var i = 0; i < _this._events[event].length; i++) {
_this._events[event][i].apply(_this, Array.prototype.slice.call(arguments, 1));
}
};
Events.mixin = function(dest) {
['on','off','trigger'].forEach(function(method) {
if (typeof dest === 'function') {
dest.prototype[method] = Events.prototype[method];
} else {
dest[method] = Events.prototype[method];
}
});
};
module.exports.Events = Events;
module.exports.hub = new Events();
// This defines the list of events intended to be used with the
// global event "hub".
module.exports.EVT = {
ALIGN: 'align',
CLEAR_HIGHLIGHTS: 'clear_highlights',
DELETE_ALIGNMENTS: 'delete_alignments',
BUILD_INDEX: 'build_index',
EXPORT: 'export',
LOGIN: 'login',
LOADING: 'loading',
ERROR: 'error',
NOTIFICATION: 'notification'
};
|
/*global FormplayerFrontend */
FormplayerFrontend.module("Layout.Views", function (Views, FormplayerFrontend, Backbone, Marionette) {
Views.ProgressView = Marionette.ItemView.extend({
template: "#progress-view-template",
initialize: function(options) {
this.progressMessage = options.progressMessage;
},
templateHelpers: function() {
return {
progressMessage: this.progressMessage,
};
},
setProgress: function(done, total, duration) {
var progress = total === 0 ? 0 : done / total;
// Due to jQuery bug, can't use .animate() with % until jQuery 3.0
$(this.el).find('.js-progress-bar').css('transition', duration + 'ms');
$(this.el).find('.js-progress-bar').width(progress * 100 + '%');
if (total > 0) {
$(this.el).find('.js-subtext small').text(
gettext('Completed: ') + done + '/' + total
);
}
},
});
});
|
import 'normalize.css';
import React from 'react';
import ReactDOM from 'react-dom';
import Coordinate2DWidget from 'paraviewweb/src/React/Widgets/Coordinate2DWidget';
const height = 100;
const width = 100;
ReactDOM.render(
React.createElement(Coordinate2DWidget, {
height,
width,
onChange: console.log,
hideXY: true,
}),
document.querySelector('.content')
);
|
export {a, b as c, d, } from "my-module";
|
d3 = {version: "2.7.5"}; // semver
|
// Covers TCPWRAP and related TCPCONNECTWRAP
'use strict';
const common = require('../common');
const assert = require('assert');
const tick = require('./tick');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');
if (!common.hasIPv6) {
common.skip('IPv6 support required');
return;
}
const net = require('net');
let tcp1, tcp2, tcp3;
let tcpconnect;
const hooks = initHooks();
hooks.enable();
const server = net
.createServer(common.mustCall(onconnection))
.on('listening', common.mustCall(onlistening));
// Calling server.listen creates a TCPWRAP synchronously
{
server.listen(common.PORT);
const tcps = hooks.activitiesOfTypes('TCPWRAP');
const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP');
assert.strictEqual(tcps.length, 1);
assert.strictEqual(tcpconnects.length, 0);
tcp1 = tcps[0];
assert.strictEqual(tcp1.type, 'TCPWRAP');
assert.strictEqual(typeof tcp1.uid, 'number');
assert.strictEqual(typeof tcp1.triggerId, 'number');
checkInvocations(tcp1, { init: 1 }, 'when calling server.listen');
}
// Calling net.connect creates another TCPWRAP synchronously
{
net.connect(
{ port: server.address().port, host: server.address().address },
common.mustCall(onconnected));
const tcps = hooks.activitiesOfTypes('TCPWRAP');
assert.strictEqual(tcps.length, 2);
process.nextTick(() => {
const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP');
assert.strictEqual(tcpconnects.length, 1);
});
tcp2 = tcps[1];
assert.strictEqual(tcps.length, 2);
assert.strictEqual(tcp2.type, 'TCPWRAP');
assert.strictEqual(typeof tcp2.uid, 'number');
assert.strictEqual(typeof tcp2.triggerId, 'number');
checkInvocations(tcp1, { init: 1 }, 'tcp1 when client is connecting');
checkInvocations(tcp2, { init: 1 }, 'tcp2 when client is connecting');
}
function onlistening() {
assert.strictEqual(hooks.activitiesOfTypes('TCPWRAP').length, 2);
}
// Depending on timing we see client: onconnected or server: onconnection first
// Therefore we can't depend on any ordering, but when we see a connection for
// the first time we assign the tcpconnectwrap.
function ontcpConnection(serverConnection) {
if (tcpconnect != null) {
// When client receives connection first ('onconnected') and the server
// second then we see an 'after' here, otherwise not
const expected = serverConnection ?
{ init: 1, before: 1, after: 1 } :
{ init: 1, before: 1 };
checkInvocations(
tcpconnect, expected,
'tcpconnect: when both client and server received connection');
return;
}
// only focusing on TCPCONNECTWRAP here
const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP');
assert.strictEqual(tcpconnects.length, 1);
tcpconnect = tcpconnects[0];
assert.strictEqual(tcpconnect.type, 'TCPCONNECTWRAP');
assert.strictEqual(typeof tcpconnect.uid, 'number');
assert.strictEqual(typeof tcpconnect.triggerId, 'number');
// When client receives connection first ('onconnected'), we 'before' has
// been invoked at this point already, otherwise it only was 'init'ed
const expected = serverConnection ? { init: 1 } : { init: 1, before: 1 };
checkInvocations(tcpconnect, expected,
'tcpconnect: when tcp connection is established');
}
let serverConnected = false;
function onconnected() {
ontcpConnection(false);
// In the case that the client connects before the server TCPWRAP 'before'
// and 'after' weren't invoked yet. Also @see ontcpConnection.
const expected = serverConnected ?
{ init: 1, before: 1, after: 1 } :
{ init: 1 };
checkInvocations(tcp1, expected, 'tcp1 when client connects');
checkInvocations(tcp2, { init: 1 }, 'tcp2 when client connects');
}
function onconnection(c) {
serverConnected = true;
ontcpConnection(true);
const tcps = hooks.activitiesOfTypes([ 'TCPWRAP' ]);
const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP');
assert.strictEqual(tcps.length, 3);
assert.strictEqual(tcpconnects.length, 1);
tcp3 = tcps[2];
assert.strictEqual(tcp3.type, 'TCPWRAP');
assert.strictEqual(typeof tcp3.uid, 'number');
assert.strictEqual(typeof tcp3.triggerId, 'number');
checkInvocations(tcp1, { init: 1, before: 1 },
'tcp1 when server receives connection');
checkInvocations(tcp2, { init: 1 }, 'tcp2 when server receives connection');
checkInvocations(tcp3, { init: 1 }, 'tcp3 when server receives connection');
c.end();
this.close(common.mustCall(onserverClosed));
}
function onserverClosed() {
checkInvocations(tcp1, { init: 1, before: 1, after: 1, destroy: 1 },
'tcp1 when server is closed');
checkInvocations(tcp2, { init: 1, before: 2, after: 2, destroy: 1 },
'tcp2 when server is closed');
checkInvocations(tcp3, { init: 1, before: 1, after: 1 },
'tcp3 synchronously when server is closed');
tick(2, () => {
checkInvocations(tcp3, { init: 1, before: 2, after: 2, destroy: 1 },
'tcp3 when server is closed');
checkInvocations(tcpconnect, { init: 1, before: 1, after: 1, destroy: 1 },
'tcpconnect when server is closed');
});
}
process.on('exit', onexit);
function onexit() {
hooks.disable();
hooks.sanityCheck([ 'TCPWRAP', 'TCPCONNECTWRAP' ]);
checkInvocations(tcp1, { init: 1, before: 1, after: 1, destroy: 1 },
'tcp1 when process exits');
checkInvocations(
tcp2, { init: 1, before: 2, after: 2, destroy: 1 },
'tcp2 when process exits');
checkInvocations(
tcp3, { init: 1, before: 2, after: 2, destroy: 1 },
'tcp3 when process exits');
checkInvocations(
tcpconnect, { init: 1, before: 1, after: 1, destroy: 1 },
'tcpconnect when process exits');
}
|
/*jslint indent: 2 */
/*global document: false, $: false, localStorage: false, chrome:false*/
'use strict';
var userData, offlineUser;
offlineUser = localStorage.getItem('offline_users');
if (offlineUser) {
userData = JSON.parse(localStorage.getItem('offline_users-' + offlineUser));
if (userData && userData.offlineData) {
chrome.extension.sendMessage({
type: 'userToken',
apiToken: userData.offlineData.api_token
});
}
}
(function () {
var version, source, s;
version = chrome.runtime.getManifest().version;
source = 'window.TogglButton = { version: "' + version + '" }';
s = document.createElement('script');
s.textContent = source;
document.body.appendChild(s);
}());
document.addEventListener('webkitvisibilitychange', function () {
if (!document.webkitHidden) {
chrome.extension.sendMessage({type: "sync"}, function () {return; });
}
});
chrome.extension.sendMessage({type: "sync"}, function () {return; });
|
import Rx from 'rxjs/Rx';
import {
createMessage,
} from '../kernel/messaging';
import {
COMM_OPEN,
COMM_MESSAGE,
COMM_ERROR,
NEW_KERNEL,
} from '../constants';
/**
* creates a comm open message
* @param {string} comm_id uuid
* @param {string} target_name comm handler
* @param {any} data up to the target handler
* @param {string} target_module [Optional] used to select a module that is responsible for handling the target_name
* @return {jmp.Message} Message ready to send on the shell channel
*/
export function createCommOpenMessage(comm_id, target_name, data = {}, target_module) {
const msg = createMessage('comm_open', { content: { comm_id, target_name, data } });
if (target_module) {
msg.content.target_module = target_module;
}
return msg;
}
/**
* creates a comm message for sending to a kernel
* @param {string} comm_id unique identifier for the comm
* @param {Object} data any data to send for the comm
* @param {Uint8Array} buffers arbitrary binary data to send on the comm
* @return {jmp.Message} jupyter message for comm_msg
*/
export function createCommMessage(comm_id, data = {}, buffers = new Uint8Array()) {
return createMessage('comm_msg', { content: { comm_id, data }, buffers });
}
/**
* creates a comm close message for sending to a kernel
* @param {Object} parent_header header from a parent jupyter message
* @param {string} comm_id unique identifier for the comm
* @param {Object} data any data to send for the comm
* @return {jmp.Message} jupyter message for comm_msg
*/
export function createCommCloseMessage(parent_header, comm_id, data = {}) {
return createMessage('comm_close', { content: { comm_id, data }, parent_header });
}
/**
* creates a comm error action
* @param {error} error any type of error to pass on
* @return {Object} Flux standard error action
*/
export const createCommErrorAction = error =>
Rx.Observable.of({
type: COMM_ERROR,
payload: error,
error: true,
});
/**
* Action creator for comm_open messages
* @param {jmp.Message} a comm_open message
* @return {Object} COMM_OPEN action
*/
export function commOpenAction(message) {
// invariant: expects a comm_open message
return {
type: COMM_OPEN,
data: message.content.data,
metadata: message.content.metadata,
comm_id: message.content.comm_id,
target_name: message.content.target_name,
target_module: message.content.target_module,
// Pass through the buffers
buffers: message.blob || message.buffers,
// NOTE: Naming inconsistent between jupyter notebook and jmp
// see https://github.com/n-riesco/jmp/issues/14
// We just expect either one
};
}
/**
* Action creator for comm_msg messages
* @param {jmp.Message} a comm_msg
* @return {Object} COMM_MESSAGE action
*/
export function commMessageAction(message) {
return {
type: COMM_MESSAGE,
comm_id: message.content.comm_id,
data: message.content.data,
// Pass through the buffers
buffers: message.blob || message.buffers,
// NOTE: Naming inconsistent between jupyter notebook and jmp
// see https://github.com/n-riesco/jmp/issues/14
// We just expect either one
};
}
/**
* creates all comm related actions given a new kernel action
* @param {Object} newKernelAction a NEW_KERNEL action
* @return {ActionsObservable} all actions resulting from comm messages on this kernel
*/
export function commActionObservable(newKernelAction) {
const commOpenAction$ = newKernelAction.channels.iopub
.ofMessageType(['comm_open'])
.map(commOpenAction);
const commMessageAction$ = newKernelAction.channels.iopub
.ofMessageType(['comm_msg'])
.map(commMessageAction);
return Rx.Observable.merge(
commOpenAction$,
commMessageAction$
).retry();
}
/**
* An epic that emits comm actions from the backend kernel
* @param {ActionsObservable} action$ Action Observable from redux-observable
* @param {redux.Store} store the redux store
* @return {ActionsObservable} Comm actions
*/
export const commListenEpic = action$ =>
action$.ofType(NEW_KERNEL)
// We have a new channel
.switchMap(commActionObservable);
|
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
define(["require", "exports", '../Binding'], function (require, exports, Binding) {
var ArrayBinding = (function (_super) {
__extends(ArrayBinding, _super);
function ArrayBinding(kwArgs) {
_super.call(this, kwArgs);
var array = this._object = kwArgs.object;
var self = this;
var pop = array.pop;
array.pop = function () {
if (this.length) {
var oldValue = pop.apply(this, arguments);
self.notify && self.notify({ index: this.length, removed: [oldValue] });
return oldValue;
}
};
var push = array.push;
array.push = function () {
var newValues = [];
for (var _i = 0; _i < arguments.length; _i++) {
newValues[_i - 0] = arguments[_i];
}
var newLength = push.apply(this, arguments);
self.notify && self.notify({ index: newLength - newValues.length, added: newValues });
return newLength;
};
var reverse = array.reverse;
array.reverse = function () {
var oldValues = this.slice(0);
var returnValue = reverse.apply(this, arguments);
self.notify && self.notify({ index: 0, removed: oldValues, added: this });
return returnValue;
};
var shift = array.shift;
array.shift = function () {
if (this.length) {
var oldValue = shift.apply(this, arguments);
self.notify && self.notify({ index: 0, removed: [oldValue] });
return oldValue;
}
};
var sort = array.sort;
array.sort = function () {
var oldValues = this.slice(0);
var returnValue = sort.apply(this, arguments);
self.notify && self.notify({ index: 0, removed: oldValues, added: this });
return returnValue;
};
var splice = array.splice;
array.splice = function (index, numToRemove) {
if (numToRemove === void 0) { numToRemove = 0; }
var newValues = [];
for (var _i = 2; _i < arguments.length; _i++) {
newValues[_i - 2] = arguments[_i];
}
var oldValues = splice.apply(this, arguments);
self.notify && self.notify({ index: index, removed: oldValues, added: newValues });
return oldValues;
};
var unshift = array.unshift;
array.unshift = function () {
var newValues = [];
for (var _i = 0; _i < arguments.length; _i++) {
newValues[_i - 0] = arguments[_i];
}
var newLength = unshift.apply(this, arguments);
self.notify && self.notify({ index: 0, added: newValues });
return newLength;
};
}
ArrayBinding.test = function (kwArgs) {
return kwArgs.object instanceof Array && kwArgs.path === '*';
};
ArrayBinding.prototype.getObject = function () {
return this._object;
};
ArrayBinding.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this._object = this.notify = null;
};
return ArrayBinding;
})(Binding);
return ArrayBinding;
});
//# sourceMappingURL=../../_debug/binding/bindings/ArrayBinding.js.map
|
'use strict';
//var bhl_url = "http://words.bighugelabs.com/api/2/d1cbb0c53ddabe240d726e3fc76b1491/";
var bhl_url = "http://words.bighugelabs.com/api/2/0791f67e8212761406e388ef91856024/";
var sel_x = 0, sel_y = 0;
var word = '';
var help_paragraph_en = $('<p></p>').addClass('help-paragraph').text("Click the mouse or any key to close");
var error_paragraph_en = $('<p></p>').text("Sorry, no synonyms found");
chrome.runtime.onMessage.addListener(
function(req, sen, sendResponse) {
if (req.action == "enable synonyms") {
if (req.status == true) {
$(document).bind('dblclick', onDoubleClickEn);
console.log("Activating synonyms");
} else {
$(document).unbind('dblclick', onDoubleClickEn);
console.log("Deactivating synonyms");
}
}
}
);
function onDoubleClickEn(e) {
get_selection_en();
console.log("Word: " + word);
}
function get_selection_en() {
var txt = '';
var zoomCoef = 1;
chrome.storage.local.get({ 'token' : "", 'preferences' : {} }, function(results) {
console.log("Antes de control de error: " + JSON.stringify(results));
if (!(chrome.runtime.lastError)) {
console.log("No error: " + JSON.stringify(results['preferences']));
if (results['preferences'].hasOwnProperty('magnification')) {
zoomCoef = results['preferences'].magnification;
}
console.log("ZoomCoef: " + results['preferences'].magnification);
if (window.getSelection) {
txt = window.getSelection();
var selection = txt.getRangeAt(0);
var bodyRect = document.body.getBoundingClientRect();
var sel_xx = selection.getBoundingClientRect().left;
var sel_yy = selection.getBoundingClientRect().top;
sel_x = (sel_xx - bodyRect.left) / zoomCoef;
sel_y = (sel_yy - bodyRect.top) / zoomCoef;
} else if (document.getSelection) {
txt = document.getSelection();
var selection = txt.getRangeAt(0);
var bodyRect = document.body.getBoundingClientRect();
var sel_xx = selection.getBoundingClientRect().left;
var sel_yy = selection.getBoundingClientRect().top;
sel_x = (sel_xx - bodyRect.left) / zoomCoef;
sel_y = (sel_yy - bodyRect.top) / zoomCoef;
} else if (document.selection) {
txt = document.selection.createRange().text;
}
console.log("Position X: " + sel_x + " - Y: " + sel_y);
word = $.trim(txt.toString());
displaySynonims();
}
});
}
function displaySynonims()
{
if (word.length > 0) {
chrome.runtime.sendMessage({
method: 'GET',
action: 'xhttp',
url: bhl_url + word + "/json",
format: 'application/json'
}, function(responseText) {
var synonyms = JSON.parse(responseText);
if(synonyms.hasOwnProperty('error'))
{
showErrorTooltipEn();
}
else
{
console.log("Xhttp response: " + responseText);
showTooltipEn(synonyms);
/*Callback function to deal with the response*/
}
});
}
}
function showTooltipEn(synonyms) {
//var synonyms = JSON.parse(synonymsJSON);
var tooltipDiv = $("<div class='tooltip'></div>");
$(tooltipDiv).css("top", sel_y);
$(tooltipDiv).css("left", sel_x);
var superTitle = $("<h2></h2>").text('Synonyms of "' + word + '"');
$(tooltipDiv).append(superTitle);
if (synonyms.hasOwnProperty("noun")) {
if ((synonyms.noun.hasOwnProperty("syn")) && (synonyms.noun.syn.length > 0) ) {
var synonymsList = synonyms.noun.syn.join(", ");
}
var title = $("<h3></h3>").text("Noun");
var par = $("<p></p>").text(synonymsList);
$(tooltipDiv).append(title);
$(tooltipDiv).append(par);
}
if (synonyms.hasOwnProperty("verb")) {
if ((synonyms.verb.hasOwnProperty("syn")) && (synonyms.verb.syn.length > 0) ) {
var synonymsList = synonyms.verb.syn.join(", ");
}
var title = $("<h3></h3>").text("Verb");
var par = $("<p></p>").text(synonymsList);
$(tooltipDiv).append(title);
$(tooltipDiv).append(par);
}
if (synonyms.hasOwnProperty("adjective")) {
if ((synonyms.adjective.hasOwnProperty("syn")) && (synonyms.adjective.syn.length > 0) ) {
var synonymsList = synonyms.adjective.syn.join(", ");
}
var title = $("<h3></h3>").text("Adjective");
var par = $("<p></p>").text(synonymsList);
$(tooltipDiv).append(title);
$(tooltipDiv).append(par);
}
if (synonyms.hasOwnProperty("adverb")) {
if ((synonyms.adverb.hasOwnProperty("syn")) && (synonyms.adverb.syn.length > 0) ) {
var synonymsList = synonyms.adverb.syn.join(", ");
}
var title = $("<h3></h3>").text("Adverb");
var par = $("<p></p>").text(synonymsList);
$(tooltipDiv).append(title);
$(tooltipDiv).append(par);
}
$(tooltipDiv).append(help_paragraph_en);
$('body').append(tooltipDiv);
}
function showErrorTooltipEn() {
var tooltipDiv = $("<div class='tooltip'></div>");
$(tooltipDiv).css("top", sel_y);
$(tooltipDiv).css("left", sel_x);
var superTitle = $("<h2></h2>").text('Synonyms of "' + word + '"');
$(tooltipDiv).append(superTitle);
$(tooltipDiv).append(error_paragraph_en);
$(tooltipDiv).append(help_paragraph_en);
$('body').append(tooltipDiv);
}
$(document).keyup(function(e) {
$(".tooltip").remove();
});
$(document).mousedown(function(e) {
$(".tooltip").remove();
});
|
define([
"./SwigTemplate",
"elenajs/node!path"
], function(SwigTemplate, path) {
var cache = {};
return {
module: 'swig',
load: function(id, require, load) {
var parts = id.split("!"),
url = path.resolve(require.toUrl(parts[0])),
result;
if (url in cache) {
result = cache[url];
} else {
try {
result = new SwigTemplate({templateSrc: url});
cache[url] = result;
} catch (err) {
console.error("rendering: " + url, err);
}
}
load(result);
}
};
});
|
/**
* @module Audio
* @namespace Audio
*/
var TW = TW || {};
define(['./Sound', '../Utils/Polyfills'], function(Sound) {
TW.Audio = TW.Audio || {};
/**
* Channel class is an utility for manage multiple sounds with a same source.
*
* By default, a sound object can't be played twice simulaneously.
* The correct way to do this is to use the Channel class.
*
* A Channel is a group of many Sound objets using the same source (so the same music).
*
* @class Channel
* @constructor
* @param {String|String[]} src The source(s) of channel.
* If many values are passed, the first compatible are used.
* @param {Number} max The number of sound allocated in this channel.
* @param {Number} id The identifier of the channel.
*/
function Channel(src, max, id) {
/**
* Array of Sound.
*
* @property {Sound[]} _sounds
* @default []
*/
this._sounds = [];
/**
* Callback function when all sound is ready to play in this channel.
*
* @property {Function} allSoundsReady
* @default null
*/
this.allSoundsReady = null;
/**
* Source sound for this channel.
* Can contains many values (first compatible are used).
*
* @property {String|String[]} _src
* @private
*/
this._src = src;
/**
* Channel id.
*
* @property {Number} id
* @default id
* @readonly
*/
this.id = id;
this.add(max);
}
/**
* Add max sound instance with sources in channel.
*
* @method add
* @param {Number} max The number of sound allocated in this channel.
*/
Channel.prototype.add = function(max) {
while (this._sounds.length < max) {
this._sounds.push(new Sound(this._src));
}
};
/**
* Load all sound.
*
* @method load
*/
Channel.prototype.load = function() {
var handleAllSoundsReady = function() {
if (this.allSoundsReady !== null) {
this.allSoundsReady(this);
}
}.bind(this);
for (var i = 0; i < this._sounds.length; ++i) {
var sound = this._sounds[i];
if (i === 0) {
sound.onReady = handleAllSoundsReady;
}
sound.load(0, 0, 1);
}
};
/**
* Get a playable sound.
*
* @method getPlayableSound
* @return {Object} A playable sound.
*/
Channel.prototype.getPlayableSound = function() {
for (var i = 0; i < this._sounds.length; ++i) {
var sound = this._sounds[i];
if (sound.playState !== TW.Audio.AUDIO_PLAYED) {
return sound;
}
}
this._sounds[0].stop();
return this._sounds[0];
};
/**
* Applies the command to all sounds.
*
* @method _tellAllSounds
* @param {String} command commands availables:
*
* - `"pause"`
* - `"resume"`
* - `"setVolume"`
* - `"mute"`
* - `"stop"`
*
* @param {*} [value] argument
* @private
*/
Channel.prototype._tellAllSounds = function(command, value) {
for (var i = this._sounds.length - 1; i >= 0; --i) {
var sound = this._sounds[i];
switch (command) {
case "pause":
sound.pause();
break;
case "resume":
sound.resume();
break;
case "setVolume":
sound.setVolume(value);
break;
case "mute":
sound.mute(value);
break;
case "stop":
sound.stop();
break;
default:
}
}
};
/**
* Mute or Unmute all sound in this channel.
*
* @method setMute
* @param {Boolean} isMuted True for mute or false for unmute.
*/
Channel.prototype.setMute = function(isMuted) {
this._tellAllSounds("mute", isMuted);
};
/**
* Pause all sound in this channel.
*
* @method pause
*/
Channel.prototype.pause = function() {
this._tellAllSounds("pause", null);
};
/**
* Resume all sound in this channel.
*
* @method resume
*/
Channel.prototype.resume = function() {
this._tellAllSounds("resume", null);
};
/**
* Stop all sound in this channel.
*
* @method stop
*/
Channel.prototype.stop = function() {
this._tellAllSounds("stop", null);
};
/**
* Set a volume for all sound in this channel.
*
* @method setMasterVolume
* @param {Number} value The value of volume needed. min: 0.0 -> max: 1.0
*/
Channel.prototype.setMasterVolume = function(value) {
this._tellAllSounds("setVolume", value);
};
TW.Audio.Channel = Channel;
return Channel;
});
|
dojo.provide("dojox.charting.plot2d.Bars");
dojo.require("dojox.charting.plot2d.common");
dojo.require("dojox.charting.plot2d.Base");
dojo.require("dojox.lang.utils");
dojo.require("dojox.lang.functional");
dojo.require("dojox.lang.functional.reversed");
(function(){
var df = dojox.lang.functional, du = dojox.lang.utils,
dc = dojox.charting.plot2d.common,
purgeGroup = df.lambda("item.purgeGroup()");
dojo.declare("dojox.charting.plot2d.Bars", dojox.charting.plot2d.Base, {
defaultParams: {
hAxis: "x", // use a horizontal axis named "x"
vAxis: "y", // use a vertical axis named "y"
gap: 0, // gap between columns in pixels
shadows: null // draw shadows
},
optionalParams: {}, // no optional parameters
constructor: function(chart, kwArgs){
this.opt = dojo.clone(this.defaultParams);
du.updateWithObject(this.opt, kwArgs);
this.series = [];
this.hAxis = this.opt.hAxis;
this.vAxis = this.opt.vAxis;
},
calculateAxes: function(dim){
var stats = dc.collectSimpleStats(this.series), t;
stats.hmin -= 0.5;
stats.hmax += 0.5;
t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t;
t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t;
this._calc(dim, stats);
return this;
},
render: function(dim, offsets){
if(this.dirty){
dojo.forEach(this.series, purgeGroup);
this.cleanGroup();
var s = this.group;
df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
}
var t = this.chart.theme, color, stroke, fill, f,
gap = this.opt.gap < this._vScaler.scale / 3 ? this.opt.gap : 0;
for(var i = this.series.length - 1; i >= 0; --i){
var run = this.series[i];
if(!this.dirty && !run.dirty){ continue; }
run.cleanGroup();
var s = run.group;
if(!run.fill || !run.stroke){
// need autogenerated color
color = run.dyn.color = new dojo.Color(t.next("color"));
}
stroke = run.stroke ? run.stroke : dc.augmentStroke(t.series.stroke, color);
fill = run.fill ? run.fill : dc.augmentFill(t.series.fill, color);
var baseline = Math.max(0, this._hScaler.bounds.lower),
xoff = offsets.l + this._hScaler.scale * (baseline - this._hScaler.bounds.lower),
yoff = dim.height - offsets.b - this._vScaler.scale * (1.5 - this._vScaler.bounds.lower) + gap;
for(var j = 0; j < run.data.length; ++j){
var v = run.data[j],
width = this._hScaler.scale * (v - baseline),
height = this._vScaler.scale - 2 * gap,
w = Math.abs(width);
if(w >= 1 && height >= 1){
var shape = s.createRect({
x: xoff + (width < 0 ? width : 0),
y: yoff - this._vScaler.scale * j,
width: w, height: height
}).setFill(fill).setStroke(stroke);
run.dyn.fill = shape.getFill();
run.dyn.stroke = shape.getStroke();
}
}
run.dirty = false;
}
this.dirty = false;
return this;
}
});
})();
|
const logger = require('../../lib/logger')()
module.exports = function (req, res, next) {
const loginToken = req.loginToken || ''
const userId = req.userId || ''
const contentType = req.headers['content-type'] || ''
logger.debug({
method: req.method,
url: req.url,
content_type: contentType,
login_token: loginToken,
user_id: userId
})
next()
}
|
var $ = require("jquery");
var _ = require("underscore");
var Backbone = require("backbone");
var User = require("../user");
var app = require("../app").app;
var SettingsView = Backbone.View.extend({
template : _.template($("#tmpl-settings-view").html()),
render : function(data){
data.user = User.current();
this.$el.html(this.template(data));
},
events : {
"click #change" : "changepassword",
"click #reset" : "reset",
"click #save" : "save"
},
reset : function(){
this.$el.find("#oldpassword").val("");
this.$el.find("#newpassword").val("");
this.$el.find("#repassword").val("");
},
changepassword : function(){
User.changePassword(this.$el.find("#oldpassword").val(),
this.$el.find("#newpassword").val(), this.$el.find("#repassword").val(),
function(){
app.alert("密码修改成功!","恭喜");
}, function(error){
app.alert(error, "修改失败");
})
},
save : function(){
User.saveBasic(this.$el.find("#realname").val(),
this.$el.find("#telephone").val(), this.$el.find("#qqnumber").val(),
this.$el.find("#wxnumber").val(), function(){
app.alert("修改成功", "基本信息");
AV.User.current().fetch();
}, function(error){
app.alert("修改失败","基本信息");
});
}
});
module.exports = SettingsView;
|
({
appDir: "../",
baseUrl: "js/",
dir: "../../dist/",
// optimize: "none",
paths: {
jquery: 'libs/jquery/jquery.min',
backbone: 'libs/backbone/backbone.min',
nunjucks: 'libs/nunjucks/nunjucks-slim',
underscore: 'libs/underscore/underscore-min',
blueimp: 'libs/blueimp/blueimp-gallery',
socketio: 'libs/socket/socket.io.min',
ds: 'libs/datastore/backbone-ds.min'
},
shim: {
nunjucks: { exports : 'nunjucks'},
backbone: {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
},
underscore: {
'exports': '_'
}
},
modules: [
//Optimize the application files.
{
name: "main",
}
]
})
|
/******************************************************************************
Copyright (c) 2016, Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation 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.
*****************************************************************************/
var m = require("mraa");
shared.pin = new m.Pwm(CONFIG.pin);
shared.pin.period_ms(19);
shared.pin.enable(true);
done();
|
/*
* Copyright (c) 2014, Groupon, Inc.
* 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 GROUPON 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
* HOLDER 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.
*/
'use strict';
const download = require('./download');
const getLatestVersion = require('./version');
function downloadChromeDriver(binPath, tempPath) {
return function withCallback(callback) {
return getLatestVersion((error, metadata) => {
if (error != null) {
return callback(error);
}
/* eslint no-console: 0 */
console.log(
'[testium] grabbing selenium chromedriver %s',
metadata.version
);
return download(
binPath,
tempPath,
metadata.version,
metadata.downloadUrl,
callback
);
});
};
}
module.exports = downloadChromeDriver;
|
import {
fonts,
spacing,
editionBreakpoints,
globalSpacingStyles
} from "@times-components/styleguide";
const fontSizeResolver = {
[editionBreakpoints.wide]: 20,
[editionBreakpoints.huge]: 22
};
export default breakpoint => ({
container: {
flex: 1,
paddingHorizontal: spacing(2),
paddingVertical: spacing(3)
},
headline: {
...globalSpacingStyles.tabletHeadline,
fontFamily: fonts.headline,
fontSize: fontSizeResolver[breakpoint],
lineHeight: fontSizeResolver[breakpoint]
},
imageContainer: {
width: "100%",
marginBottom: spacing(2)
},
summary: {
...globalSpacingStyles.tabletTeaser
}
});
|
var classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y =
[
[ "swizzleSelf", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#af2e3962f186209cd2f0ff04f2f029a7c", null ],
[ "xd", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#a8d5c658a8bea39b4f67274776893005f", null ],
[ "xf", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#ae87da1f81a42487596d2dae253090e7b", null ],
[ "yd", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#acd1fe537a2fa9132a5e04a4d93bd480d", null ],
[ "yf", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#aee38087663cb9738af856f9168b48920", null ],
[ "zd", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#a98665092c02747ae5787ea4a2c368c37", null ],
[ "zf", "classwblut_1_1geom_1_1_w_b___swizzle_1_1_x_z_y.html#a7784563cf410e2f7bff9576e800961b4", null ]
];
|
Ext.define("W2B.view.mis.costcenter.digitequip.DigitalMainParamsView", {
extend: 'Ext.panel.Panel',
xtype: 'digitmainparams',
controller: 'digitalview',
viewModel: {
type: 'missystem'
},
bodyPadding: 5,
layout: 'anchor',
defaults: {
anchor: '100%',
labelWidth: 250
},
items: [
{
xtype: 'textfield',
name: 'name',
allowBlank: false,
fieldLabel: 'Наименование',
},
{
xtype: "textarea",
name: 'stripname',
fieldLabel: 'Краткое описание',
},
{
xtype: 'textfield',
name: 'result',
fieldLabel: 'Описание результата',
},
{
xtype: 'textfield',
name: 'idOEM',
fieldLabel: 'ID OEM устройства',
},
{
xtype: 'textfield',
name: 'expenses',
fieldLabel: 'Центр затрат',
allowBlank: false
},
{
xtype: "checkbox",
name: "integration",
inputValue: true,
uncheckedValue: false,
fieldLabel: 'Интегрированное устройство',
},
{
xtype: 'radiogroup',
fieldLabel: 'Тип принтера',
vertical: true,
columns: 1,
items: [
{
boxLabel: 'Ч/б',
name: 'printType',
inputValue: 'black',
checked: true
},
{
boxLabel: 'Цветной',
name: 'printType',
inputValue: 'color',
},
{
boxLabel: 'Большой формат',
name: 'printType',
inputValue: 'big',
},
]
},
{
xtype: 'combobox',
name: 'digit_method',
fieldLabel: 'Метод',
editable: false,
queryMode: 'local'
},
{
xtype: 'combobox',
name: "digit_catprodaj",
fieldLabel: 'Кат. продаж',
editable: false,
queryMode: 'local'
},
{
xtype: 'radiogroup',
vertical: true,
fieldLabel: 'Бумага',
columns: 1,
items: [
{
boxLabel: 'Листы (листовая печать)',
name: 'paperType',
inputValue: 'sheet',
checked: true
},
{
boxLabel: 'Рулоны (рулонная)',
name: 'paperType',
inputValue: 'roll',
}
]
}
]
});
|
$(document).ready(function() {
$('#sendReview').click(function(){
if ($('#author').val() == '') {
alert('Укажите свое имя!');
return false;
}
if ($('#comment').val() == '') {
alert('Введите текст отзыва!');
return false;
}
if ($('#city').val() == '') {
alert('Укажите свой адрес!');
return false;
}
$.ajax({type: 'POST', url: '/ajax/add_review', async: true, data:{
author: $('#author').val(),
city: $('#city').val(),
comment: $('#comment').val(),
}})
.done(function(data){
$('#sendReview').remove();
$('#respond .modal-body').html('<div class="alert alert-success"><strong>Отзыв успешно отправлен!</strong><br /> Ваш отзыв появится на сайте после проверки модератором. Спасибо!.</div>');
});
});
});
|
var shell = require('..');
var assert = require('assert');
shell.config.silent = true;
shell.rm('-rf', 'tmp');
shell.mkdir('tmp');
//
// Invalids
//
// commands like `rm` can't be on the right side of pipes
assert.equal(typeof shell.ls('.').rm, 'undefined');
assert.equal(typeof shell.cat('resources/file1.txt').rm, 'undefined');
//
// Valids
//
// piping to cat() should return roughly the same thing
assert.strictEqual(shell.cat('resources/file1.txt').cat().toString(),
shell.cat('resources/file1.txt').toString());
// piping ls() into cat() converts to a string
assert.strictEqual(shell.ls('resources/').cat().toString(),
shell.ls('resources/').stdout);
var result;
result = shell.ls('resources/').grep('file1');
assert.equal(result + '', 'file1\nfile1.js\nfile1.txt\n');
result = shell.ls('resources/').cat().grep('file1');
assert.equal(result + '', 'file1\nfile1.js\nfile1.txt\n');
// Equivalent to a simple grep() test case
result = shell.cat('resources/grep/file').grep(/alpha*beta/);
assert.equal(shell.error(), null);
assert.equal(result.toString(), 'alphaaaaaaabeta\nalphbeta\n');
// Equivalent to a simple sed() test case
result = shell.cat('resources/grep/file').sed(/l*\.js/, '');
assert.ok(!shell.error());
assert.equal(result.toString(), 'alphaaaaaaabeta\nhowareyou\nalphbeta\nthis line ends in\n\n');
// Sort a file by frequency of each line
result = shell.sort('resources/uniq/pipe').uniq('-c').sort('-n');
assert.equal(shell.error(), null);
assert.equal(result.toString(), shell.cat('resources/uniq/pipeSorted').toString());
// Synchronous exec. To support Windows, the arguments must be passed
// using double quotes because node, following win32 convention,
// passes single quotes through to process.argv verbatim.
result = shell.cat('resources/grep/file').exec('shx grep "alpha*beta"');
assert.ok(!shell.error());
assert.equal(result, 'alphaaaaaaabeta\nalphbeta\n');
// Async exec
shell.cat('resources/grep/file').exec('shx grep "alpha*beta"', function (code, stdout) {
assert.equal(code, 0);
assert.equal(stdout, 'alphaaaaaaabeta\nalphbeta\n');
shell.exit(123);
});
|
const express = require('express');
const ErrorsMiddleware = require('../middlewares/errors');
const HealthyCheckController = require('../controllers/healthyCheck');
const v1 = require('./v1');
const router = express.Router();
// Healthy check
router.get('/', HealthyCheckController.index);
// API versions
router.use('/v1', v1);
// catch 404 and forward to error handler
router.use(ErrorsMiddleware.notFound);
// error handler
router.use(ErrorsMiddleware.generic);
module.exports = router;
|
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.0-rc4-master-4aa7160
*/
goog.provide('ng.material.components.whiteframe');
goog.require('ng.material.core');
/**
* @ngdoc module
* @name material.components.whiteframe
*/
angular
.module('material.components.whiteframe', ['material.core'])
.directive('mdWhiteframe', MdWhiteframeDirective);
/**
* @ngdoc directive
* @module material.components.whiteframe
* @name mdWhiteframe
*
* @description
* The md-whiteframe directive allows you to apply an elevation shadow to an element.
*
* The attribute values needs to be a number between 1 and 24.
*
* ### Notes
* - If there is no value specified it defaults to 4dp.
* - If the value is not valid it defaults to 4dp.
* @usage
* <hljs lang="html">
* <div md-whiteframe="3">
* <span>Elevation of 3dp</span>
* </div>
* </hljs>
*/
function MdWhiteframeDirective($log) {
var MIN_DP = 1;
var MAX_DP = 24;
var DEFAULT_DP = 4;
return {
link: postLink
};
function postLink(scope, element, attr) {
var elevation = parseInt(attr.mdWhiteframe, 10) || DEFAULT_DP;
if (elevation > MAX_DP || elevation < MIN_DP) {
$log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]);
elevation = DEFAULT_DP;
}
element.addClass('md-whiteframe-' + elevation + 'dp');
}
}
MdWhiteframeDirective.$inject = ["$log"];
ng.material.components.whiteframe = angular.module("material.components.whiteframe");
|
define([
'ace/theme'
], function(aceTheme) {
var themes = codebox.require("core/themes");
var bgDarker = "#1a1d24";
var colorDarker = "#505c66";
var bgDark = "#222830";
var colorDark = "#64737e";
var bgNormal = "#1c1f25";
var colorNormal = "#dfe0e6";
var bgLight = "#2b303b";
var colorLight = "#dadfe6";
themes.add({
id: "mono.industrial",
title: "Mono Industrial",
editor: {
'theme': aceTheme
},
styles: {
// Top menubar
menubar: {
'background': bgDarker,
'color': colorDark,
'border-color': "#111",
button: {
'border-color': bgNormal
}
},
// Statusbar
statusbar: {
'background': bgDarker,
'color': colorDark,
'border-color': "#111",
button: {
'border-color': bgNormal
}
},
// Lateral bar panels
lateralbar: {
'background': bgDark,
commands: {
'background': bgDark,
'color': colorLight
},
body: {
'color': colorDark
}
},
// Body
body: {
'background': bgDark,
'color': colorDark
},
// Tabs
tabs: {
section: {
'border-color': bgDark
},
header: {
'background': bgDark,
'color': colorDark
},
content: {
'background': bgLight
},
tab: {
'&.active': {
'background': bgLight,
'color': colorLight
}
}
},
// Operations
operations: {
operation: {
'background': bgLight,
'color': "#fff",
'border-color': "transparent"
}
},
// Alerts
alerts: {
alert: {
'background': bgLight,
'color': colorLight,
'border-color': "transparent"
}
},
// Palette
palette: {
'background': bgDark,
'border-color': bgDarker,
input: {
'background': bgLight,
'border-color': bgDarker,
'color': colorLight
},
results: {
'background': bgLight,
'border-color': bgDarker,
'color': colorLight,
command: {
'border-color': bgDarker
}
}
}
}
});
});
|
(function($) {
$.extend({
tablesorterPager: new function() {
function updatePageDisplay(c) {
var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);
}
function setPageSize(table,size) {
var c = table.config;
c.size = size;
c.totalPages = Math.ceil(c.totalRows / c.size);
c.pagerPositionSet = false;
moveToPage(table);
fixPosition(table);
}
function fixPosition(table) {
var c = table.config;
if(!c.pagerPositionSet && c.positionFixed) {
var c = table.config, o = $(table);
if(o.offset) {
c.container.css({
top: o.offset().top + o.height() + 'px',
position: 'absolute'
});
}
c.pagerPositionSet = true;
}
}
function moveToFirstPage(table) {
var c = table.config;
c.page = 0;
moveToPage(table);
}
function moveToLastPage(table) {
var c = table.config;
c.page = (c.totalPages-1);
moveToPage(table);
}
function moveToNextPage(table) {
var c = table.config;
if (c.page < (c.totalPages-1)) {
c.page += 1;
moveToPage(table);
}
}
function moveToPrevPage(table) {
var c = table.config;
if (c.page > 0) {
c.page -= 1;
moveToPage(table);
}
}
function moveToPage(table) {
var c = table.config;
if(c.page < 0 || c.page > (c.totalPages-1)) {
c.page = 0;
}
renderTable(table,c.rowsCopy);
renderPagination(table);
}
function renderTable(table,rows) {
var c = table.config;
var l = rows.length;
var s = (c.page * c.size);
var e = (s + c.size);
if(e > rows.length ) {
e = rows.length;
}
var tableBody = $(table.tBodies[0]);
// clear the table body
$.tablesorter.clearTableBody(table);
for(var i = s; i < e; i++) {
//tableBody.append(rows[i]);
var o = rows[i];
var l = o.length;
for(var j=0; j < l; j++) {
tableBody[0].appendChild(o[j]);
}
}
fixPosition(table,tableBody);
$(table).trigger("applyWidgets");
if( c.page >= c.totalPages ) {
moveToLastPage(table);
}
updatePageDisplay(c);
}
function renderPagination(table) {
/*
* Creates numbered pagination links
* and appends to config.cssPaginationDisplay
*/
var config = table.config;
var pager = config.container;
var paginationNode = $(pager).find(config.cssPaginationDisplay);
paginationNode.children('span.page').remove();
if (config.totalPages) {
for (var x=0; x < config.totalPages; x+=1) {
$('<span class="page">' + (x+1) + '</span>').appendTo(paginationNode);
}
}
var pages = paginationNode.children('span.page');
if (config.totalPages > 1) {
pages.bind('click', function() {
config.page = parseInt($(this).text()) - 1;
moveToPage(table);
});
}
$(pages[config.page]).addClass('active');
}
this.appender = function(table,rows) {
var c = table.config;
c.rowsCopy = rows;
c.totalRows = rows.length;
c.totalPages = Math.ceil(c.totalRows / c.size);
renderTable(table,rows);
};
this.defaults = {
size: 10,
offset: 0,
page: 0,
totalRows: 0,
totalPages: 0,
container: null,
cssNext: '.next',
cssPrev: '.prev',
cssFirst: '.first',
cssLast: '.last',
cssPaginationDisplay: '.pagination',
cssPageDisplay: '.pagedisplay',
cssPageSize: '.pagesize',
seperator: "/",
positionFixed: true,
appender: this.appender
};
this.construct = function(settings) {
return this.each(function() {
config = $.extend(this.config, $.tablesorterPager.defaults, settings);
var table = this, pager = config.container;
$(this).trigger("appendCache");
$(config.cssFirst,pager).click(function() {
moveToFirstPage(table);
return false;
});
$(config.cssNext,pager).click(function() {
moveToNextPage(table);
return false;
});
$(config.cssPrev,pager).click(function() {
moveToPrevPage(table);
return false;
});
$(config.cssLast,pager).click(function() {
moveToLastPage(table);
return false;
});
$(config.cssPageSize,pager).change(function() {
setPageSize(table,parseInt($(this).val()));
return false;
});
renderPagination(table);
});
};
}
});
// extend plugin scope
$.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});
})(jQuery);
|
var app = angular.module('questionnaireApp', [])
.controller('newQuestionController', ['$scope', function ($scope) {
$scope.options = window.options || {};
var questionOptions = window.questionOptions;
$scope.knowOptions = 'custom';
var clickCustomCount = 0;
$scope.answerType = window.answerType || "";
$scope.isAnswerTypeIsMultiChoice = function(){
return $scope.answerType == 'MultipleResponse' || $scope.answerType == 'MultiChoice';
};
$scope.addOption = function() {
$scope.existingQuestionOptions.push({});
};
$scope.removeOption = function(index) {
if($scope.existingQuestionOptions.length > 1) {
$scope.existingQuestionOptions.splice(index, 1);
} else {
$scope.existingQuestionOptions[0].text = "";
}
};
$scope.answerTypeIsMultiChoice = $scope.answerType && $scope.isAnswerTypeIsMultiChoice();
if (typeof window.answerSubType !== 'undefined'){
$scope.answerSubType = { text: window.answerSubType, value: window.answerSubType };
}
$scope.existingQuestionOptions = window.questionOptions || [];
var answerTypes = Object.keys(window.options);
var options = answerTypes.map(function (key) {
return { ansType: key, subTypes: $scope.options[key].map(function (subType) {
return { 'text': subType, 'value': subType };
})};
});
var createOptions = function(strOptions) {
var options = strOptions.split(",");
return options.map(function(option) {
return {text: option};
});
};
$scope.$watch('knowOptions', function(knownOption) {
if (knownOption === 'custom') {
if(clickCustomCount === 0) {
$scope.existingQuestionOptions = window.questionOptions
.filter(function(o) { return o != "" && o != null; })
.map(function(o) { return {text: o}; });
} else {
$scope.existingQuestionOptions = [];
}
if($scope.existingQuestionOptions.length === 0) {
$scope.addOption();
}
clickCustomCount ++;
} else {
$scope.existingQuestionOptions = createOptions(knownOption);
}
});
$scope.$watch('answerType', function (answerType) {
var answerTypeToShow = options.filter(function (option) {
return option.ansType == answerType;
})[0];
$scope.allOptions = answerTypeToShow && answerTypeToShow.subTypes;
});
}]);
|
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");
fluid.registerNamespace("gpii.oauth2");
fluid.defaults("gpii.oauth2.userService", {
gradeNames: ["fluid.eventedComponent", "autoInit"],
components: {
dataStore: {
type: "gpii.oauth2.dataStore"
}
},
invokers: {
authenticateUser: {
funcName: "gpii.oauth2.userService.authenticateUser",
args: ["{dataStore}", "{arguments}.0", "{arguments}.1"]
// username, password
},
getUserById: {
func: "{dataStore}.findUserById"
}
}
});
gpii.oauth2.userService.authenticateUser = function (dataStore, username, password) {
var user = dataStore.findUserByUsername(username);
// TODO store passwords securely
if (user && user.password === password) {
return user;
}
return false;
};
|
/* Creates a new interaction class */
function iClazz(SuperClass, methods) {
var subClass = function () {
this.config.apply(this, arguments);
};
subClass.prototype = Object.create(SuperClass.prototype);
subClass.prototype.constructor = subClass;
subClass.prototype.parent = SuperClass.prototype;
subClass.prototype = $.extend(subClass.prototype, methods);
return subClass;
}
var SocialInteraction = iClazz(Object, {
config: function(options) {},
init: function() {}
});
var ToggleSocialInteraction = iClazz(SocialInteraction, {
config: function(options) {
this.options = {
selector: '.toggle_social_relationship',
eventType: 'click',
container: $('body')
};
if (typeof options == 'object') $.extend(this.options, options);
this.init();
},
init: function() {
var container = this.options.container,
$class = this;
if (container && (typeof container == 'object' && container[0] instanceof Element)) {
container.delegate(this.options.selector, this.options.eventType, function(e) {
e.preventDefault();
var $this = $(this),
url = $this.attr('href') || $this.data('url'),
pk = $this.data('pk');
if (typeof pk !== 'undefined' && typeof url !== 'undefined') {
$.ajax(url, {
type: 'POST',
data: {
"pk": pk
},
context: this,
success: function(response, status, xhr) {
$class.success(response, status, xhr, this);
},
error: function(response, status, xhr) {
$class.error(response, status, xhr, this);
},
dataType: "json"
});
} else {
throw new Error('Error: the values of (url and pk) must be specified.');
}
});
} else {
throw new Error('Error: this.options.container expects an HTML Element.');
}
},
success: function(response, status, xhr, context) {
if (status == "success" && response['result']) {
$(context).addClass((response['toggle_status']) ? 'on' : 'off');
}
},
error: function(response, status, xhr, context) {}
});
var FormSocialInteraction = iClazz(SocialInteraction, {
config: function(options) {
this.options = {
selector: '',
eventType: ''
};
if (typeof options == 'object') $.extend(this.options, options);
this.init();
},
init: function() {
var eventTrigger = $(this.options.selector).first(),
$class = this;
eventTrigger.on(this.options.eventType, function() {
$class.eventImpl(eventTrigger);
})
},
eventImpl: function(eventTrigger) {}
});
|
var searchData=
[
['cdeactivate',['cDeactivate',['../group___game_object.html#gab3a5c1145d984bfffc6542a1c5326623',1,'GameObject']]],
['cinit',['cInit',['../group___game_object.html#gab6ed5a737f27fa166a782a2b8141df7d',1,'GameObject']]],
['clearassimps',['clearAssimps',['../_lua_binder_8dox.html#ae54b1056949421de790925afdd89b3e7',1,'LuaBinder.dox']]],
['clearlocallights',['clearLocalLights',['../group___graphics3_d.html#gaa5dd02573dd44e82671c79603dc379fa',1,'Game']]],
['clearobjs',['clearObjs',['../_lua_binder_8dox.html#a1d8d7ad169e63dc24f582840cda5872b',1,'LuaBinder.dox']]],
['clearparticleemitters',['clearParticleEmitters',['../group___particles.html#ga9994f7dcd7b0a6450656970e96cec839',1,'Game']]],
['clearphysicsforces',['clearPhysicsForces',['../group___physics.html#gaefc89ef36b27e5a786c0a172443c4cee',1,'Game']]],
['clearphysicsworld',['clearPhysicsWorld',['../group___physics.html#gaa61a14a28a9156831d53dbd8a67ea9dc',1,'Game']]],
['clearscreencontrols',['clearScreenControls',['../group___u_i.html#ga312e3399948789dfda978086d7caddba',1,'Game']]],
['cleartextures',['clearTextures',['../group___graphics2_d.html#ga3804de5b3501fc8f1395f10a455a39cc',1,'LuaBinder.dox']]],
['countphysicscontacts',['countPhysicsContacts',['../group___physics.html#ga39dd50cfc1d93826fd923b2fdfb93aed',1,'GameObject']]],
['createphysicsworld',['createPhysicsWorld',['../group___physics.html#ga8a3a51a00836a0be79df7799a4dcc4ac',1,'Game']]]
];
|
import React from 'react'
import Reflux from 'reflux'
const AssetStore = require('../stores/AssetStore');
import Tabs from './Tabs'
export default React.createClass({
displayName: 'Asset',
mixins: [Reflux.listenTo(AssetStore, 'update')],
update: function () {
if (!this.isMounted()) return;
this.setState(this.getStateFromStore());
},
getStateFromStore: function(props) {
props = props || this.props;
return {
asset: AssetStore.getAsset(props.params.id) || {}
};
},
getInitialState: function () {
return this.getStateFromStore();
},
componentWillReceiveProps: function (nextProps) {
this.setState(this.getStateFromStore(nextProps));
},
render: function() {
var url = this.state.asset.url || '';
var tabs = [
{title: 'Activity', content: 'Activity'},
{title: 'Task', content: 'Task'},
{title: 'Revisions', content: 'Revisions'},
{title: 'Comments', content: 'Comments'},
];
return (
<div>
<Row>
<Column size={4}>
<Preview url={url+'preview'} />
</Column>
<Column size={8}>
<Details asset={this.state.asset} />
</Column>
</Row>
<Row>
<Column size={12}>
<Tabs tabs={tabs}/>
</Column>
</Row>
</div>
);
}
});
const Row = React.createClass({
render: function() {
return (
<div className="row">
{this.props.children}
</div>
);
}
});
export const Column = React.createClass({
render: function() {
//col-sm-12 col-md-12 col-lg-6
return (
<div className={'col-lg-'+this.props.size}>{this.props.children}</div>
);
}
});
export const Preview = React.createClass({
render: function() {
return (
<div><img src={this.props.url} alt="Preview" /></div>
);
}
});
export const Details = React.createClass({
render: function() {
return (
<div>Details</div>
);
}
});
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S15.4.4.12_A4_T1;
* @section: 15.4.4.12, 8.6.2.1;
* @assertion: [[Get]] from not an inherited property;
* @description: [[Prototype]] of Array instance is Array.prototype, [[Prototype] of Array.prototype is Object.prototype;
*/
Array.prototype[1] = -1;
var x = [0,1];
var arr = x.splice(1,1);
//CHECK#1
if (arr.length !== 1) {
$ERROR('#1: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); arr.length === 1. Actual: ' + (arr.length));
}
//CHECK#2
if (arr[0] !== 1) {
$ERROR('#2: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); arr[0] === 1. Actual: ' + (arr[0]));
}
//CHECK#3
if (arr[1] !== -1) {
$ERROR('#3: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); arr[1] === -1. Actual: ' + (arr[1]));
}
//CHECK#4
if (x.length !== 1) {
$ERROR('#4: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); x.length === 1. Actual: ' + (x.length));
}
//CHECK#5
if (x[0] !== 0) {
$ERROR('#5: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#6
if (x[1] !== -1) {
$ERROR('#6: Array.prototype[1] = -1; x = [0,1]; var arr = x.splice(1,1); x[1] === -1. Actual: ' + (x[1]));
}
Object.prototype[1] = -1;
Object.prototype.length = 2;
Object.prototype.splice = Array.prototype.splice;
x = {0:0, 1:1};
var arr = x.splice(1,1);
//CHECK#7
if (arr.length !== 1) {
$ERROR('#7: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); arr.length === 1. Actual: ' + (arr.length));
}
//CHECK#8
if (arr[0] !== 1) {
$ERROR('#8: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); arr[0] === 1. Actual: ' + (arr[0]));
}
//CHECK#9
if (arr[1] !== -1) {
$ERROR('#9: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); arr[1] === -1. Actual: ' + (arr[1]));
}
//CHECK#10
if (x.length !== 1) {
$ERROR('#10: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); x.length === 1. Actual: ' + (x.length));
}
//CHECK#11
if (x[0] !== 0) {
$ERROR('#11: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#12
if (x[1] !== -1) {
$ERROR('#12: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.splice = Array.prototype.splice; x = {0:0, 1:1}; var arr = x.splice(1,1); x[1] === -1. Actual: ' + (x[1]));
}
|
function FileData_Pairs(x)
{
x.t("managing","sample");
x.t("findings","vitro");
x.t("right","finish");
x.t("files","wish");
x.t("files","continue");
x.t("files","click");
x.t("files","consisting");
x.t("wish","adding");
x.t("description","enter");
x.t("once","click");
x.t("upload","button");
x.t("derived","data");
x.t("field","select");
x.t("sample","click");
x.t("sample","characterizations");
x.t("type","(required)");
x.t("close","window");
x.t("form","supporting");
x.t("form","already");
x.t("extend","page");
x.t("keywords","associate");
x.t("listed","point");
x.t("new","entry");
x.t("access","selected");
x.t("document","located");
x.t("document","graph");
x.t("file","managing");
x.t("file","description");
x.t("file","type");
x.t("file","extend");
x.t("file","form");
x.t("file","add");
x.t("file","url");
x.t("file","added");
x.t("file","title");
x.t("file","specifying");
x.t("file","adding");
x.t("entering","data");
x.t("add","files");
x.t("add","results");
x.t("add","characterization");
x.t("add","continue");
x.t("add","corresponding");
x.t("group","(s)");
x.t("granted","access");
x.t("results","form");
x.t("entry","enclosed");
x.t("entry","brackets");
x.t("entry","temporary");
x.t("entry","persisted");
x.t("images","select");
x.t("browse","button");
x.t("characterization","files");
x.t("characterization","describing");
x.t("characterization","follow");
x.t("characterization","adding");
x.t("supporting","documentation");
x.t("navigate","report");
x.t("url","document");
x.t("url","button");
x.t("enclosed","new");
x.t("publication","associated");
x.t("cancel","close");
x.t("brackets","indicating");
x.t("brackets","disappear");
x.t("window","add");
x.t("window","click");
x.t("continue","process");
x.t("continue","adding");
x.t("segment","window");
x.t("selected","file");
x.t("point","entry");
x.t("select","upload");
x.t("select","group");
x.t("button","navigate");
x.t("button","click");
x.t("button","enter");
x.t("indicating","entry");
x.t("finding","segment");
x.t("report","publication");
x.t("describing","findings");
x.t("added","specify");
x.t("follow","steps");
x.t("steps","click");
x.t("located","file");
x.t("lower","right");
x.t("documentation","vitro");
x.t("click","add");
x.t("click","browse");
x.t("click","enter");
x.t("click","save");
x.t("click","submit");
x.t("click","[other]");
x.t("enter","file");
x.t("enter","url");
x.t("enter","additional");
x.t("enter","following");
x.t("enter","alternative");
x.t("(required)","keywords");
x.t("(required)","document");
x.t("include","visibility");
x.t("disappear","finding");
x.t("graphs","spreadsheet");
x.t("additional","information");
x.t("title","(required)");
x.t("already","include");
x.t("temporary","once");
x.t("process","described");
x.t("spreadsheet","file");
x.t("spreadsheet","images");
x.t("(s)","granted");
x.t("page","add");
x.t("consisting","graphs");
x.t("specifying","files");
x.t("characterizations","adding");
x.t("graph","image");
x.t("information","file");
x.t("data","add");
x.t("data","cancel");
x.t("data","conditions");
x.t("persisted","brackets");
x.t("image","spreadsheet");
x.t("save","lower");
x.t("submit","update");
x.t("selections","listed");
x.t("finish","entering");
x.t("described","adding");
x.t("vitro","characterization");
x.t("associate","file");
x.t("corresponding","file");
x.t("following","file");
x.t("adding","files");
x.t("adding","file");
x.t("adding","data");
x.t("adding","vitro");
x.t("alternative","selections");
x.t("associated","sample");
x.t("visibility","field");
x.t("[other]","enter");
x.t("conditions","derived");
x.t("update","entry");
x.t("specify","enter");
}
|
// lagou
dataHost = "a.lagou.com";
(function(i, s, o, g, r, a, m) {
i['LgAnalytics'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//a.lagou.com/js/a.js', 'gatherer');
gatherer('create', 'UA-41268416-1', {'alwaysSendReferrer': true});
gatherer('send', 'pageview');
//baidu
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F4233e74dff0ae5bd0a3d81c6ccf756e6' type='text/javascript'%3E%3C/script%3E"));
//google analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41268416-1', 'auto');
ga('require', 'displayfeatures');
ga('require', 'linker');
ga('send', 'pageview');
//平台统计代码click log for platform add by vee 2015-07-04
function initResumeLog(logtype, deliverId, positionId, position){
//平台统计代码 调用函数见analytics.js add by vee 2015-07-28
var param = {};
param.logtype = logtype; //suc=0表成功 1表失败
param.position = position || GetQueryString('i');
param.orderid = deliverId;
param.positionid = positionId;
param.url = location.href;
param.fromsite = document.referrer || null;
logImgLoader('logImgSet',param);
}
function logImgLoader(id,param) {
var time = new Date();
param.time = time.getTime();
param.userid = window.global.idmd5;
//logtype-0表成功 logtype-1表失败
var uri = 'v=1&logtype='+param.logtype+'&position='+param.position+'&orderid='+param.orderid+'&userid='+param.userid+'&positionid='+param.positionid+'&url='+param.url+'&fromsite='+param.fromsite+'&optime='+param.time;
$(document.body).append("<img src='http://a.lagou.com/click?"+uri+"' id='"+id+"' style='position:fixed;left:-10000px;bottom:0;' />");
$('#'+id).remove();
}
//公用函数 获取url的参数 add by vee 2015-07-04
function GetQueryString(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)
return unescape(r[2]);
return null;
}
|
import _clone from 'lodash-es/clone';
import _keys from 'lodash-es/keys';
import _toPairs from 'lodash-es/toPairs';
import _union from 'lodash-es/union';
import _without from 'lodash-es/without';
import { debug } from '../index';
import { osmIsInterestingTag } from './tags';
import { dataDeprecated } from '../../data/index';
export function osmEntity(attrs) {
// For prototypal inheritance.
if (this instanceof osmEntity) return;
// Create the appropriate subtype.
if (attrs && attrs.type) {
return osmEntity[attrs.type].apply(this, arguments);
} else if (attrs && attrs.id) {
return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
}
// Initialize a generic Entity (used only in tests).
return (new osmEntity()).initialize(arguments);
}
osmEntity.id = function(type) {
return osmEntity.id.fromOSM(type, osmEntity.id.next[type]--);
};
osmEntity.id.next = {
changeset: -1, node: -1, way: -1, relation: -1
};
osmEntity.id.fromOSM = function(type, id) {
return type[0] + id;
};
osmEntity.id.toOSM = function(id) {
return id.slice(1);
};
osmEntity.id.type = function(id) {
return { 'c': 'changeset', 'n': 'node', 'w': 'way', 'r': 'relation' }[id[0]];
};
// A function suitable for use as the second argument to d3.selection#data().
osmEntity.key = function(entity) {
return entity.id + 'v' + (entity.v || 0);
};
osmEntity.prototype = {
tags: {},
initialize: function(sources) {
for (var i = 0; i < sources.length; ++i) {
var source = sources[i];
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
if (source[prop] === undefined) {
delete this[prop];
} else {
this[prop] = source[prop];
}
}
}
}
if (!this.id && this.type) {
this.id = osmEntity.id(this.type);
}
if (!this.hasOwnProperty('visible')) {
this.visible = true;
}
if (debug) {
Object.freeze(this);
Object.freeze(this.tags);
if (this.loc) Object.freeze(this.loc);
if (this.nodes) Object.freeze(this.nodes);
if (this.members) Object.freeze(this.members);
}
return this;
},
copy: function(resolver, copies) {
if (copies[this.id])
return copies[this.id];
var copy = osmEntity(this, {id: undefined, user: undefined, version: undefined});
copies[this.id] = copy;
return copy;
},
osmId: function() {
return osmEntity.id.toOSM(this.id);
},
isNew: function() {
return this.osmId() < 0;
},
update: function(attrs) {
return osmEntity(this, attrs, {v: 1 + (this.v || 0)});
},
mergeTags: function(tags) {
var merged = _clone(this.tags), changed = false;
for (var k in tags) {
var t1 = merged[k],
t2 = tags[k];
if (!t1) {
changed = true;
merged[k] = t2;
} else if (t1 !== t2) {
changed = true;
merged[k] = _union(t1.split(/;\s*/), t2.split(/;\s*/)).join(';');
}
}
return changed ? this.update({tags: merged}) : this;
},
intersects: function(extent, resolver) {
return this.extent(resolver).intersects(extent);
},
isUsed: function(resolver) {
return _without(Object.keys(this.tags), 'area').length > 0 ||
resolver.parentRelations(this).length > 0;
},
hasInterestingTags: function() {
return _keys(this.tags).some(osmIsInterestingTag);
},
isHighwayIntersection: function() {
return false;
},
isDegenerate: function() {
return true;
},
deprecatedTags: function() {
var tags = _toPairs(this.tags);
var deprecated = {};
dataDeprecated.forEach(function(d) {
var match = _toPairs(d.old)[0];
tags.forEach(function(t) {
if (t[0] === match[0] &&
(t[1] === match[1] || match[1] === '*')) {
deprecated[t[0]] = t[1];
}
});
});
return deprecated;
}
};
|
'use strict';
module.exports = function enableAuthentication(server) {
// enable authentication
server.enableAuth();
};
|
'use strict';
var core = require('./src/core/bootstrap');
core.start()
.catch((err) => {
console.log(err);
});
|
'use strict';
var ndtutil = require('../ndtutil')
/**
* Alarm
* @param {object} env
* @return {P}
*/
module.exports = function(env){
return ndtutil.svc(env,'alarm')
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:44f9d14a36ef7f6c42f2c7bbac59a92b1dac5e546fe6d9b9febc62e5474b1c95
size 22242
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S11.13.2_A4.6_T2.8;
* @section: 11.13.2, 11.7.1;
* @assertion: The production x <<= y is the same as x = x << y;
* @description: Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined;
*/
//CHECK#1
x = true;
x <<= undefined;
if (x !== 1) {
$ERROR('#1: x = true; x <<= undefined; x === 1. Actual: ' + (x));
}
//CHECK#2
x = undefined;
x <<= true;
if (x !== 0) {
$ERROR('#2: x = undefined; x <<= true; x === 0. Actual: ' + (x));
}
//CHECK#3
x = new Boolean(true);
x <<= undefined;
if (x !== 1) {
$ERROR('#3: x = new Boolean(true); x <<= undefined; x === 1. Actual: ' + (x));
}
//CHECK#4
x = undefined;
x <<= new Boolean(true);
if (x !== 0) {
$ERROR('#4: x = undefined; x <<= new Boolean(true); x === 0. Actual: ' + (x));
}
|
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
async = require('async'),
jf = require('jsonfile'),
executing = false;
var config = require('../config.json');
var configM = require('./config.json');
jf.spaces = 2;
mongoose.connect(config.db.url ||
('mongodb://' + config.db.host + '/'+ config.db.name));
mongoose.model('User', new Schema(require('../models/User')) );
mongoose.model('Project', new Schema(require('../models/Project')) );
mongoose.model('Dashboard', new Schema(require('../models/Dashboard')) );
mongoose.model('Collection', new Schema(require('../models/Collection')) );
var hasCreated = { created_at: { $exists: true } };
var aggregation = [
{ $match: hasCreated },
{
$group: {
_id: {
year: { $year: "$created_at" },
month: { $month: "$created_at" },
//day: { $dayOfMonth: "$created_at" }
},
count: { $sum: 1 }
}
},
{ $project: { date: "$_id", count: 1, _id: 0 } },
{ $sort: { "date": 1 } }
];
var exec = {
users: function(done){
var User = mongoose.model('User');
User.aggregate(aggregation, function(err, users){
if (err) { return done(err); }
User.count(hasCreated, function(err, count){
done(err, {
total: count,
data: users
});
});
});
},
projects: function(done){
var Project = mongoose.model('Project');
Project.aggregate(aggregation, function(err, projects){
if (err) { return done(err); }
Project.count(hasCreated, function(err, count){
done(err, {
total: count,
data: projects
});
});
});
},
dashboards: function(done){
var Dashboard = mongoose.model('Dashboard');
Dashboard.aggregate(aggregation, function(err, dashboards){
if (err) { return done(err); }
Dashboard.count(hasCreated, function(err, count){
done(err, {
total: count,
data: dashboards
});
});
});
},
collections: function(done){
var Collection = mongoose.model('Collection');
Collection.aggregate(aggregation, function(err, collections){
if (err) { return done(err); }
Collection.count(hasCreated, function(err, count){
done(err, {
total: count,
data: collections
});
});
});
}
};
module.exports = function(done){
if (executing) return;
executing = true;
console.log('>>>>> Runing %s', new Date());
async.parallel(exec, function(err, data){
if (err){
return console.log(err);
console.log('Metrics NOT updated!');
}
/*
console.log(" %s Users", data.users.total);
console.log(" %s Projects", data.projects.total);
console.log(" %s Dashboards", data.dashboards.total);
console.log(" %s Collections", data.collections.total);
console.dir(data.users.data);
console.dir(data.projects.data);
console.dir(data.dashboards.data);
console.dir(data.collections.data);
*/
jf.writeFile('./' + configM.filename, data, function(err) {
if(err) {
console.log("Metrics NOT updated!");
console.log(err);
return done();
}
console.log('>>>>> Finished %s', new Date());
executing = false;
done && done();
});
});
};
|
describe('update element Function', function() {
var updateElement;
beforeEach(function() {
module('angular-stick-to');
inject(function(_updateElement_) {
updateElement = _updateElement_;
});
});
describe('when called with element in Case1', function() {
var element;
beforeEach(function() {
element = mock.createStickyElement({
primaryLimit: 50,
top: 100,
bottom: 110,
secondaryLimit: 150
});
});
[0, 5, 65].forEach(function(offset) {
describe('when has offset ' + offset, function() {
beforeEach(function() {
element.setSyntheticOffset(offset);
element.setSyntheticOffset.calls.reset();
});
it('should set 0 offset', function() {
updateElement(element);
expect(element.setSyntheticOffset).toHaveBeenCalledWith(0);
});
});
});
});
describe('when called with element in Case2', function() {
var element;
var expectedOffset;
beforeEach(function() {
element = mock.createStickyElement({
top: 50,
primaryLimit: 60,
bottom: 70,
secondaryLimit: 100
});
expectedOffset = element._primaryLimit - element._top;
});
[0, 5, 15, 65, 125].forEach(function(offset) {
describe('when has offset ' + offset, function() {
beforeEach(function() {
element.setSyntheticOffset(offset);
element.setSyntheticOffset.calls.reset();
});
it('should add expectedOffset to make element sticked to topLimit',
function() {
updateElement(element);
expect(element.setSyntheticOffset)
.toHaveBeenCalledWith(expectedOffset);
});
});
});
});
describe('when called with element in Case3', function() {
var element;
beforeEach(function() {
element = mock.createStickyElement({
primaryLimit: 50,
top: 65,
secondaryLimit: 70,
bottom: 81,
});
});
[0, 5, 15, 65, 125].forEach(function(offset) {
describe('when has offset ' + offset, function() {
beforeEach(function() {
element.setSyntheticOffset(offset);
element.setSyntheticOffset.calls.reset();
});
it('should set 0 offset', function() {
updateElement(element);
expect(element.setSyntheticOffset)
.toHaveBeenCalledWith(0);
});
});
});
});
describe('when called with element in Case4', function() {
var element;
var expectedOffset;
beforeEach(function() {
element = mock.createStickyElement({
top: 50,
primaryLimit: 60,
secondaryLimit: 65,
bottom: 80,
});
expectedOffset = element._secondaryLimit - element._bottom;
});
[0, 3, 5, 15, 65, 125].forEach(function(offset) {
describe('when has offset ' + offset, function() {
beforeEach(function() {
element.setSyntheticOffset(offset);
element.setSyntheticOffset.calls.reset();
});
it('should stick element to secondaryLimit', function() {
updateElement(element);
expect(element.setSyntheticOffset)
.toHaveBeenCalledWith(expectedOffset);
});
});
});
});
describe('when called with element in Case5', function() {
var element;
var expectedOffset;
beforeEach(function() {
element = mock.createStickyElement({
top: 50,
primaryLimit: 70,
bottom: 71,
secondaryLimit: 75
});
expectedOffset = element._secondaryLimit - element._bottom;
});
[0, 3, 5, 15, 65, 125].forEach(function(offset) {
describe('when has offset ' + offset, function() {
beforeEach(function() {
element.setSyntheticOffset(offset);
element.setSyntheticOffset.calls.reset();
});
it('should be sticked to bottom Limit', function() {
updateElement(element);
expect(element.setSyntheticOffset)
.toHaveBeenCalledWith(expectedOffset);
});
});
});
});
});
|
var System = require('../entities/systems/System');
/**
* Manages entities with a TimelineComponent
* @example-link http://code.gooengine.com/latest/visual-test/goo/timelinepack/TimelineComponent/TimelineComponent-vtest.html Working example
*/
function TimelineSystem() {
System.call(this, 'TimelineSystem', ['TimelineComponent']);
}
TimelineSystem.prototype = Object.create(System.prototype);
TimelineSystem.prototype.constructor = TimelineSystem;
TimelineSystem.prototype.process = function (entities, tpf) {
for (var i = 0; i < this._activeEntities.length; i++) {
var entity = this._activeEntities[i];
entity.timelineComponent.update(tpf);
}
};
/**
* Resumes updating the entities
*/
TimelineSystem.prototype.play = function () {
this.passive = false;
var entities = this._activeEntities;
for (var i = 0; i < entities.length; i++) {
var component = entities[i].timelineComponent;
if (component.autoStart) {
component.start();
}
}
};
/**
* Stops updating the entities
*/
TimelineSystem.prototype.pause = function () {
this.passive = true;
var entities = this._activeEntities;
for (var i = 0; i < entities.length; i++) {
var component = entities[i].timelineComponent;
component.pause();
}
};
/**
* Resumes updating the entities; an alias for `.play`
*/
TimelineSystem.prototype.resume = TimelineSystem.prototype.play;
/**
* Stop updating entities and resets the state machines to their initial state
*/
TimelineSystem.prototype.stop = function () {
this.passive = true;
var entities = this._activeEntities;
for (var i = 0; i < entities.length; i++) {
var component = entities[i].timelineComponent;
component.stop();
}
};
module.exports = TimelineSystem;
|
//>>excludeStart("exclude", pragmas.exclude);
define([ "shoestring" ], function(){
//>>excludeEnd("exclude");
/**
* Returns a `shoestring` object with the set of siblings of each element in the original set.
*
* @return shoestring
* @this shoestring
*/
shoestring.fn.next = function(){
//>>includeStart("development", pragmas.development);
if( arguments.length > 0 ){
shoestring.error( 'next-selector' );
}
//>>includeEnd("development");
var result = [];
// TODO need to implement map
this.each(function() {
var children, item, found;
// get the child nodes for this member of the set
children = shoestring( this.parentNode )[0].childNodes;
for( var i = 0; i < children.length; i++ ){
item = children.item( i );
// found the item we needed (found) which means current item value is
// the next node in the list, as long as it's viable grab it
// NOTE may need to be more permissive
if( found && item.nodeType === 1 ){
result.push( item );
break;
}
// find the current item and mark it as found
if( item === this ){
found = true;
}
}
});
return shoestring( result );
};
//>>excludeStart("exclude", pragmas.exclude);
});
//>>excludeEnd("exclude");
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _os = require('os');
var _os2 = _interopRequireDefault(_os);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var PingMessage = function () {
function PingMessage() {
_classCallCheck(this, PingMessage);
}
_createClass(PingMessage, null, [{
key: 'construct',
value: function construct(id) {
return {
id: id,
msg: 'I am still alive!',
os: {
mem: {
total: _os2.default.totalmem(),
free: _os2.default.freemem()
},
load: _os2.default.loadavg(),
uptime: _os2.default.uptime()
}
};
}
}]);
return PingMessage;
}();
exports.default = PingMessage;
|
'use strict';
(function() {
var env = '';
if (typeof module !== 'undefined' && module.exports) env = 'node';
var exports = {};
if (env === 'node') {
var layer = require('layer');
} else {
exports = this;
var layer = layer || this.layer;
}
exports.intercept = function (ctx, fn, interceptFn) {
var result = false;
var f = layer._find_context(ctx, fn, 0);
layer.set(ctx, fn, function() {
result = { called: true, args: Array.prototype.slice.call(arguments)};
if (interceptFn && typeof interceptFn === 'function') interceptFn(result);
layer.unset(f[0][f[1]]);
return new layer.Stop();
});
var resultFn = function() {
return result;
}
resultFn.reset = function() {
var status = true;
try {
layer.unset(f[0][f[1]]);
} catch(e) {
status = false;
}
return status;
}
return resultFn;
}
if (env === 'node') module.exports = exports.intercept;
})();
|
'use strict';
var mean = require('meanio');
var request = require('request');
var unescape = require('unescape');
exports.render = function(req, res) {
var modules = [];
// Preparing angular modules list with dependencies
for (var name in mean.modules) {
modules.push({
name: name,
module: 'mean.' + name,
angularDependencies: mean.modules[name].angularDependencies
});
}
function isAdmin() {
return req.user && req.user.roles.indexOf('admin') !== -1;
}
// Send some basic starting info to the view
res.render('index', {
user: req.user ? {
name: req.user.name,
_id: req.user._id,
username: req.user.username,
roles: req.user.roles
} : {},
modules: modules,
isAdmin: isAdmin,
adminEnabled: isAdmin() && mean.moduleEnabled('mean-admin')
});
};
exports.audio = function(req, res) {
request('http://www.haramain.info/feeds/posts/default', function (error, response, html) {
if (!error && response.statusCode === 200) {
var soundFiles = html.split('soundFile=');
var newHTML = unescape(html);
var titleNames = newHTML.split('<span style="color:');
var json = '[';
// Start at 1 because first element is some weird XML thing
for (var i = 1; i < soundFiles.length; i+=1) {
var fileEnding = soundFiles[i].indexOf('.mp3');
var fileName = soundFiles[i].substring(0, fileEnding) + '.mp3';
if (fileName.indexOf('Sheikh') > -1 && fileName.indexOf('Khutbah') < 1) {
json += '{"url": "' + fileName + '" },';
}
//
}
json = json.substring(0, json.length - 1) + ']';
var prayerLocationAndTime = [];
var surah = [];
var sheikh = [];
var beginning = '';
// Organize all the HTML into individual arrays
for (var j = 1; j < titleNames.length; j+=1) {
if (j % 3 === 1) {
beginning = titleNames[j].substring(titleNames[j].indexOf('>') + 1,50);
var prayerLocationAndTimeName = beginning.substring(0, beginning.indexOf('</span>'));
prayerLocationAndTimeName = prayerLocationAndTimeName.replace('\\', '');
prayerLocationAndTime.push(prayerLocationAndTimeName);
} else if (j % 3 === 2) {
beginning = titleNames[j].substring(titleNames[j].indexOf('>') + 1,50);
var surahName = beginning.substring(0, beginning.indexOf('</span>'));
surahName = surahName.replace('\\', '');
surah.push(surahName);
} else {
beginning = titleNames[j].substring(titleNames[j].indexOf('>') + 1,50);
var imamName = beginning.substring(0, beginning.indexOf('</span>'));
imamName = imamName.replace('\\', '');
sheikh.push(imamName);
}
}
var jsonArray = JSON.parse(json);
// Append Surah Name, Sheikh Name, and Prayer Location
for (var k = 0; k < jsonArray.length; k+=1) {
jsonArray[k].surah = surah[k];
jsonArray[k].sheikh = sheikh[k];
jsonArray[k].prayerlocation = prayerLocationAndTime[k];
}
res.json(jsonArray);
}
});
};
exports.audioNew = function(req, res) {
request('http://www.haramain.info/feeds/posts/default', function (error, response, html) {
if (!error && response.statusCode === 200) {
res.send(response);
}
});
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.