text
stringlengths 2
6.14k
|
|---|
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-reconciler.production.min.js');
} else {
module.exports = require('./cjs/react-reconciler.development.js');
}
|
//// [genericClassInheritsConstructorFromNonGenericClass.ts]
class A extends B<string> { }
class B<U> extends C { }
class C {
constructor(p: string) { }
}
//// [genericClassInheritsConstructorFromNonGenericClass.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function (_super) {
__extends(A, _super);
function A() {
_super.apply(this, arguments);
}
return A;
})(B);
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(C);
var C = (function () {
function C(p) {
}
return C;
})();
|
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* 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 Ajax.org B.V. 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 AJAX.ORG B.V. 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.
*
* ***** END LICENSE BLOCK ***** */
define('ace/theme/merbivore_soft', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-merbivore-soft";
exports.cssText = ".ace-merbivore-soft .ace_gutter {\
background: #262424;\
color: #E6E1DC\
}\
.ace-merbivore-soft .ace_print-margin {\
width: 1px;\
background: #262424\
}\
.ace-merbivore-soft {\
background-color: #1C1C1C;\
color: #E6E1DC\
}\
.ace-merbivore-soft .ace_cursor {\
color: #FFFFFF\
}\
.ace-merbivore-soft .ace_marker-layer .ace_selection {\
background: #494949\
}\
.ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #1C1C1C;\
border-radius: 2px\
}\
.ace-merbivore-soft .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-merbivore-soft .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #404040\
}\
.ace-merbivore-soft .ace_marker-layer .ace_active-line {\
background: #333435\
}\
.ace-merbivore-soft .ace_gutter-active-line {\
background-color: #333435\
}\
.ace-merbivore-soft .ace_marker-layer .ace_selected-word {\
border: 1px solid #494949\
}\
.ace-merbivore-soft .ace_invisible {\
color: #404040\
}\
.ace-merbivore-soft .ace_entity.ace_name.ace_tag,\
.ace-merbivore-soft .ace_keyword,\
.ace-merbivore-soft .ace_meta,\
.ace-merbivore-soft .ace_meta.ace_tag,\
.ace-merbivore-soft .ace_storage {\
color: #FC803A\
}\
.ace-merbivore-soft .ace_constant,\
.ace-merbivore-soft .ace_constant.ace_character,\
.ace-merbivore-soft .ace_constant.ace_character.ace_escape,\
.ace-merbivore-soft .ace_constant.ace_other,\
.ace-merbivore-soft .ace_support.ace_type {\
color: #68C1D8\
}\
.ace-merbivore-soft .ace_constant.ace_character.ace_escape {\
color: #B3E5B4\
}\
.ace-merbivore-soft .ace_constant.ace_language {\
color: #E1C582\
}\
.ace-merbivore-soft .ace_constant.ace_library,\
.ace-merbivore-soft .ace_string,\
.ace-merbivore-soft .ace_support.ace_constant {\
color: #8EC65F\
}\
.ace-merbivore-soft .ace_constant.ace_numeric {\
color: #7FC578\
}\
.ace-merbivore-soft .ace_invalid,\
.ace-merbivore-soft .ace_invalid.ace_deprecated {\
color: #FFFFFF;\
background-color: #FE3838\
}\
.ace-merbivore-soft .ace_fold {\
background-color: #FC803A;\
border-color: #E6E1DC\
}\
.ace-merbivore-soft .ace_comment,\
.ace-merbivore-soft .ace_meta {\
font-style: italic;\
color: #AC4BB8\
}\
.ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name {\
color: #EAF1A3\
}\
.ace-merbivore-soft .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQkpLyZfD09PwPAAfYAnaStpHRAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
|
/**
* ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v3.3.3
* @link http://www.ag-grid.com/
* @license MIT
*/
var TemplateService = (function () {
function TemplateService() {
this.templateCache = {};
this.waitingCallbacks = {};
}
TemplateService.prototype.init = function ($scope) {
this.$scope = $scope;
};
// returns the template if it is loaded, or null if it is not loaded
// but will call the callback when it is loaded
TemplateService.prototype.getTemplate = function (url, callback) {
var templateFromCache = this.templateCache[url];
if (templateFromCache) {
return templateFromCache;
}
var callbackList = this.waitingCallbacks[url];
var that = this;
if (!callbackList) {
// first time this was called, so need a new list for callbacks
callbackList = [];
this.waitingCallbacks[url] = callbackList;
// and also need to do the http request
var client = new XMLHttpRequest();
client.onload = function () {
that.handleHttpResult(this, url);
};
client.open("GET", url);
client.send();
}
// add this callback
if (callback) {
callbackList.push(callback);
}
// caller needs to wait for template to load, so return null
return null;
};
TemplateService.prototype.handleHttpResult = function (httpResult, url) {
if (httpResult.status !== 200 || httpResult.response === null) {
console.warn('Unable to get template error ' + httpResult.status + ' - ' + url);
return;
}
// response success, so process it
// in IE9 the response is in - responseText
this.templateCache[url] = httpResult.response || httpResult.responseText;
// inform all listeners that this is now in the cache
var callbacks = this.waitingCallbacks[url];
for (var i = 0; i < callbacks.length; i++) {
var callback = callbacks[i];
// we could pass the callback the response, however we know the client of this code
// is the cell renderer, and it passes the 'cellRefresh' method in as the callback
// which doesn't take any parameters.
callback();
}
if (this.$scope) {
var that = this;
setTimeout(function () {
that.$scope.$apply();
}, 0);
}
};
return TemplateService;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = TemplateService;
|
var Stack = require('./_Stack'),
arrayEach = require('./_arrayEach'),
assignValue = require('./_assignValue'),
baseAssign = require('./_baseAssign'),
baseForOwn = require('./_baseForOwn'),
copyArray = require('./_copyArray'),
copySymbols = require('./_copySymbols'),
getTag = require('./_getTag'),
initCloneArray = require('./_initCloneArray'),
initCloneByTag = require('./_initCloneByTag'),
initCloneObject = require('./_initCloneObject'),
isArray = require('./isArray'),
isHostObject = require('./_isHostObject'),
isObject = require('./isObject');
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
cloneableTags[dateTag] = cloneableTags[float32Tag] =
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
cloneableTags[mapTag] = cloneableTags[numberTag] =
cloneableTags[objectTag] = cloneableTags[regexpTag] =
cloneableTags[setTag] = cloneableTags[stringTag] =
cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, isDeep, customizer, key, object, stack) {
var result;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) {
return object ? value : {};
}
result = initCloneObject(isFunc ? {} : value);
if (!isDeep) {
return copySymbols(value, baseAssign(result, value));
}
} else {
return cloneableTags[tag]
? initCloneByTag(value, tag, isDeep)
: (object ? value : {});
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
// Recursively populate clone (susceptible to call stack limits).
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack));
});
return isArr ? result : copySymbols(value, result);
}
module.exports = baseClone;
|
tinyMCE.addI18n({hu:{
common:{
edit_confirm:"Haszn\u00E1lni akarja a WYSIWYG m\u00F3dot ebben a sz\u00F6vegdobozban?",
apply:"Alkalmaz",
insert:"Besz\u00FAr",
update:"Friss\u00EDt",
cancel:"M\u00E9gse",
close:"Bez\u00E1r",
browse:"Tall\u00F3z",
class_name:"Oszt\u00E1ly",
not_set:"-- Nincs megadva --",
clipboard_msg:"A M\u00E1sol\u00E1s/Kiv\u00E1g\u00E1s/Besz\u00FAr\u00E1s funkci\u00F3k nem el\u00E9rhet\u0151k Mozilla \u00E9s Firefox alatt.\nK\u00EDv\u00E1n t\u00F6bbet tudni err\u0151l a t\u00E9m\u00E1r\u00F3l?",
clipboard_no_support:"Jelenleg nem t\u00E1mogatja a b\u00F6ng\u00E9sz\u0151je, haszn\u00E1lja a billenty\u0171kombin\u00E1ci\u00F3kat helyette.",
popup_blocked:"A felugr\u00F3 ablakok tilt\u00E1sa miatt nem tudtunk megjelen\u00EDteni egy, az alkalmaz\u00E1shoz sz\u00FCks\u00E9ges ablakot. Enged\u00E9lyezze a b\u00F6ng\u00E9sz\u0151j\u00E9ben a felugr\u00F3 ablakokat, hogy minden funkci\u00F3t haszn\u00E1lhasson.",
invalid_data:"Hiba: \u00C9rv\u00E9nytelen adatok, pirossal jel\u00F6lve.",
more_colors:"T\u00F6bb sz\u00EDn"
},
contextmenu:{
align:"Igaz\u00EDt\u00E1s",
left:"Balra",
center:"K\u00F6z\u00E9pre",
right:"Jobbra",
full:"Sorkiz\u00E1r\u00E1s"
},
insertdatetime:{
date_fmt:"%Y.%m.%d.",
time_fmt:"%H:%M:%S",
insertdate_desc:"D\u00E1tum besz\u00FAr\u00E1sa",
inserttime_desc:"Id\u0151 besz\u00FAr\u00E1sa",
months_long:"janu\u00E1r,febru\u00E1r,m\u00E1rcius,\u00E1prilis,m\u00E1jus,j\u00FAnius,j\u00FAlius,augusztus,szeptember,okt\u00F3ber,november,december",
months_short:"jan,feb,m\u00E1r,\u00E1pr,m\u00E1j,j\u00FAn,j\u00FAl,aug,szep,okt,nov,dec",
day_long:"vas\u00E1rnap,h\u00E9tf\u0151,kedd,szerda,cs\u00FCt\u00F6rt\u00F6k,p\u00E9ntek,szombat,vas\u00E1rnap",
day_short:"V,H,K,Sze,Cs,P,Szo,V"
},
print:{
print_desc:"Nyomtat\u00E1s"
},
preview:{
preview_desc:"El\u0151n\u00E9zet"
},
directionality:{
ltr_desc:"Balr\u00F3l jobbra",
rtl_desc:"Jobbr\u00F3l balra"
},
layer:{
insertlayer_desc:"\u00DAj r\u00E9teg besz\u00FAr\u00E1sa",
forward_desc:"Mozgat\u00E1s el\u0151re",
backward_desc:"Mozgat\u00E1s h\u00E1tra",
absolute_desc:"Abszol\u00FAt poz\u00EDci\u00F3 ki-/bekapcsol\u00E1sa",
content:"\u00DAj r\u00E9teg..."
},
save:{
save_desc:"Ment\u00E9s",
cancel_desc:"\u00D6sszes v\u00E1ltoz\u00E1s visszavon\u00E1sa"
},
nonbreaking:{
nonbreaking_desc:"Nemsort\u00F6r\u0151 sz\u00F3k\u00F6z besz\u00FAr\u00E1sa"
},
iespell:{
iespell_desc:"Helyes\u00EDr\u00E1s-ellen\u0151rz\u00E9s futtat\u00E1sa",
download:"ieSpell nem tal\u00E1lhat\u00F3. Telep\u00EDti most?"
},
advhr:{
advhr_desc:"V\u00EDzszintes vonal"
},
emotions:{
emotions_desc:"Hangulatjelek"
},
searchreplace:{
search_desc:"Keres\u00E9s",
replace_desc:"Keres\u00E9s/Csere"
},
advimage:{
image_desc:"K\u00E9p besz\u00FAr\u00E1sa/szerkeszt\u00E9se"
},
advlink:{
link_desc:"Link besz\u00FAr\u00E1sa/szerkeszt\u00E9s"
},
xhtmlxtras:{
cite_desc:"Id\u00E9zet",
abbr_desc:"R\u00F6vid\u00EDt\u00E9s",
acronym_desc:"Bet\u0171sz\u00F3",
del_desc:"T\u00F6r\u00F6lt",
ins_desc:"Besz\u00FArt",
attribs_desc:"Tulajdons\u00E1gok besz\u00FAr\u00E1sa/szerkeszt\u00E9se"
},
style:{
desc:"CSS st\u00EDlus szerkeszt\u00E9se"
},
paste:{
paste_text_desc:"Besz\u00FAr\u00E1s sz\u00F6vegk\u00E9nt",
paste_word_desc:"Besz\u00FAr\u00E1s Wordb\u0151l",
selectall_desc:"Mindent kijel\u00F6l"
},
paste_dlg:{
text_title:"Haszn\u00E1lja a Ctrl+V-t a billenty\u0171zet\u00E9n a beilleszt\u00E9shez.",
text_linebreaks:"Sort\u00F6r\u00E9sek megtart\u00E1sa",
word_title:"Haszn\u00E1lja a Ctrl+V-t a billenty\u0171zet\u00E9n a beilleszt\u00E9shez."
},
table:{
desc:"T\u00E1bl\u00E1zat besz\u00FAr\u00E1sa/szerkeszt\u00E9se",
row_before_desc:"Sor besz\u00FAr\u00E1sa el\u00E9",
row_after_desc:"Sor besz\u00FAr\u00E1sa ut\u00E1na",
delete_row_desc:"Sor t\u00F6rl\u00E9se",
col_before_desc:"Oszlop besz\u00FAr\u00E1sa el\u00E9",
col_after_desc:"Oszlop besz\u00FAr\u00E1sa ut\u00E1na",
delete_col_desc:"Oszlop t\u00F6rl\u00E9se",
split_cells_desc:"Cell\u00E1k feloszt\u00E1sa",
merge_cells_desc:"Cell\u00E1k \u00F6sszevon\u00E1sa",
row_desc:"Sor tulajdons\u00E1gai",
cell_desc:"Cella tulajdons\u00E1gai",
props_desc:"T\u00E1bl\u00E1zat tulajdons\u00E1gai",
paste_row_before_desc:"Sor bem\u00E1sol\u00E1sa el\u00E9",
paste_row_after_desc:"Sor bem\u00E1sol\u00E1sa ut\u00E1na",
cut_row_desc:"Sor kiv\u00E1g\u00E1sa",
copy_row_desc:"Sor m\u00E1sol\u00E1sa",
del:"T\u00E1bl\u00E1zat t\u00F6rl\u00E9se",
row:"Sor",
col:"Oszlop",
cell:"Cella"
},
autosave:{
unload_msg:"A m\u00F3dos\u00EDt\u00E1sok nem lesznek mentve, ha elhagyja az oldalt."
},
fullscreen:{
desc:"Teljesk\u00E9perny\u0151s m\u00F3d ki-/bekapcsol\u00E1sa"
},
media:{
desc:"Be\u00E1gyazott m\u00E9dia besz\u00FAr\u00E1sa/szerkeszt\u00E9se",
edit:"Be\u00E1gyazott m\u00E9dia szerkeszt\u00E9se"
},
fullpage:{
desc:"Dokumentum tulajdons\u00E1gai"
},
template:{
desc:"Sablon beilleszt\u00E9se"
},
visualchars:{
desc:"Vizu\u00E1lis vez\u00E9rl\u0151karakterek be/ki."
},
spellchecker:{
desc:"Helyes\u00EDr\u00E1s-ellen\u0151rz\u0151 ki-/bekapcsol\u00E1sa",
menu:"Helyes\u00EDr\u00E1s-ellen\u0151rz\u0151 tulajdons\u00E1gai",
ignore_word:"Sz\u00F3 kihagy\u00E1sa",
ignore_words:"Mindet kihagy",
langs:"Nyelvek",
wait:"K\u00E9rem, v\u00E1rjon...",
sug:"Aj\u00E1nl\u00E1sok",
no_sug:"Nincs aj\u00E1nl\u00E1s",
no_mpell:"Nem tal\u00E1ltam helyes\u00EDr\u00E1si hib\u00E1t."
},
pagebreak:{
desc:"Oldalt\u00F6r\u00E9s besz\u00FAr\u00E1sa."
}}});
|
'use strict';
var isWindows = process.platform === 'win32';
// Regex to split a windows path into three parts: [*, device, slash,
// tail] windows-only
var splitDeviceRe =
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
// Regex to split the tail part of the above into [*, dir, basename, ext]
var splitTailRe =
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
var win32 = {};
// Function to split a filename into [root, dir, basename, ext]
function win32SplitPath(filename) {
// Separate device+slash from tail
var result = splitDeviceRe.exec(filename),
device = (result[1] || '') + (result[2] || ''),
tail = result[3] || '';
// Split the tail into dir, basename and extension
var result2 = splitTailRe.exec(tail),
dir = result2[1],
basename = result2[2],
ext = result2[3];
return [device, dir, basename, ext];
}
win32.parse = function(pathString) {
if (typeof pathString !== 'string') {
throw new TypeError(
"Parameter 'pathString' must be a string, not " + typeof pathString
);
}
var allParts = win32SplitPath(pathString);
if (!allParts || allParts.length !== 4) {
throw new TypeError("Invalid path '" + pathString + "'");
}
return {
root: allParts[0],
dir: allParts[0] + allParts[1].slice(0, -1),
base: allParts[2],
ext: allParts[3],
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
};
};
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var posix = {};
function posixSplitPath(filename) {
return splitPathRe.exec(filename).slice(1);
}
posix.parse = function(pathString) {
if (typeof pathString !== 'string') {
throw new TypeError(
"Parameter 'pathString' must be a string, not " + typeof pathString
);
}
var allParts = posixSplitPath(pathString);
if (!allParts || allParts.length !== 4) {
throw new TypeError("Invalid path '" + pathString + "'");
}
allParts[1] = allParts[1] || '';
allParts[2] = allParts[2] || '';
allParts[3] = allParts[3] || '';
return {
root: allParts[0],
dir: allParts[0] + allParts[1].slice(0, -1),
base: allParts[2],
ext: allParts[3],
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
};
};
if (isWindows)
module.exports = win32.parse;
else /* posix */
module.exports = posix.parse;
module.exports.posix = posix.parse;
module.exports.win32 = win32.parse;
|
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Contains the DTD mapping for XHTML 1.0 Transitional.
* This file was automatically generated from the file: xhtml10-transitional.dtd
*/
FCK.DTD = (function()
{
var X = FCKTools.Merge ;
var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I ;
A = {isindex:1, fieldset:1} ;
B = {input:1, button:1, select:1, textarea:1, label:1} ;
C = X({a:1}, B) ;
D = X({iframe:1}, C) ;
E = {hr:1, ul:1, menu:1, div:1, blockquote:1, noscript:1, table:1, center:1, address:1, dir:1, pre:1, h5:1, dl:1, h4:1, noframes:1, h6:1, ol:1, h1:1, h3:1, h2:1} ;
F = {ins:1, del:1, script:1} ;
G = X({b:1, acronym:1, bdo:1, 'var':1, '#':1, abbr:1, code:1, br:1, i:1, cite:1, kbd:1, u:1, strike:1, s:1, tt:1, strong:1, q:1, samp:1, em:1, dfn:1, span:1}, F) ;
H = X({sub:1, img:1, object:1, sup:1, basefont:1, map:1, applet:1, font:1, big:1, small:1}, G) ;
I = X({p:1}, H) ;
J = X({iframe:1}, H, B) ;
K = {img:1, noscript:1, br:1, kbd:1, center:1, button:1, basefont:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, font:1, '#':1, select:1, menu:1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, iframe:1, strong:1, textarea:1, noframes:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, strike:1, dir:1, map:1, dl:1, applet:1, del:1, isindex:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, u:1, s:1, tt:1, address:1, q:1, pre:1, p:1, em:1, dfn:1} ;
L = X({a:1}, J) ;
M = {tr:1} ;
N = {'#':1} ;
O = X({param:1}, K) ;
P = X({form:1}, A, D, E, I) ;
Q = {li:1} ;
return {
col: {},
tr: {td:1, th:1},
img: {},
colgroup: {col:1},
noscript: P,
td: P,
br: {},
th: P,
center: P,
kbd: L,
button: X(I, E),
basefont: {},
h5: L,
h4: L,
samp: L,
h6: L,
ol: Q,
h1: L,
h3: L,
option: N,
h2: L,
form: X(A, D, E, I),
select: {optgroup:1, option:1},
font: J, // Changed from L to J (see (1))
ins: P,
menu: Q,
abbr: L,
label: L,
table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1},
code: L,
script: N,
tfoot: M,
cite: L,
li: P,
input: {},
iframe: P,
strong: J, // Changed from L to J (see (1))
textarea: N,
noframes: P,
big: J, // Changed from L to J (see (1))
small: J, // Changed from L to J (see (1))
span: J, // Changed from L to J (see (1))
hr: {},
dt: L,
sub: J, // Changed from L to J (see (1))
optgroup: {option:1},
param: {},
bdo: L,
'var': J, // Changed from L to J (see (1))
div: P,
object: O,
sup: J, // Changed from L to J (see (1))
dd: P,
strike: J, // Changed from L to J (see (1))
area: {},
dir: Q,
map: X({area:1, form:1, p:1}, A, F, E),
applet: O,
dl: {dt:1, dd:1},
del: P,
isindex: {},
fieldset: X({legend:1}, K),
thead: M,
ul: Q,
acronym: L,
b: J, // Changed from L to J (see (1))
a: J,
blockquote: P,
caption: L,
i: J, // Changed from L to J (see (1))
u: J, // Changed from L to J (see (1))
tbody: M,
s: L,
address: X(D, I),
tt: J, // Changed from L to J (see (1))
legend: L,
q: L,
pre: X(G, C),
p: L,
em: J, // Changed from L to J (see (1))
dfn: L
} ;
})() ;
/*
Notes:
(1) According to the DTD, many elements, like <b> accept <a> elements
inside of them. But, to produce better output results, we have manually
changed the map to avoid breaking the links on pieces, having
"<b>this is a </b><a><b>link</b> test</a>", instead of
"<b>this is a <a>link</a></b><a> test</a>".
*/
|
import {createBorderEdge} from "./Edge";
import {cells, edges, epsilon} from "./Diagram";
export function createCell(site) {
return cells[site.index] = {
site: site,
halfedges: []
};
}
function cellHalfedgeAngle(cell, edge) {
var site = cell.site,
va = edge.left,
vb = edge.right;
if (site === vb) vb = va, va = site;
if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]);
if (site === va) va = edge[1], vb = edge[0];
else va = edge[0], vb = edge[1];
return Math.atan2(va[0] - vb[0], vb[1] - va[1]);
}
export function cellHalfedgeStart(cell, edge) {
return edge[+(edge.left !== cell.site)];
}
export function cellHalfedgeEnd(cell, edge) {
return edge[+(edge.left === cell.site)];
}
export function sortCellHalfedges() {
for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) {
if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) {
var index = new Array(m),
array = new Array(m);
for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]);
index.sort(function(i, j) { return array[j] - array[i]; });
for (j = 0; j < m; ++j) array[j] = halfedges[index[j]];
for (j = 0; j < m; ++j) halfedges[j] = array[j];
}
}
}
export function clipCells(x0, y0, x1, y1) {
var nCells = cells.length,
iCell,
cell,
site,
iHalfedge,
halfedges,
nHalfedges,
start,
startX,
startY,
end,
endX,
endY,
cover = true;
for (iCell = 0; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
site = cell.site;
halfedges = cell.halfedges;
iHalfedge = halfedges.length;
// Remove any dangling clipped edges.
while (iHalfedge--) {
if (!edges[halfedges[iHalfedge]]) {
halfedges.splice(iHalfedge, 1);
}
}
// Insert any border edges as necessary.
iHalfedge = 0, nHalfedges = halfedges.length;
while (iHalfedge < nHalfedges) {
end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1];
start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1];
if (Math.abs(endX - startX) > epsilon || Math.abs(endY - startY) > epsilon) {
halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end,
Math.abs(endX - x0) < epsilon && y1 - endY > epsilon ? [x0, Math.abs(startX - x0) < epsilon ? startY : y1]
: Math.abs(endY - y1) < epsilon && x1 - endX > epsilon ? [Math.abs(startY - y1) < epsilon ? startX : x1, y1]
: Math.abs(endX - x1) < epsilon && endY - y0 > epsilon ? [x1, Math.abs(startX - x1) < epsilon ? startY : y0]
: Math.abs(endY - y0) < epsilon && endX - x0 > epsilon ? [Math.abs(startY - y0) < epsilon ? startX : x0, y0]
: null)) - 1);
++nHalfedges;
}
}
if (nHalfedges) cover = false;
}
}
// If there weren’t any edges, have the closest site cover the extent.
// It doesn’t matter which corner of the extent we measure!
if (cover) {
var dx, dy, d2, dc = Infinity;
for (iCell = 0, cover = null; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
site = cell.site;
dx = site[0] - x0;
dy = site[1] - y0;
d2 = dx * dx + dy * dy;
if (d2 < dc) dc = d2, cover = cell;
}
}
if (cover) {
var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0];
cover.halfedges.push(
edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1,
edges.push(createBorderEdge(site, v01, v11)) - 1,
edges.push(createBorderEdge(site, v11, v10)) - 1,
edges.push(createBorderEdge(site, v10, v00)) - 1
);
}
}
// Lastly delete any cells with no edges; these were entirely clipped.
for (iCell = 0; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
if (!cell.halfedges.length) {
delete cells[iCell];
}
}
}
}
|
/*
* Globalize Culture smj
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
(function( window, undefined ) {
var Globalize;
if ( typeof require !== "undefined" &&
typeof exports !== "undefined" &&
typeof module !== "undefined" ) {
// Assume CommonJS
Globalize = require( "globalize" );
} else {
// Global variable
Globalize = window.Globalize;
}
Globalize.addCultureInfo( "smj", "default", {
name: "smj",
englishName: "Sami (Lule)",
nativeName: "julevusámegiella",
language: "smj",
numberFormat: {
",": " ",
".": ",",
percent: {
",": " ",
".": ","
},
currency: {
pattern: ["-n $","n $"],
",": ".",
".": ",",
symbol: "kr"
}
},
calendars: {
standard: {
"/": "-",
firstDay: 1,
days: {
names: ["ájllek","mánnodahka","dijstahka","gasskavahkko","duorastahka","bierjjedahka","lávvodahka"],
namesAbbr: ["ájl","mán","dis","gas","duor","bier","láv"],
namesShort: ["á","m","d","g","d","b","l"]
},
months: {
names: ["ådåjakmánno","guovvamánno","sjnjuktjamánno","vuoratjismánno","moarmesmánno","biehtsemánno","sjnjilltjamánno","bårggemánno","ragátmánno","gålgådismánno","basádismánno","javllamánno",""],
namesAbbr: ["ådåj","guov","snju","vuor","moar","bieh","snji","bårg","ragá","gålg","basá","javl",""]
},
monthsGenitive: {
names: ["ådåjakmáno","guovvamáno","sjnjuktjamáno","vuoratjismáno","moarmesmáno","biehtsemáno","sjnjilltjamáno","bårggemáno","ragátmáno","gålgådismáno","basádismáno","javllamáno",""],
namesAbbr: ["ådåj","guov","snju","vuor","moar","bieh","snji","bårg","ragá","gålg","basá","javl",""]
},
AM: null,
PM: null,
patterns: {
d: "yyyy-MM-dd",
D: "MMMM d'. b. 'yyyy",
t: "HH:mm",
T: "HH:mm:ss",
f: "MMMM d'. b. 'yyyy HH:mm",
F: "MMMM d'. b. 'yyyy HH:mm:ss",
M: "MMMM d'. b. '",
Y: "MMMM yyyy"
}
}
}
});
}( this ));
|
tinyMCE.addI18n('mn.emotions_dlg',{
title:"\u0421\u044D\u0442\u0433\u044D\u043B \u0445\u04E9\u0434\u043B\u04E9\u043B \u043E\u0440\u0443\u0443\u043B\u0430\u0445",
desc:"\u0421\u044D\u0442\u0433\u044D\u043B \u0445\u04E9\u0434\u043B\u04E9\u043B",
cool:"\u0414\u043E\u0440\u0438\u0443\u043D",
cry:"\u0423\u0439\u043B\u0430\u0445",
embarassed:"\u0421\u0430\u043D\u0434\u0430\u0440\u0441\u0430\u043D",
foot_in_mouth:"\u0425\u0443\u0443\u0440\u0442\u0430\u0433\u0434\u0430\u0445",
frown:"\u0425\u04E9\u043C\u0441\u04E9\u0433 \u0437\u0430\u043D\u0433\u0438\u0434\u0430\u0445",
innocent:"\u0411\u0443\u0440\u0443\u0443\u0433\u04AF\u0439",
kiss:"\u04AE\u043D\u0441\u044D\u0445",
laughing:"\u0418\u043D\u044D\u044D\u0445",
money_mouth:"\u041C\u04E9\u043D\u0433\u04E9",
sealed:"\u0411\u0438\u0442\u04AF\u04AF\u043C\u0436\u0438\u043B\u0441\u044D\u043D",
smile:"\u0418\u043D\u044D\u044D\u0445",
surprised:"\u0413\u0430\u0439\u0445\u0441\u0430\u043D",
tongue_out:"\u0425\u044D\u043B\u044D\u044D \u0433\u0430\u0440\u0433\u0430\u0445",
undecided:"\u0428\u0438\u0439\u0434\u044D\u044D\u0433\u04AF\u0439",
wink:"\u041D\u04AF\u0434 \u0438\u0440\u043C\u044D\u0445",
yell:"\u041E\u0440\u0438\u043B\u043E\u0445"
});
|
//// [destructuringParameterProperties4.ts]
class C1<T, U, V> {
constructor(private k: T, protected [a, b, c]: [T,U,V]) {
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
public getA() {
return this.a
}
public getB() {
return this.b
}
public getC() {
return this.c;
}
}
class C2 extends C1<number, string, boolean> {
public doSomethingWithSuperProperties() {
return `${this.a} ${this.b} ${this.c}`;
}
}
//// [destructuringParameterProperties4.js]
class C1 {
constructor(k, [a, b, c]) {
this.k = k;
this.[a, b, c] = [a, b, c];
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
getA() {
return this.a;
}
getB() {
return this.b;
}
getC() {
return this.c;
}
}
class C2 extends C1 {
doSomethingWithSuperProperties() {
return `${this.a} ${this.b} ${this.c}`;
}
}
|
module.exports = {
'name': 'sqrt',
'category': 'Arithmetic',
'syntax': [
'sqrt(x)'
],
'description':
'Compute the square root value. If x = y * y, then y is the square root of x.',
'examples': [
'sqrt(25)',
'5 * 5',
'sqrt(-1)'
],
'seealso': [
'square',
'multiply'
]
};
|
'use strict';
module.exports.definition = {
set: function (v) {
this.setProperty('pause', v);
},
get: function () {
return this.getPropertyValue('pause');
},
enumerable: true,
configurable: true
};
|
// Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Tests String.prototype.localeCompare method override.
var testData = {
'en': ['blood', 'bull', 'ascend', 'zed', 'down'],
'sr': ['новине', 'ограда', 'жирафа', 'Никола', 'Андрија', 'Стара Планина',
'џак', 'алав', 'ћук', 'чука'],
'de': ['März', 'Fuße', 'FUSSE', 'Fluße', 'Flusse', 'flusse', 'fluße',
'flüße', 'flüsse']
};
function testArrays(locale) {
var data;
if (locale === undefined) {
data = testData['en'];
locale = [];
} else {
data = testData[locale];
}
var collator = new Intl.Collator(locale, options);
var collatorResult = data.sort(collator.compare);
var localeCompareResult = data.sort(function(a, b) {
return a.localeCompare(b, locale, options)
});
assertEquals(collatorResult, localeCompareResult);
}
// Defaults
var options = undefined;
testArrays();
// Specify locale, keep default options.
options = undefined;
Object.keys(testData).forEach(testArrays);
// Specify locale and options.
options = {caseFirst: 'upper'};
Object.keys(testData).forEach(testArrays);
|
/*
* /MathJax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Main.js
*
* Copyright (c) 2009-2016 The MathJax Consortium
*
* 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.
*/
MathJax.OutputJax.SVG.FONTDATA.FONTS.MathJax_Typewriter={directory:"Typewriter/Regular",family:"MathJax_Typewriter",id:"MJTT",Ranges:[[0,127,"BasicLatin"],[128,65535,"Other"],[768,879,"CombDiacritMarks"]]};MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Typewriter/Regular/Main.js");
|
var fs = require('fs'),
jshint = require('jshint'),
UglifyJS = require('uglify-js'),
zlib = require('zlib'),
deps = require('./deps.js').deps;
function getFiles(compsBase32) {
var memo = {},
comps;
if (compsBase32) {
comps = parseInt(compsBase32, 32).toString(2).split('');
console.log('Managing dependencies...');
}
function addFiles(srcs) {
for (var j = 0, len = srcs.length; j < len; j++) {
memo[srcs[j]] = true;
}
}
for (var i in deps) {
if (comps) {
if (parseInt(comps.pop(), 2) === 1) {
console.log(' * ' + i);
addFiles(deps[i].src);
} else {
console.log(' ' + i);
}
} else {
addFiles(deps[i].src);
}
}
console.log('');
var files = [];
for (var src in memo) {
files.push('src/' + src);
}
return files;
}
exports.getFiles = getFiles;
function getSizeDelta(newContent, oldContent, fixCRLF) {
if (!oldContent) {
return ' (new)';
}
if (newContent === oldContent) {
return ' (unchanged)';
}
if (fixCRLF) {
newContent = newContent.replace(/\r\n?/g, '\n');
oldContent = oldContent.replace(/\r\n?/g, '\n');
}
var delta = newContent.length - oldContent.length;
return delta === 0 ? '' : ' (' + (delta > 0 ? '+' : '') + delta + ' bytes)';
}
function loadSilently(path) {
try {
return fs.readFileSync(path, 'utf8');
} catch (e) {
return null;
}
}
function combineFiles(files) {
var content = '';
for (var i = 0, len = files.length; i < len; i++) {
content += fs.readFileSync(files[i], 'utf8') + '\n\n';
}
return content;
}
function bytesToKB(bytes) {
return (bytes / 1024).toFixed(2) + ' KB';
}
exports.build = function (callback, compsBase32, buildName) {
var files = getFiles(compsBase32);
console.log('Concatenating and compressing ' + files.length + ' files...');
var copy = fs.readFileSync('src/copyright.js', 'utf8'),
intro = '(function (window, document, undefined) {',
outro = '}(window, document));',
newSrc = copy + intro + combineFiles(files) + outro,
pathPart = 'dist/leaflet.draw' + (buildName ? '-' + buildName : ''),
srcPath = pathPart + '-src.js',
oldSrc = loadSilently(srcPath),
srcDelta = getSizeDelta(newSrc, oldSrc, true);
console.log('\tUncompressed: ' + bytesToKB(newSrc.length) + srcDelta);
if (newSrc !== oldSrc) {
fs.writeFileSync(srcPath, newSrc);
console.log('\tSaved to ' + srcPath);
}
var path = pathPart + '.js',
oldCompressed = loadSilently(path),
newCompressed = copy + UglifyJS.minify(newSrc, {
warnings: true,
fromString: true
}).code,
delta = getSizeDelta(newCompressed, oldCompressed);
console.log('\tCompressed: ' + bytesToKB(newCompressed.length) + delta);
var newGzipped,
gzippedDelta = '';
function done() {
if (newCompressed !== oldCompressed) {
fs.writeFileSync(path, newCompressed);
console.log('\tSaved to ' + path);
}
console.log('\tGzipped: ' + bytesToKB(newGzipped.length) + gzippedDelta);
callback();
}
zlib.gzip(newCompressed, function (err, gzipped) {
if (err) { return; }
newGzipped = gzipped;
if (oldCompressed && (oldCompressed !== newCompressed)) {
zlib.gzip(oldCompressed, function (err, oldGzipped) {
if (err) { return; }
gzippedDelta = getSizeDelta(gzipped, oldGzipped);
done();
});
} else {
done();
}
});
};
exports.test = function(callback) {
var karma = require('karma'),
testConfig = {configFile : __dirname + '/../spec/karma.conf.js'};
testConfig.browsers = ['PhantomJS'];
function isArgv(optName) {
return process.argv.indexOf(optName) !== -1;
}
if (isArgv('--chrome')) {
testConfig.browsers.push('Chrome');
}
if (isArgv('--safari')) {
testConfig.browsers.push('Safari');
}
if (isArgv('--ff')) {
testConfig.browsers.push('Firefox');
}
if (isArgv('--ie')) {
testConfig.browsers.push('IE');
}
if (isArgv('--cov')) {
testConfig.preprocessors = {
'src/**/*.js': 'coverage'
};
testConfig.coverageReporter = {
type : 'html',
dir : 'coverage/'
};
testConfig.reporters = ['coverage'];
}
console.log('Running tests...');
karma.server.start(testConfig, function(exitCode) {
if (!exitCode) {
console.log('\tTests ran successfully.\n');
}
callback();
});
};
|
//// [inheritedMembersAndIndexSignaturesFromDifferentBases2.ts]
interface A<T> {
[n: number]: T;
}
interface B {
foo: number;
}
interface C extends B, A<string> { } // Should succeed
//// [inheritedMembersAndIndexSignaturesFromDifferentBases2.js]
|
/*!
* string_score.js: String Scoring Algorithm 0.1.10
*
* http://joshaven.com/string_score
* https://github.com/joshaven/string_score
*
* Copyright (C) 2009-2011 Joshaven Potter <yourtech@gmail.com>
* Copyright (C) 2010-2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
* MIT license: http://www.opensource.org/licenses/mit-license.php
*
* Date: Tue Mar 1 2011
*/
String.prototype.score=function(m,s){var f=0,q=m.length,g=this,p=g.length,o,k,e=1,j;if(g==m){return 1}for(var d=0,r,n,h,a,b,l;d<q;++d){h=m[d];a=g.indexOf(h.toLowerCase());b=g.indexOf(h.toUpperCase());l=Math.min(a,b);n=(l>-1)?l:Math.max(a,b);if(n===-1){if(s){e+=1-s;continue}else{return 0}}else{r=0.1}if(g[n]===h){r+=0.1}if(n===0){r+=0.6;if(d===0){o=1}}else{if(g.charAt(n-1)===" "){r+=0.8}}g=g.substring(n+1,p);f+=r}k=f/q;j=((k*(q/p))+k)/2;j=j/e;if(o&&(j+0.15<1)){j+=0.15}return j};
|
(function($) {
'use strict';
var init = function($element, options) {
var settings = $.extend({
ajax: {
data: function(params) {
return {
term: params.term,
page: params.page
};
}
}
}, options);
$element.select2(settings);
};
$.fn.djangoAdminSelect2 = function(options) {
var settings = $.extend({}, options);
$.each(this, function(i, element) {
var $element = $(element);
init($element, settings);
});
return this;
};
$(function() {
// Initialize all autocomplete widgets except the one in the template
// form used when a new formset is added.
$('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2();
});
$(document).on('formset:added', (function() {
return function(event, $newFormset) {
return $newFormset.find('.admin-autocomplete').djangoAdminSelect2();
};
})(this));
}(django.jQuery));
|
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'div', 'et', {
IdInputLabel: 'ID',
advisoryTitleInputLabel: 'Soovitatav pealkiri',
cssClassInputLabel: 'Stiililehe klassid',
edit: 'Muuda Div',
inlineStyleInputLabel: 'Reasisene stiil',
langDirLTRLabel: 'Vasakult paremale (LTR)',
langDirLabel: 'Keele suund',
langDirRTLLabel: 'Paremalt vasakule (RTL)',
languageCodeInputLabel: ' Keelekood',
remove: 'Eemalda Div',
styleSelectLabel: 'Stiil',
title: 'Div-konteineri loomine',
toolbar: 'Div-konteineri loomine'
});
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"\u09b0\u09ac\u09bf\u09ac\u09be\u09b0",
"\u09b8\u09cb\u09ae\u09ac\u09be\u09b0",
"\u09ae\u0999\u09cd\u0997\u09b2\u09ac\u09be\u09b0",
"\u09ac\u09c1\u09a7\u09ac\u09be\u09b0",
"\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0",
"\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0",
"\u09b6\u09a8\u09bf\u09ac\u09be\u09b0"
],
"ERANAMES": [
"\u0996\u09cd\u09b0\u09bf\u09b8\u09cd\u099f\u09aa\u09c2\u09b0\u09cd\u09ac",
"\u0996\u09c3\u09b7\u09cd\u099f\u09be\u09ac\u09cd\u09a6"
],
"ERAS": [
"\u0996\u09cd\u09b0\u09bf\u09b8\u09cd\u099f\u09aa\u09c2\u09b0\u09cd\u09ac",
"\u0996\u09c3\u09b7\u09cd\u099f\u09be\u09ac\u09cd\u09a6"
],
"FIRSTDAYOFWEEK": 4,
"MONTH": [
"\u099c\u09be\u09a8\u09c1\u09af\u09bc\u09be\u09b0\u09c0",
"\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09af\u09bc\u09be\u09b0\u09c0",
"\u09ae\u09be\u09b0\u09cd\u099a",
"\u098f\u09aa\u09cd\u09b0\u09bf\u09b2",
"\u09ae\u09c7",
"\u099c\u09c1\u09a8",
"\u099c\u09c1\u09b2\u09be\u0987",
"\u0986\u0997\u09b8\u09cd\u099f",
"\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0",
"\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"
],
"SHORTDAY": [
"\u09b0\u09ac\u09bf",
"\u09b8\u09cb\u09ae",
"\u09ae\u0999\u09cd\u0997\u09b2",
"\u09ac\u09c1\u09a7",
"\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf",
"\u09b6\u09c1\u0995\u09cd\u09b0",
"\u09b6\u09a8\u09bf"
],
"SHORTMONTH": [
"\u099c\u09be\u09a8\u09c1",
"\u09ab\u09c7\u09ac",
"\u09ae\u09be\u09b0\u09cd\u099a",
"\u098f\u09aa\u09cd\u09b0\u09bf\u09b2",
"\u09ae\u09c7",
"\u099c\u09c1\u09a8",
"\u099c\u09c1\u09b2\u09be\u0987",
"\u0986\u0997\u09b8\u09cd\u099f",
"\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0",
"\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"
],
"STANDALONEMONTH": [
"\u099c\u09be\u09a8\u09c1\u09af\u09bc\u09be\u09b0\u09c0",
"\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09af\u09bc\u09be\u09b0\u09c0",
"\u09ae\u09be\u09b0\u09cd\u099a",
"\u098f\u09aa\u09cd\u09b0\u09bf\u09b2",
"\u09ae\u09c7",
"\u099c\u09c1\u09a8",
"\u099c\u09c1\u09b2\u09be\u0987",
"\u0986\u0997\u09b8\u09cd\u099f",
"\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0",
"\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0",
"\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"
],
"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": "d/M/yy h:mm a",
"shortDate": "d/M/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u09f3",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 2,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 2,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a4",
"posPre": "",
"posSuf": "\u00a4"
}
]
},
"id": "bn-bd",
"localeID": "bn_BD",
"pluralCat": function(n, opt_precision) { var i = n | 0; if (i == 0 || n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
assertFalse(2147483647 < -2147483648)
assertFalse(2147483647 <= -2147483648)
assertFalse(2147483647 == -2147483648)
assertTrue(2147483647 >= -2147483648)
assertTrue(2147483647 > -2147483648)
assertTrue(-2147483648 < 2147483647)
assertTrue(-2147483648 <= 2147483647)
assertFalse(-2147483648 == 2147483647)
assertFalse(-2147483648 >= 2147483647)
assertFalse(-2147483648 > 2147483647)
assertFalse(2147483647 < 2147483647)
assertTrue(2147483647 <= 2147483647)
assertTrue(2147483647 == 2147483647)
assertTrue(2147483647 >= 2147483647)
assertFalse(2147483647 > 2147483647)
assertFalse(-2147483648 < -2147483648)
assertTrue(-2147483648 <= -2147483648)
assertTrue(-2147483648 == -2147483648)
assertTrue(-2147483648 >= -2147483648)
assertFalse(-2147483648 > -2147483648)
assertFalse(1073741823 < -1073741824)
assertFalse(1073741823 <= -1073741824)
assertFalse(1073741823 == -1073741824)
assertTrue(1073741823 >= -1073741824)
assertTrue(1073741823 > -1073741824)
assertTrue(-1073741824 < 1073741823)
assertTrue(-1073741824 <= 1073741823)
assertFalse(-1073741824 == 1073741823)
assertFalse(-1073741824 >= 1073741823)
assertFalse(-1073741824 > 1073741823)
assertFalse(1073741823 < 1073741823)
assertTrue(1073741823 <= 1073741823)
assertTrue(1073741823 == 1073741823)
assertTrue(1073741823 >= 1073741823)
assertFalse(1073741823 > 1073741823)
assertFalse(-1073741824 < -1073741824)
assertTrue(-1073741824 <= -1073741824)
assertTrue(-1073741824 == -1073741824)
assertTrue(-1073741824 >= -1073741824)
assertFalse(-1073741824 > -1073741824)
|
/**
* @file
* A Backbone view for the collapsible menus.
*/
(function ($, Backbone, Drupal) {
'use strict';
Drupal.toolbar.MenuVisualView = Backbone.View.extend(/** @lends Drupal.toolbar.MenuVisualView# */{
/**
* Backbone View for collapsible menus.
*
* @constructs
*
* @augments Backbone.View
*/
initialize: function () {
this.listenTo(this.model, 'change:subtrees', this.render);
},
/**
* @inheritdoc
*/
render: function () {
var subtrees = this.model.get('subtrees');
// Add subtrees.
for (var id in subtrees) {
if (subtrees.hasOwnProperty(id)) {
this.$el
.find('#toolbar-link-' + id)
.once('toolbar-subtrees')
.after(subtrees[id]);
}
}
// Render the main menu as a nested, collapsible accordion.
if ('drupalToolbarMenu' in $.fn) {
this.$el
.children('.toolbar-menu')
.drupalToolbarMenu();
}
}
});
}(jQuery, Backbone, Drupal));
|
'use strict'
module.exports = writeFile
module.exports.sync = writeFileSync
module.exports._getTmpname = getTmpname // for testing
module.exports._cleanupOnExit = cleanupOnExit
var fs = require('graceful-fs')
var MurmurHash3 = require('imurmurhash')
var onExit = require('signal-exit')
var path = require('path')
var activeFiles = {}
var invocations = 0
function getTmpname (filename) {
return filename + '.' +
MurmurHash3(__filename)
.hash(String(process.pid))
.hash(String(++invocations))
.result()
}
function cleanupOnExit (tmpfile) {
return function () {
try {
fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile)
} catch (_) {}
}
}
function writeFile (filename, data, options, callback) {
if (options instanceof Function) {
callback = options
options = null
}
if (!options) options = {}
var Promise = options.Promise || global.Promise
var truename
var fd
var tmpfile
var removeOnExit = cleanupOnExit(() => tmpfile)
var absoluteName = path.resolve(filename)
new Promise(function serializeSameFile (resolve) {
// make a queue if it doesn't already exist
if (!activeFiles[absoluteName]) activeFiles[absoluteName] = []
activeFiles[absoluteName].push(resolve) // add this job to the queue
if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one
}).then(function getRealPath () {
return new Promise(function (resolve) {
fs.realpath(filename, function (_, realname) {
truename = realname || filename
tmpfile = getTmpname(truename)
resolve()
})
})
}).then(function stat () {
return new Promise(function stat (resolve) {
if (options.mode && options.chown) resolve()
else {
// Either mode or chown is not explicitly set
// Default behavior is to copy it from original file
fs.stat(truename, function (err, stats) {
if (err || !stats) resolve()
else {
options = Object.assign({}, options)
if (!options.mode) {
options.mode = stats.mode
}
if (!options.chown && process.getuid) {
options.chown = { uid: stats.uid, gid: stats.gid }
}
resolve()
}
})
}
})
}).then(function thenWriteFile () {
return new Promise(function (resolve, reject) {
fs.open(tmpfile, 'w', options.mode, function (err, _fd) {
fd = _fd
if (err) reject(err)
else resolve()
})
})
}).then(function write () {
return new Promise(function (resolve, reject) {
if (Buffer.isBuffer(data)) {
fs.write(fd, data, 0, data.length, 0, function (err) {
if (err) reject(err)
else resolve()
})
} else if (data != null) {
fs.write(fd, String(data), 0, String(options.encoding || 'utf8'), function (err) {
if (err) reject(err)
else resolve()
})
} else resolve()
})
}).then(function syncAndClose () {
if (options.fsync !== false) {
return new Promise(function (resolve, reject) {
fs.fsync(fd, function (err) {
if (err) reject(err)
else fs.close(fd, resolve)
})
})
}
}).then(function chown () {
if (options.chown) {
return new Promise(function (resolve, reject) {
fs.chown(tmpfile, options.chown.uid, options.chown.gid, function (err) {
if (err) reject(err)
else resolve()
})
})
}
}).then(function chmod () {
if (options.mode) {
return new Promise(function (resolve, reject) {
fs.chmod(tmpfile, options.mode, function (err) {
if (err) reject(err)
else resolve()
})
})
}
}).then(function rename () {
return new Promise(function (resolve, reject) {
fs.rename(tmpfile, truename, function (err) {
if (err) reject(err)
else resolve()
})
})
}).then(function success () {
removeOnExit()
callback()
}).catch(function fail (err) {
removeOnExit()
fs.unlink(tmpfile, function () {
callback(err)
})
}).then(function checkQueue () {
activeFiles[absoluteName].shift() // remove the element added by serializeSameFile
if (activeFiles[absoluteName].length > 0) {
activeFiles[absoluteName][0]() // start next job if one is pending
} else delete activeFiles[absoluteName]
})
}
function writeFileSync (filename, data, options) {
if (!options) options = {}
try {
filename = fs.realpathSync(filename)
} catch (ex) {
// it's ok, it'll happen on a not yet existing file
}
var tmpfile = getTmpname(filename)
try {
if (!options.mode || !options.chown) {
// Either mode or chown is not explicitly set
// Default behavior is to copy it from original file
try {
var stats = fs.statSync(filename)
options = Object.assign({}, options)
if (!options.mode) {
options.mode = stats.mode
}
if (!options.chown && process.getuid) {
options.chown = { uid: stats.uid, gid: stats.gid }
}
} catch (ex) {
// ignore stat errors
}
}
var removeOnExit = onExit(cleanupOnExit(tmpfile))
var fd = fs.openSync(tmpfile, 'w', options.mode)
if (Buffer.isBuffer(data)) {
fs.writeSync(fd, data, 0, data.length, 0)
} else if (data != null) {
fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8'))
}
if (options.fsync !== false) {
fs.fsyncSync(fd)
}
fs.closeSync(fd)
if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid)
if (options.mode) fs.chmodSync(tmpfile, options.mode)
fs.renameSync(tmpfile, filename)
removeOnExit()
} catch (err) {
removeOnExit()
try { fs.unlinkSync(tmpfile) } catch (e) {}
throw err
}
}
|
alert('JS is working');
|
'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": [
"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0628\u06c7\u0631\u06c7\u0646",
"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0643\u06d0\u064a\u0649\u0646"
],
"DAY": [
"\u064a\u06d5\u0643\u0634\u06d5\u0646\u0628\u06d5",
"\u062f\u06c8\u0634\u06d5\u0646\u0628\u06d5",
"\u0633\u06d5\u064a\u0634\u06d5\u0646\u0628\u06d5",
"\u0686\u0627\u0631\u0634\u06d5\u0646\u0628\u06d5",
"\u067e\u06d5\u064a\u0634\u06d5\u0646\u0628\u06d5",
"\u062c\u06c8\u0645\u06d5",
"\u0634\u06d5\u0646\u0628\u06d5"
],
"MONTH": [
"\u064a\u0627\u0646\u06cb\u0627\u0631",
"\u0641\u06d0\u06cb\u0631\u0627\u0644",
"\u0645\u0627\u0631\u062a",
"\u0626\u0627\u067e\u0631\u06d0\u0644",
"\u0645\u0627\u064a",
"\u0626\u0649\u064a\u06c7\u0646",
"\u0626\u0649\u064a\u06c7\u0644",
"\u0626\u0627\u06cb\u063a\u06c7\u0633\u062a",
"\u0633\u06d0\u0646\u062a\u06d5\u0628\u0649\u0631",
"\u0626\u06c6\u0643\u062a\u06d5\u0628\u0649\u0631",
"\u0628\u0648\u064a\u0627\u0628\u0649\u0631",
"\u062f\u06d0\u0643\u0627\u0628\u0649\u0631"
],
"SHORTDAY": [
"\u064a\u06d5",
"\u062f\u06c8",
"\u0633\u06d5",
"\u0686\u0627",
"\u067e\u06d5",
"\u0686\u06c8",
"\u0634\u06d5"
],
"SHORTMONTH": [
"\u064a\u0627\u0646\u06cb\u0627\u0631",
"\u0641\u06d0\u06cb\u0631\u0627\u0644",
"\u0645\u0627\u0631\u062a",
"\u0626\u0627\u067e\u0631\u06d0\u0644",
"\u0645\u0627\u064a",
"\u0626\u0649\u064a\u06c7\u0646",
"\u0626\u0649\u064a\u06c7\u0644",
"\u0626\u0627\u06cb\u063a\u06c7\u0633\u062a",
"\u0633\u06d0\u0646\u062a\u06d5\u0628\u0649\u0631",
"\u0626\u06c6\u0643\u062a\u06d5\u0628\u0649\u0631",
"\u0646\u0648\u064a\u0627\u0628\u0649\u0631",
"\u062f\u06d0\u0643\u0627\u0628\u0649\u0631"
],
"fullDate": "EEEE\u060c MMMM d\u060c y",
"longDate": "MMMM d\u060c y",
"medium": "MMM d\u060c y h:mm:ss a",
"mediumDate": "MMM d\u060c y",
"mediumTime": "h:mm:ss a",
"short": "M/d/yy h:mm a",
"shortDate": "M/d/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u00a5",
"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": "ug-arab-cn",
"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;}
});
}]);
|
/*!
* Chai - addProperty utility
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/**
* ### addProperty (ctx, name, getter)
*
* Adds a property to the prototype of an object.
*
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
* var obj = utils.flag(this, 'object');
* new chai.Assertion(obj).to.be.instanceof(Foo);
* });
*
* Can also be accessed directly from `chai.Assertion`.
*
* chai.Assertion.addProperty('foo', fn);
*
* Then can be used as any other assertion.
*
* expect(myFoo).to.be.foo;
*
* @param {Object} ctx object to which the property is added
* @param {String} name of property to add
* @param {Function} getter function to be used for name
* @name addProperty
* @api public
*/
module.exports = function (ctx, name, getter) {
Object.defineProperty(ctx, name,
{ get: function () {
var result = getter.call(this);
return result === undefined ? this : result;
}
, configurable: true
});
};
|
/* http://keith-wood.name/countdown.html
* Vietnamese initialisation for the jQuery countdown extension
* Written by Pham Tien Hung phamtienhung@gmail.com (2010) */
(function($) {
$.countdown.regional['vi'] = {
labels: ['Năm', 'Tháng', 'Tuần', 'Ngày', 'Giờ', 'Phút', 'Giây'],
labels1: ['Năm', 'Tháng', 'Tuần', 'Ngày', 'Giờ', 'Phút', 'Giây'],
compactLabels: ['năm', 'th', 'tu', 'ng'],
whichLabels: null,
timeSeparator: ':', isRTL: false};
$.countdown.setDefaults($.countdown.regional['vi']);
})(jQuery);
|
/**
* Custom scripts needed for the colorpicker, image button selectors,
* and navigation tabs.
*/
jQuery(document).ready(function($) {
// Loads the color pickers
$('.of-color').wpColorPicker();
// Image Options
$('.of-radio-img-img').click(function(){
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
$(this).addClass('of-radio-img-selected');
});
$('.of-radio-img-label').hide();
$('.of-radio-img-img').show();
$('.of-radio-img-radio').hide();
// Loads tabbed sections if they exist
if ( $('.nav-tab-wrapper').length > 0 ) {
options_framework_tabs();
}
function options_framework_tabs() {
// Hides all the .group sections to start
$('.group').hide();
// Find if a selected tab is saved in localStorage
var active_tab = '';
if ( typeof(localStorage) != 'undefined' ) {
active_tab = localStorage.getItem("active_tab");
}
// If active tab is saved and exists, load it's .group
if (active_tab != '' && $(active_tab).length ) {
$(active_tab).fadeIn();
$(active_tab + '-tab').addClass('nav-tab-active');
} else {
$('.group:first').fadeIn();
$('.nav-tab-wrapper a:first').addClass('nav-tab-active');
}
// Bind tabs clicks
$('.nav-tab-wrapper a').click(function(evt) {
evt.preventDefault();
// Remove active class from all tabs
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
$(this).addClass('nav-tab-active').blur();
var group = $(this).attr('href');
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem("active_tab", $(this).attr('href') );
}
$('.group').hide();
$(group).fadeIn();
// Editor height sometimes needs adjustment when unhidden
$('.wp-editor-wrap').each(function() {
var editor_iframe = $(this).find('iframe');
if ( editor_iframe.height() < 30 ) {
editor_iframe.css({'height':'auto'});
}
});
});
}
});
|
import ENV from '../config/environment';
import ghostPaths from 'ghost/utils/ghost-paths';
var Ghost = ghostPaths();
export default {
name: 'simple-auth-env',
before: 'simple-auth-oauth2',
initialize: function () {
ENV['simple-auth-oauth2'].serverTokenEndpoint = Ghost.apiRoot + '/authentication/token';
ENV['simple-auth-oauth2'].serverTokenRevocationEndpoint = Ghost.apiRoot + '/authentication/revoke';
ENV['simple-auth'].localStorageKey = 'ghost' + (Ghost.subdir.indexOf('/') === 0 ? '-' + Ghost.subdir.substr(1) : '') + ':session';
}
};
|
var inst = require("../index").getInstance();
module.exports = inst.use("classnamemanager");
|
// Basically just a wrapper around an fs.readlink
//
// XXX: Enhance this to support the Link type, by keeping
// a lookup table of {<dev+inode>:<path>}, so that hardlinks
// can be preserved in tarballs.
module.exports = LinkReader
var fs = require('graceful-fs')
var inherits = require('inherits')
var Reader = require('./reader.js')
inherits(LinkReader, Reader)
function LinkReader (props) {
var self = this
if (!(self instanceof LinkReader)) {
throw new Error('LinkReader must be called as constructor.')
}
if (!((props.type === 'Link' && props.Link) ||
(props.type === 'SymbolicLink' && props.SymbolicLink))) {
throw new Error('Non-link type ' + props.type)
}
Reader.call(self, props)
}
// When piping a LinkReader into a LinkWriter, we have to
// already have the linkpath property set, so that has to
// happen *before* the "ready" event, which means we need to
// override the _stat method.
LinkReader.prototype._stat = function (currentStat) {
var self = this
fs.readlink(self._path, function (er, linkpath) {
if (er) return self.error(er)
self.linkpath = self.props.linkpath = linkpath
self.emit('linkpath', linkpath)
Reader.prototype._stat.call(self, currentStat)
})
}
LinkReader.prototype._read = function () {
var self = this
if (self._paused) return
// basically just a no-op, since we got all the info we need
// from the _stat method
if (!self._ended) {
self.emit('end')
self.emit('close')
self._ended = true
}
}
|
define(["backbone", "js/utils/module"], function(Backbone, ModuleUtils) {
var ModuleInfo = Backbone.Model.extend({
urlRoot: ModuleUtils.urlRoot,
defaults: {
"id": null,
"data": null,
"metadata" : null,
"children" : null
}
});
return ModuleInfo;
});
|
'use strict';
var path = require('./$.path')
, invoke = require('./$.invoke')
, aFunction = require('./$.a-function');
module.exports = function(/* ...pargs */){
var fn = aFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, _length = arguments.length
, j = 0, k = 0, args;
if(!holder && !_length)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
while(_length > k)args.push(arguments[k++]);
return invoke(fn, args, that);
};
};
|
YUI.add('moodle-core-lockscroll', function (Y, NAME) {
/**
* Provides the ability to lock the scroll for a page, allowing nested
* locking.
*
* @module moodle-core-lockscroll
*/
/**
* Provides the ability to lock the scroll for a page.
*
* This is achieved by applying the class 'lockscroll' to the body Node.
*
* Nested widgets are also supported and the scroll lock is only removed
* when the final plugin instance is disabled.
*
* @class M.core.LockScroll
* @extends Plugin.Base
*/
Y.namespace('M.core').LockScroll = Y.Base.create('lockScroll', Y.Plugin.Base, [], {
/**
* Whether the LockScroll has been activated.
*
* @property _enabled
* @type Boolean
* @protected
*/
_enabled: false,
/**
* Handle destruction of the lockScroll instance, including disabling
* of the current instance.
*
* @method destructor
*/
destructor: function() {
this.disableScrollLock();
},
/**
* Start locking the page scroll.
*
* This is achieved by applying the lockscroll class to the body Node.
*
* A count of the total number of active, and enabled, lockscroll instances is also kept on
* the body to ensure that premature disabling does not occur.
*
* @method enableScrollLock
* @param {Boolean} forceOnSmallWindow Whether to enable the scroll lock, even for small window sizes.
* @chainable
*/
enableScrollLock: function(forceOnSmallWindow) {
if (this.isActive()) {
return;
}
if (!this.shouldLockScroll(forceOnSmallWindow)) {
return;
}
this._enabled = true;
var body = Y.one(Y.config.doc.body);
// Get width of body before turning on lockscroll.
var widthBefore = body.getComputedStyle('width');
// We use a CSS class on the body to handle the actual locking.
body.addClass('lockscroll');
// Increase the count of active instances - this is used to ensure that we do not
// remove the locking when parent windows are still open.
// Note: We cannot use getData here because data attributes are sandboxed to the instance that created them.
var currentCount = parseInt(body.getAttribute('data-activeScrollLocks'), 10) || 0,
newCount = currentCount + 1;
body.setAttribute('data-activeScrollLocks', newCount);
// When initially enabled, set the body max-width to its current width. This
// avoids centered elements jumping because the width changes when scrollbars
// disappear.
if (currentCount === 0) {
body.setStyle('maxWidth', widthBefore);
}
return this;
},
/**
* Recalculate whether lock scrolling should be on or off.
*
* @method shouldLockScroll
* @param {Boolean} forceOnSmallWindow Whether to enable the scroll lock, even for small window sizes.
* @return boolean
*/
shouldLockScroll: function(forceOnSmallWindow) {
var dialogueHeight = this.get('host').get('boundingBox').get('region').height,
// Most modern browsers use win.innerHeight, but some older versions of IE use documentElement.clientHeight.
// We fall back to 0 if neither can be found which has the effect of disabling scroll locking.
windowHeight = Y.config.win.innerHeight || Y.config.doc.documentElement.clientHeight || 0;
if (!forceOnSmallWindow && dialogueHeight > (windowHeight - 10)) {
return false;
} else {
return true;
}
},
/**
* Recalculate whether lock scrolling should be on or off because the size of the dialogue changed.
*
* @method updateScrollLock
* @param {Boolean} forceOnSmallWindow Whether to enable the scroll lock, even for small window sizes.
* @chainable
*/
updateScrollLock: function(forceOnSmallWindow) {
// Both these functions already check if scroll lock is active and do the right thing.
if (this.shouldLockScroll(forceOnSmallWindow)) {
this.enableScrollLock(forceOnSmallWindow);
} else {
this.disableScrollLock(true);
}
return this;
},
/**
* Stop locking the page scroll.
*
* The instance may be disabled but the scroll lock not removed if other instances of the
* plugin are also active.
*
* @method disableScrollLock
* @chainable
*/
disableScrollLock: function(force) {
if (this.isActive()) {
this._enabled = false;
var body = Y.one(Y.config.doc.body);
// Decrease the count of active instances.
// Note: We cannot use getData here because data attributes are sandboxed to the instance that created them.
var currentCount = parseInt(body.getAttribute('data-activeScrollLocks'), 10) || 1,
newCount = currentCount - 1;
if (force || currentCount === 1) {
body.removeClass('lockscroll');
body.setStyle('maxWidth', null);
}
body.setAttribute('data-activeScrollLocks', currentCount - 1);
}
return this;
},
/**
* Return whether scroll locking is active.
*
* @method isActive
* @return Boolean
*/
isActive: function() {
return this._enabled;
}
}, {
NS: 'lockScroll',
ATTRS: {
}
});
}, '@VERSION@', {"requires": ["plugin", "base-build"]});
|
import Service from 'backbone.service';
import Backbone from 'backbone';
import _ from 'underscore';
import PromisePolyfill from 'es6-promise';
const ES6Promise = PromisePolyfill.Promise;
/**
* @class ModalService
*/
export default Service.extend({
/**
* @abstract
* @method requests
*/
requests() {
return {
open : 'open',
close : 'close',
alert : 'alert',
confirm : 'confirm',
prompt : 'prompt',
};
},
/**
* @constructs ModalService
*/
constructor() {
this.views = [];
this.listenTo(Backbone.history, 'route', () => {
if (this.fragment !== Backbone.history.fragment) {
this.fragment = null;
this.close();
}
});
this._super(...arguments);
},
/**
* @method open
* @param {Backbone.View} [view]
* @returns {Promise}
*/
open(view, options) {
let previousView;
return ES6Promise.resolve().then(() => {
this.trigger('before:open', view, options);
this.fragment = Backbone.history.fragment;
this._isOpen = true;
previousView = _.last(this.views);
this.views.push(view);
return this.render(view, options);
}).then(() => {
if (previousView) {
return this.animateSwap(previousView, view, options);
} else {
return this.animateIn(view, options);
}
}).then(() => {
this.trigger('open', view, options);
});
},
/**
* @method close
* @param {Backbone.View} [view]
* @returns {Promise}
*/
close(view, options) {
let previousView;
let views;
return ES6Promise.resolve().then(() => {
if (view) {
this.trigger('before:close', view, options);
} else {
_.map(this.views, view => this.trigger('before:close', view, options));
}
this._isOpen = false;
if (view) {
views = this.views = _.without(this.views, view);
} else {
views = this.views;
this.views = [];
}
previousView = _.last(views);
if (view && previousView) {
return this.animateSwap(view, previousView, options);
} else if (view) {
return this.animateOut(view, options);
} else if (previousView) {
return this.animateOut(previousView, options);
}
}).then(() => {
if (view) {
return this.remove(view, options);
} else {
return Promise.all(_.map(views, view => this.remove(view, options)));
}
}).then(() => {
if (view) {
this.trigger('close', view, options);
} else {
_.map(views, view => this.trigger('close', view, options));
}
});
},
/**
* @method alert
* @param {Object} [options]
* @returns {Promise}
*/
alert(options) {
return new ES6Promise((resolve, reject) => {
let view = new this.AlertView(options);
let promise = this.open(view, options);
this.trigger('before:alert', view, options);
view.on('confirm cancel', () => {
promise
.then(() => this.close(view, options))
.then(() => this.trigger('alert', null, view, options))
.then(resolve, reject);
});
});
},
/**
* @method confirm
* @param {Object} [options]
* @returns {Promise}
*/
confirm(options) {
return new ES6Promise((resolve, reject) => {
let view = new this.ConfirmView(options);
let promise = this.open(view, options);
this.trigger('before:confirm', view, options);
let close = result => {
promise
.then(() => this.close(view, options))
.then(() => this.trigger('confirm', result, view, options))
.then(() => resolve(result), reject);
};
view.on({
confirm: () => close(true),
cancel: () => close(false)
});
});
},
/**
* @method prompt
* @returns {Promise}
*/
prompt(options) {
return new ES6Promise((resolve, reject) => {
let view = new this.PromptView(options);
let promise = this.open(view, options);
this.trigger('before:prompt', view, options);
let close = result => {
promise
.then(() => this.close(view, options))
.then(() => this.trigger('prompt', result, view, options))
.then(() => resolve(result), reject);
};
view.on({
submit: text => close(text),
cancel: () => close()
});
});
},
/**
* @method isOpen
* @returns {Boolean}
*/
isOpen() {
return !!this._isOpen;
},
/**
* @abstract
* @method render
*/
render() {},
/**
* @abstract
* @method remove
*/
remove() {},
/**
* @abstract
* @method animateIn
*/
animateIn() {},
/**
* @abstract
* @method animateSwap
*/
animateSwap() {},
/**
* @abstract
* @method animateOut
*/
animateOut() {},
});
|
import invariant from 'invariant'
import crossSpawn from 'cross-spawn'
export default function spawn(command, args, options = {}, callback) {
invariant(typeof callback === 'function', 'Expected a function')
let stderr = ''
const child = crossSpawn(command, args, {
stdio: 'pipe',
...options,
}).on('exit', code => {
callback(
code &&
`spawn failed\n` +
`command: ${command} ${args.join(' ')}\n` +
(options.cwd ? `at: ${options.cwd}` : '') +
(stderr ? `, encountered error:\n${stderr}` : '')
)
})
if (child.stderr) {
child.stderr.setEncoding('utf8').on('data', chunk => {
stderr += chunk
})
}
return child
}
export const spawnSync = crossSpawn.sync
/*
export function exec(command, options = {}, callback) {
invariant(typeof callback === 'function', 'Expected a function')
const child = childProcess.exec(command, options, (err, stdout, stderr) => {
callback(
err &&
new Error(
`\n[Binge] Exec failed\n` +
`[Binge] cmd -> ${command}\n` +
(options.cwd ? `[Binge] at -> ${options.cwd}\n` : '') +
(stderr ? `[Binge] Raw error:\n` : '')
)
)
})
return child
}
*/
|
const Bottleneck = require('bottleneck')
const GitHubApi = require('github')
/**
* the [github Node.js module](https://github.com/octokit/node-github),
* which wraps the [GitHub API](https://developer.github.com/v3/) and allows
* you to do almost anything programmatically that you can do through a web
* browser.
* @typedef github
* @see {@link https://github.com/octokit/node-github}
*/
// Default callback should just return the response passed to it.
const defaultCallback = response => response
class EnhancedGitHubClient extends GitHubApi {
constructor (options) {
super(options)
this.limiter = new Bottleneck(1, 1000)
this.logger = options.logger
}
handler (params, block, callback) {
// Only allow one request at a time with a 1s delay
// https://github.com/octokit/node-github/issues/526
this.limiter.submit(super.handler.bind(this), params, block, (err, res) => {
let msg = `GitHub request: ${block.method} ${block.url}`
if (res) {
msg += ` - ${res.meta.status}`
} else if (err) {
msg += ` - ${err.code} ${err.status}`
}
this.logger.debug({params}, msg)
if (res) {
this.logger.trace(res, 'GitHub response:')
}
callback(err, res)
})
}
async paginate (responsePromise, callback = defaultCallback) {
let collection = []
let response = await responsePromise
collection = collection.concat(await callback(response))
while (this.hasNextPage(response)) {
response = await this.getNextPage(response)
collection = collection.concat(await callback(response))
}
return collection
}
}
module.exports = EnhancedGitHubClient
|
function getStatusXHR (endpoint) {
return new Promise((resolve, reject) => {
var xhr = new window.XMLHttpRequest();
xhr.open('GET', endpoint);
xhr.responseType = 'json';
xhr.onload = function () {
resolve(xhr.response);
};
xhr.onerror = function (err) {
console.error("Houston, we've got a problem.", err, xhr);
reject();
};
xhr.send();
});
}
module.exports = getStatusXHR;
|
'use strict';
var util = require('util');
var Bluebird = require('bluebird');
var Oath = require('./index');
function JSONOath(name, options) {
Oath.call(this, name, options);
}
util.inherits(JSONOath, Oath);
module.exports = JSONOath;
JSONOath.prototype.create = function (data) {
var mapped = this.mapper(data);
mapped.id = 1;
this.store.push(mapped);
return Bluebird.resolve(mapped);
};
|
load("sbbsdefs.js");
function showNodelist() {
bbs.menu.redraw = true; //reset redraw key
console.print("\1h\1" +"0\1n");
switch (system.node_list[bbs.node_num-1].action) {
case (NODE_MCHT):
case (NODE_LCHT):
case (NODE_GCHT):
case (NODE_PCHT):
case (NODE_PAGE):
case (NODE_RMSG):
//User in Chat, or reading messages, no cls, no header.
if (bbs.menu.paused) {
//at a p-prompt
console.ansi_up();
console.clearline();
}
console.print("\1n \r\n");
break;
default:
console.line_counter = 0;
console.clear();
}
//Nodelist Header
console.print("" +
"\1h\1n\1c" +
" N User A:S Location Status On\r\n" +
"\1h\1k" +
"ÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄ\r\n" +
"\1h\r\1n \r\n" +
"");
console.ansi_up();
var iUsers = 0
for (var n=0; n<system.node_list.length; n++) {
var node = system.node_list[n]
if(node.status==NODE_INUSE) {
iUsers++;
var oUser = new User(node.useron);
var sBuffer = " ";
var sNode = ((n+1) + sBuffer).substring(0,2);
var sAgeSex = (oUser.age + oUser.gender.substring(0,1).toUpperCase() + sBuffer).substring(0,3);
var sLocation = (oUser.location + sBuffer).substring(0,23);
var sStatus = "";
if(system.node_list[n].action==NODE_MCHT) {
if (parseInt(system.node_list[n].aux) > 0)
sStatus = "Chat #" + system.node_list[n].aux + " (" + oUser.handle + ")";
else
sStatus = "Chatting";
sStatus = (sStatus + sBuffer).substring(0,19);
} else {
if(system.node_list[n].action==NODE_XTRN && system.node_list[n].aux) {
//sStatus= doors[system.node_list[n].aux-1]
sStatus = oUser.curxtrn;
for (var i=0; i<xtrn_area.sec_list.length; i++) {
var xa = xtrn_area.sec_list[i];
for (var j=0; j<xa.prog_list.length; j++) {
var xp = xa.prog_list[j];
if (xp.can_run)
if (xp.code == sStatus) {
sStatus = xp.name;
j = 9999;
i = 9999;
}
}
}
}else{
sStatus=format(NodeAction[system.node_list[n].action],system.node_list[n].aux);
}
sStatus = (sStatus + sBuffer).substring(0,19);
}
var sFlags = "";
if (oUser.security.level >= 85) {
sUser = "\1h\1w" + (oUser.alias + sBuffer).substring(0,15);
} else if (oUser.security.level >= 80) {
sUser = "\1h\1y" + (oUser.alias + sBuffer).substring(0,15);
} else if ((oUser.security.restrictions&UFLAG_G) != 0) {
sUser = "\1h\1n\1c" + (oUser.alias + sBuffer).substring(0,15);
} else {
sUser = "\1h\1n" + (oUser.alias + sBuffer).substring(0,15);
}
if (oUser.security.flags2&UFLAG_G)
sUser = "\1h\1g" + (oUser.alias + sBuffer).substring(0,15);
if (oUser.security.flags2&UFLAG_C)
sUser = "\1h\1c" + (oUser.alias + sBuffer).substring(0,15);
if (oUser.security.flags1&UFLAG_V)
sLocation = "\1n" + sLocation + "\1n\1c"
t=time()-oUser.logontime;
if(t&0x80000000) t=0;
t = sBuffer + Math.floor(t/60);
t = t.substr(t.length - 3, 3);
if (false) sFlags += "";
console.print("" +
"\1h\1c " + sNode +
" " + sUser +
" \1n\1c " + sAgeSex +
" " + sLocation +
" " + sStatus +
" " + t +
"\r\n" +
"");
}
}
console.print("\r");
console.up();
bbs.menu("webusers");
//Nodelist footer...
console.print("" +
"\1h\1k" +
"ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r\n" +
"\1h\r\1n" +
"");
// if (iUsers < 2) {
// console.print("\1h\1r No other active nodes.\1n\r\n");
// }
return iUsers;
}
showNodelist();
if (bbs.online && (bbs.sys_status&SS_USERON) != 0) {
if ((user.security.restrictions&UFLAG_C) == 0) {
// showNodelist();
var iStatus = system.node_list[bbs.node_num-1].action
switch (iStatus) {
case (NODE_LCHT):
case (NODE_MCHT):
case (NODE_GCHT):
case (NODE_PCHT):
case (NODE_PAGE):
//User in Chat, no pause.
break;
default:
console.pause();
bbs.menu.paused = false;
}
}
if (bbs.menu.expertprompt)
bbs.menu.redraw = true;
else
bbs.menu.reprompt = true;
}else{
console.ansi_up();
console.ansi_up();
}
|
/**
* Module dependencies.
*/
var Transport = require('../transport')
, parser = require('engine.io-parser')
, debug = require('debug')('engine:ws')
/**
* Export the constructor.
*/
module.exports = WebSocket;
/**
* WebSocket transport
*
* @param {http.ServerRequest}
* @api public
*/
function WebSocket (req) {
Transport.call(this, req);
var self = this;
this.socket = req.websocket;
this.socket.on('message', this.onData.bind(this));
this.socket.once('close', this.onClose.bind(this));
this.socket.on('error', this.onError.bind(this));
this.socket.on('headers', function(headers) {
self.emit('headers', headers);
});
this.writable = true;
this.perMessageDeflate = null;
};
/**
* Inherits from Transport.
*/
WebSocket.prototype.__proto__ = Transport.prototype;
/**
* Transport name
*
* @api public
*/
WebSocket.prototype.name = 'websocket';
/**
* Advertise upgrade support.
*
* @api public
*/
WebSocket.prototype.handlesUpgrades = true;
/**
* Advertise framing support.
*
* @api public
*/
WebSocket.prototype.supportsFraming = true;
/**
* Processes the incoming data.
*
* @param {String} encoded packet
* @api private
*/
WebSocket.prototype.onData = function(data) {
debug('received "%s"', data);
Transport.prototype.onData.call(this, data);
};
/**
* Writes a packet payload.
*
* @param {Array} packets
* @api private
*/
WebSocket.prototype.send = function(packets) {
var self = this;
packets.forEach(function(packet) {
parser.encodePacket(packet, self.supportsBinary, function(data) {
debug('writing "%s"', data);
// always creates a new object since ws modifies it
var opts = {};
if (packet.options) {
opts.compress = packet.options.compress;
}
if (self.perMessageDeflate) {
var len = 'string' == typeof data ? Buffer.byteLength(data) : data.length;
if (len < self.perMessageDeflate.threshold) {
opts.compress = false;
}
}
self.writable = false;
self.socket.send(data, opts, function(err) {
if (err) {
return self.onError('write error', err.stack);
}
self.writable = true;
self.emit('drain');
});
});
});
};
/**
* Closes the transport.
*
* @api private
*/
WebSocket.prototype.doClose = function(fn) {
debug('closing');
this.socket.close();
fn && fn();
};
|
import * as actions from "./actions";
import { merge } from "./util";
const init = {
current_scene: actions.SCENE_TITLE,
// An array of the next scene's name and optional args.
next: [actions.SCENE_TITLE],
}
export default function navigation(state = init, action, args) {
switch (action) {
case actions.TRANSITION_START: {
return merge(state, { next: args });
}
case actions.TRANSITION_END: {
return merge(state, { next: [null]});
}
case actions.TRANSITION_CHANGE_SCENE: {
const { next: [next_scene] } = state;
return merge(state, { current_scene: next_scene });
}
default: {
return state;
}
}
}
|
import mod1913 from './mod1913';
var value=mod1913+1;
export default value;
|
module.exports = [
".COM",
"2.0",
"as a service",
"as code",
"at large",
"at scale",
"en masse",
"for dummies",
"for people",
"forever",
"hacks",
"in 3-D",
"remembered",
"with cheese",
"with ease",
];
|
'use strict'
module.exports = function renderState (target, state, type, stamp, subs, tree, id, pid) {
if (type !== 'update' && type !== 'new') {
if (target.__on.removeEmitter) {
target.__on.removeEmitter.emit(target, stamp, tree._ && tree._[id])
}
} else if (!tree._) {
tree._ = {}
}
return target.render.state(target, state, type, stamp, subs, tree, id, pid)
}
|
import 'html-element/global-shim'
import { property, element } from '../../../static'
import fragment from './fragment'
import { tag } from '../../../../get'
import { puid } from 'brisky-struct'
const injectable = {}
export default injectable
injectable.state = (t, type, subs, tree, id, pnode, state) => {
const nodeType = tag(t)
if (nodeType === 'fragment') {
return fragment(t, pnode, id, tree)
} else {
const node = document.createElement(nodeType)
property(t, node)
element(t, node)
tree._[id] = node
if (!t._noResolve_) {
// if (node.getAttribute('haha')) {
// console.log('here 💜💜💜💜💜💜', id, state)
// }
node.setAttribute('id', ((id * 33 ^ puid(state))) >>> 0)
}
return node
}
}
injectable.static = t => {
const nodeType = tag(t)
const node = document.createElement(nodeType)
property(t, node)
element(t, node)
return node
}
|
import MaintainMax from './lib/MaintainMax';
import Sprite from './Sprite';
import config from './config';
/**
* @class Canvas
* @description Creates and renders to the canvas DOM element
* @extends GetSet
* @required MaintainMax
* @author Chris Peters
*/
export default class Canvas {
/**
* @param {object} [deps]
* @param {object} [deps.document]
* @param {object} [deps.window]
*/
constructor(deps) {
deps = deps || {};
this._document = deps.document || document;
this._window = deps.window || window;
this._canvas = this._document.createElement('canvas');
this._context = this._canvas.getContext('2d');
this._canvas.width = config.viewportWidth * config.ppp;
this._canvas.height = config.viewportHeight * config.ppp;
this._canvas.style.position = 'absolute';
this._canvas.style.backgroundColor = config.canvasBgColor;
config.parentEl.style.backgroundColor = config.parentElBgColor;
config.parentEl.appendChild(this._canvas);
this._window.addEventListener('resize', this._handleResize.bind(this));
this._handleResize();
}
/**
* adjust canvas MaintainMax to fit canvas to resized window
*/
_handleResize() {
let { top, left, width, height } = MaintainMax.fit(
config.viewportWidth * config.ppp,
config.viewportHeight * config.ppp
);
this._canvas.style.top = `${Math.round(top)}px`;
this._canvas.style.left = `${Math.round(left)}px`;
this._canvas.style.width = `${Math.round(width)}px`;
this._canvas.style.height = `${Math.round(height)}px`;
this.onResize();
}
/**
* render Picls to the canvas
*
* @private
* @param {Integer} x [description]
* @param {Integer} y [description]
* @param {String} color [description]
*/
_renderPicl(x, y, color) {
let ppp = config.ppp;
this._context.fillStyle = color;
this._context.fillRect(x * ppp, y * ppp, ppp, ppp);
this._context.restore();
}
/**
* adjust the canvas based on the Sprite's attrs
*/
_setSpriteContext(sprite) {
let ppp = config.ppp;
this._context.translate(sprite.getX() * ppp, sprite.getY() * ppp);
this._context.scale(sprite.getScaleX(), sprite.getScaleY());
this._context.rotate(sprite.getRotation());
if (sprite.getOpacity() !== 1) {
this._context.globalAlpha = sprite.getOpacity();
}
if (sprite.getComposite() !== Sprite.getCompositeDefault()) {
this._context.globalCompositeOperation = sprite.getComposite();
}
}
/**
* @return {HTMLEntity} canvas
*/
getEl() {
return this._canvas;
}
/**
* window (and subsequently, canvas el) resize callback
* @return {[type]} [description]
*/
onResize() {}
/**
* collects entity's Picls and renders them to canvas
*
* @param {Object} entity Any nbit entity
*/
render(entity) {
let picls = entity.render();
this._context.save();
if (entity instanceof Sprite) {
this._setSpriteContext(entity);
}
for (let picl of picls) {
this._renderPicl(picl.x, picl.y, picl.color);
}
}
renderPool(pool) {
for (let entity of pool) {
this.render(entity);
}
}
}
|
import _throttle from 'lodash-es/throttle';
import { select as d3_select } from 'd3-selection';
import { modeBrowse } from '../modes/browse';
import { svgPointTransform } from './helpers';
import { services } from '../services';
let _layerEnabled = false;
let _qaService;
export function svgImproveOSM(projection, context, dispatch) {
const throttledRedraw = _throttle(() => dispatch.call('change'), 1000);
const minZoom = 12;
let touchLayer = d3_select(null);
let drawLayer = d3_select(null);
let layerVisible = false;
function markerPath(selection, klass) {
selection
.attr('class', klass)
.attr('transform', 'translate(-10, -28)')
.attr('points', '16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6');
}
// Loosely-coupled improveOSM service for fetching issues
function getService() {
if (services.improveOSM && !_qaService) {
_qaService = services.improveOSM;
_qaService.on('loaded', throttledRedraw);
} else if (!services.improveOSM && _qaService) {
_qaService = null;
}
return _qaService;
}
// Show the markers
function editOn() {
if (!layerVisible) {
layerVisible = true;
drawLayer
.style('display', 'block');
}
}
// Immediately remove the markers and their touch targets
function editOff() {
if (layerVisible) {
layerVisible = false;
drawLayer
.style('display', 'none');
drawLayer.selectAll('.qaItem.improveOSM')
.remove();
touchLayer.selectAll('.qaItem.improveOSM')
.remove();
}
}
// Enable the layer. This shows the markers and transitions them to visible.
function layerOn() {
editOn();
drawLayer
.style('opacity', 0)
.transition()
.duration(250)
.style('opacity', 1)
.on('end interrupt', () => dispatch.call('change'));
}
// Disable the layer. This transitions the layer invisible and then hides the markers.
function layerOff() {
throttledRedraw.cancel();
drawLayer.interrupt();
touchLayer.selectAll('.qaItem.improveOSM')
.remove();
drawLayer
.transition()
.duration(250)
.style('opacity', 0)
.on('end interrupt', () => {
editOff();
dispatch.call('change');
});
}
// Update the issue markers
function updateMarkers() {
if (!layerVisible || !_layerEnabled) return;
const service = getService();
const selectedID = context.selectedErrorID();
const data = (service ? service.getItems(projection) : []);
const getTransform = svgPointTransform(projection);
// Draw markers..
const markers = drawLayer.selectAll('.qaItem.improveOSM')
.data(data, d => d.id);
// exit
markers.exit()
.remove();
// enter
const markersEnter = markers.enter()
.append('g')
.attr('class', d => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
markersEnter
.append('polygon')
.call(markerPath, 'shadow');
markersEnter
.append('ellipse')
.attr('cx', 0)
.attr('cy', 0)
.attr('rx', 4.5)
.attr('ry', 2)
.attr('class', 'stroke');
markersEnter
.append('polygon')
.attr('fill', 'currentColor')
.call(markerPath, 'qaItem-fill');
markersEnter
.append('use')
.attr('class', 'icon-annotation')
.attr('transform', 'translate(-6, -22)')
.attr('width', '12px')
.attr('height', '12px')
.attr('xlink:href', d => d.icon ? '#' + d.icon : '');
// update
markers
.merge(markersEnter)
.sort(sortY)
.classed('selected', d => d.id === selectedID)
.attr('transform', getTransform);
// Draw targets..
if (touchLayer.empty()) return;
const fillClass = context.getDebug('target') ? 'pink ' : 'nocolor ';
const targets = touchLayer.selectAll('.qaItem.improveOSM')
.data(data, d => d.id);
// exit
targets.exit()
.remove();
// enter/update
targets.enter()
.append('rect')
.attr('width', '20px')
.attr('height', '30px')
.attr('x', '-10px')
.attr('y', '-28px')
.merge(targets)
.sort(sortY)
.attr('class', d => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`)
.attr('transform', getTransform);
function sortY(a, b) {
return (a.id === selectedID) ? 1
: (b.id === selectedID) ? -1
: b.loc[1] - a.loc[1];
}
}
// Draw the ImproveOSM layer and schedule loading issues and updating markers.
function drawImproveOSM(selection) {
const service = getService();
const surface = context.surface();
if (surface && !surface.empty()) {
touchLayer = surface.selectAll('.data-layer.touch .layer-touch.markers');
}
drawLayer = selection.selectAll('.layer-improveOSM')
.data(service ? [0] : []);
drawLayer.exit()
.remove();
drawLayer = drawLayer.enter()
.append('g')
.attr('class', 'layer-improveOSM')
.style('display', _layerEnabled ? 'block' : 'none')
.merge(drawLayer);
if (_layerEnabled) {
if (service && ~~context.map().zoom() >= minZoom) {
editOn();
service.loadIssues(projection);
updateMarkers();
} else {
editOff();
}
}
}
// Toggles the layer on and off
drawImproveOSM.enabled = function(val) {
if (!arguments.length) return _layerEnabled;
_layerEnabled = val;
if (_layerEnabled) {
layerOn();
} else {
layerOff();
if (context.selectedErrorID()) {
context.enter(modeBrowse(context));
}
}
dispatch.call('change');
return this;
};
drawImproveOSM.supported = () => !!getService();
return drawImproveOSM;
}
|
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = getCurrentStyles;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _getNodeTree = require('./get-node-tree');
var _getNodeTree2 = _interopRequireDefault(_getNodeTree);
var COMMANDS = {
B: 'bold',
STRONG: 'bold',
I: 'italic',
U: 'underline'
};
var STYLES = {
textAlign: ['left', 'center', 'right', 'justify'],
fontSize: [1, 2, 3, 4, 5, 6, 7],
fontStyle: 'italic',
textDecoration: ['overline', 'line-through', 'underline']
};
// get all the styles that are associated with a node
function getCurrentStyles(startNode, endNode) {
var nodes = (0, _getNodeTree2['default'])(startNode, endNode);
var commands = [];
nodes.forEach(function (node) {
var tagName = node.tagName;
for (var style in STYLES) {
if (style === STYLES) {
commands.push(STYLES[style]);
}
}
for (var command in COMMANDS) {
if (command === tagName) {
commands.push(COMMANDS[command]);
}
}
});
return commands;
}
module.exports = exports['default'];
|
// ==UserScript==
// @id iitc-plugin-render-limit-increase@jonatkins
// @name iitc: render limit increase
// @version 0.1.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js
// @description Increase the render limits, so less likely to be hit in higher density areas
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.renderLimitIncrease = function() {};
window.plugin.renderLimitIncrease.setHigherLimits = function() {
// this controls how far data is being drawn outside the viewport. Set
// it 0 to only draw entities that intersect the current view. A value
// of one will render an area twice the size of the viewport (or some-
// thing like that, Leaflet doc isn’t too specific). Setting it too low
// makes the missing data on move/zoom out more obvious. Setting it too
// high causes too many items to be drawn, making drag&drop sluggish.
// default for iitc is 0.3. a lower value reduces overdraw
window.VIEWPORT_PAD_RATIO = 0.1;
// Leaflet will get very slow for MANY items. It’s better to display
// only some instead of crashing the browser.
// defaults are 1000 portals, 400 links and 200 fields
window.MAX_DRAWN_PORTALS = 3000;
window.MAX_DRAWN_LINKS = 1000;
window.MAX_DRAWN_FIELDS = 500;
window.USE_INCREASED_RENDER_LIMIT = true; // Used for other plugins
};
var setup = window.plugin.renderLimitIncrease.setHigherLimits;
// PLUGIN END //////////////////////////////////////////////////////////
if(window.iitcLoaded && typeof setup === 'function') {
setup();
} else {
if(window.bootPlugins)
window.bootPlugins.push(setup);
else
window.bootPlugins = [setup];
}
} // wrapper end
// inject code into site context
var script = document.createElement('script');
script.appendChild(document.createTextNode('('+ wrapper +')();'));
(document.body || document.head || document.documentElement).appendChild(script);
|
var gemoji = require('gemoji'),
emojiPattern,
emojiArray,
emojiRegex
;
function emojiStrip (str) {
return str.replace(emojiStrip.regex, '');
}
emojiArray = Object.keys(gemoji.unicode);
emojiPattern = '(' + emojiArray.join('|') + ')+';
emojiRegex = new RegExp(emojiPattern, 'g');
emojiStrip.emoji = emojiArray;
emojiStrip.regex = new RegExp(emojiPattern, 'g');
module.exports = emojiStrip;
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createInv = void 0;
var _is = require("../../utils/is");
var _array = require("../../utils/array");
var _factory = require("../../utils/factory");
var _string = require("../../utils/string");
var name = 'inv';
var dependencies = ['typed', 'matrix', 'divideScalar', 'addScalar', 'multiply', 'unaryMinus', 'det', 'identity', 'abs'];
var createInv =
/* #__PURE__ */
(0, _factory.factory)(name, dependencies, function (_ref) {
var typed = _ref.typed,
matrix = _ref.matrix,
divideScalar = _ref.divideScalar,
addScalar = _ref.addScalar,
multiply = _ref.multiply,
unaryMinus = _ref.unaryMinus,
det = _ref.det,
identity = _ref.identity,
abs = _ref.abs;
/**
* Calculate the inverse of a square matrix.
*
* Syntax:
*
* math.inv(x)
*
* Examples:
*
* math.inv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]
* math.inv(4) // returns 0.25
* 1 / 4 // returns 0.25
*
* See also:
*
* det, transpose
*
* @param {number | Complex | Array | Matrix} x Matrix to be inversed
* @return {number | Complex | Array | Matrix} The inverse of `x`.
*/
return typed(name, {
'Array | Matrix': function ArrayMatrix(x) {
var size = (0, _is.isMatrix)(x) ? x.size() : (0, _array.arraySize)(x);
switch (size.length) {
case 1:
// vector
if (size[0] === 1) {
if ((0, _is.isMatrix)(x)) {
return matrix([divideScalar(1, x.valueOf()[0])]);
} else {
return [divideScalar(1, x[0])];
}
} else {
throw new RangeError('Matrix must be square ' + '(size: ' + (0, _string.format)(size) + ')');
}
case 2:
// two dimensional array
{
var rows = size[0];
var cols = size[1];
if (rows === cols) {
if ((0, _is.isMatrix)(x)) {
return matrix(_inv(x.valueOf(), rows, cols), x.storage());
} else {
// return an Array
return _inv(x, rows, cols);
}
} else {
throw new RangeError('Matrix must be square ' + '(size: ' + (0, _string.format)(size) + ')');
}
}
default:
// multi dimensional array
throw new RangeError('Matrix must be two dimensional ' + '(size: ' + (0, _string.format)(size) + ')');
}
},
any: function any(x) {
// scalar
return divideScalar(1, x); // FIXME: create a BigNumber one when configured for bignumbers
}
});
/**
* Calculate the inverse of a square matrix
* @param {Array[]} mat A square matrix
* @param {number} rows Number of rows
* @param {number} cols Number of columns, must equal rows
* @return {Array[]} inv Inverse matrix
* @private
*/
function _inv(mat, rows, cols) {
var r, s, f, value, temp;
if (rows === 1) {
// this is a 1 x 1 matrix
value = mat[0][0];
if (value === 0) {
throw Error('Cannot calculate inverse, determinant is zero');
}
return [[divideScalar(1, value)]];
} else if (rows === 2) {
// this is a 2 x 2 matrix
var d = det(mat);
if (d === 0) {
throw Error('Cannot calculate inverse, determinant is zero');
}
return [[divideScalar(mat[1][1], d), divideScalar(unaryMinus(mat[0][1]), d)], [divideScalar(unaryMinus(mat[1][0]), d), divideScalar(mat[0][0], d)]];
} else {
// this is a matrix of 3 x 3 or larger
// calculate inverse using gauss-jordan elimination
// https://en.wikipedia.org/wiki/Gaussian_elimination
// http://mathworld.wolfram.com/MatrixInverse.html
// http://math.uww.edu/~mcfarlat/inverse.htm
// make a copy of the matrix (only the arrays, not of the elements)
var A = mat.concat();
for (r = 0; r < rows; r++) {
A[r] = A[r].concat();
} // create an identity matrix which in the end will contain the
// matrix inverse
var B = identity(rows).valueOf(); // loop over all columns, and perform row reductions
for (var c = 0; c < cols; c++) {
// Pivoting: Swap row c with row r, where row r contains the largest element A[r][c]
var ABig = abs(A[c][c]);
var rBig = c;
r = c + 1;
while (r < rows) {
if (abs(A[r][c]) > ABig) {
ABig = abs(A[r][c]);
rBig = r;
}
r++;
}
if (ABig === 0) {
throw Error('Cannot calculate inverse, determinant is zero');
}
r = rBig;
if (r !== c) {
temp = A[c];
A[c] = A[r];
A[r] = temp;
temp = B[c];
B[c] = B[r];
B[r] = temp;
} // eliminate non-zero values on the other rows at column c
var Ac = A[c];
var Bc = B[c];
for (r = 0; r < rows; r++) {
var Ar = A[r];
var Br = B[r];
if (r !== c) {
// eliminate value at column c and row r
if (Ar[c] !== 0) {
f = divideScalar(unaryMinus(Ar[c]), Ac[c]); // add (f * row c) to row r to eliminate the value
// at column c
for (s = c; s < cols; s++) {
Ar[s] = addScalar(Ar[s], multiply(f, Ac[s]));
}
for (s = 0; s < cols; s++) {
Br[s] = addScalar(Br[s], multiply(f, Bc[s]));
}
}
} else {
// normalize value at Acc to 1,
// divide each value on row r with the value at Acc
f = Ac[c];
for (s = c; s < cols; s++) {
Ar[s] = divideScalar(Ar[s], f);
}
for (s = 0; s < cols; s++) {
Br[s] = divideScalar(Br[s], f);
}
}
}
}
return B;
}
}
});
exports.createInv = createInv;
|
var childProcess = require("child_process")
describe("CLI", () => {
it("exits 1 on error", () => {
expect(() => {
childProcess.execSync("./cli.js sync", {stdio: "pipe"})
}).toThrow("URL must be provided for sync")
})
it("exits 0 on OK", () => {
childProcess.execSync("./cli.js sync -h", {stdio: "pipe"})
})
})
|
//var defer = null;
function Employee() {
this.ID = "",
this.EmpNo = "",
this.EmpName = "",
this.EmpEmailID = ""
};
//function Error(Message) {
// alert(Message);
//};
//function initPromises(q) {
// defer = q.defer();
// var promise = defer.promise;
// promise.then('', Error);
//};
|
/*
* GET home page.
*/
module.exports = function(app) {
app.get('/menage', function(req, res) {
res.render('home', { title: 'Movie Trivia' });
});
};
|
var Promise = require('bluebird');
var validator = require('validator');
var Notebook = require('../../proxy').Notebook;
var User = require('../../proxy').User;
/**
* 获取用户所有文集
*/
exports.getNotebook = function (req, res, next) {
var userId = req.query.userid;
//参数校验
if (userId && !validator.isMongoId(userId)) {
res.status(400);
return res.send({
success: false,
error_msg: '不是有效的用户id'
});
}
//操作数据库
var notebook={
_id: 0,
name: '未分类'
};
Notebook.getNotebooksByUserId(userId)
.then(function (notebooks) {
notebooks.push(notebook);
return res.send({
success: true,
data: notebooks
})
}).catch(next);
}
//创建新的文集
exports.postNotebook = function (req, res, next) {
var userId = req.body.userId;
var name = req.body.name;
//参数校验
if (!validator.isMongoId(userId)) {
res.status(400);
return res.send({
success: false,
error_msg: '不是有效的用户id'
});
}
var name = validator.trim(name);
if (name === '') {
res.status(400);
return res.send({
success: false,
error_msg: '文集名称不能为空'
});
}
//操作数据库
Notebook.createNotebook({
name: name,
user: userId
}).then(function (result) {
return res.send({
success: true,
data: result
});
}).catch(function(err){
console.log(err);
});
}
//更新文集
exports.putNotebook = function (req, res, next) {
var id = req.params.id;
var name = req.body.name;
//参数校验
if (!validator.isMongoId(id)) {
res.status(400);
return res.send({
success: false,
error_msg: '不是有效的文集id'
});
}
var name = validator.trim(name);
if (name === '') {
res.status(400);
return res.send({
success: false,
error_msg: '文集名称不能为空'
});
}
//操作数据库
Notebook.updateNotebook(id, name)
.then(function () {
return Notebook.getNotebookById(id);
})
.then(function(result){
return res.send({
success: true,
data: result
});
})
.catch(next);
};
//删除文集
exports.deleteNotebook = function (req, res, next) {
var id = req.params.id;
//参数校验
if (!validator.isMongoId(id)) {
res.status(400);
return res.send({
success: false,
error_msg: '不是有效的文集id'
});
}
//操作数据库
Notebook.removeNotebook(id)
.then(function(result){
return res.send({
success: true,
data: result
});
}).catch(next);
};
|
// provide some mock data for the database
import mongoose from 'mongoose';
import Article from './models/article';
import User from './models/user';
/**
* Configure database
*/
mongoose.connect('mongodb://localhost:27017/ilmapallo2');
mongoose.connection.on('error', () => {
console.log('MongoDB Connection Error. Please make sure that MongoDB is running.');
process.exit(1);
});
// Article mock data
const ARTICLES = [
{ title: 'The first article', text: 'I don\'t know what happened.' },
{ title: 'The badgers are back', text: 'All the badgers have returned to their homes.' },
{ title: 'It\'s going well', text: 'What else is there left to say?' },
];
// User mock data
const USERS = [
{ name: 'user', password: 'user' },
{ name: 'david', password: 'david' },
];
Article.remove({}, (err) => {
console.log('Articles removed.');
for (const a of ARTICLES) {
Article.create(a, (errc, article) => {
if (errc) {
console.log(errc);
process.exit(1);
}
console.log(article);
});
}
});
User.remove({}, (err) => {
console.log('Users removed.');
for (const u of USERS) {
User.create(u, (errc, user) => {
if (errc) {
console.log(errc);
process.exit(1);
}
console.log(user);
if (u === USERS.slice(-1)[0]) process.exit(0);
});
}
});
|
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: {
files: ['dist']
},
copy:{
main:{
files: [
{expand: true, cwd: 'src/demo', src: ['**'], dest: 'dist/demo'},
{expand: true, cwd: 'src/inc', src: ['**'], dest: 'dist/inc'},
{expand: true, cwd: 'src/inc', src: ['**'], dest: 'dist/inc.all'},
{expand: true, cwd: 'src/inc', src: ['**'], dest: 'dist/demo/inc'},
{expand: true, cwd: 'libs/php-cache-0.0.2/dist/inc', src: ['**'], dest: 'dist/inc.all'},
{expand: true, cwd: 'libs/php-cache-0.0.2/dist/inc', src: ['**'], dest: 'dist/demo/inc'}
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task.
grunt.registerTask('default', ['clean', 'copy']);
};
|
// @flow
import * as React from 'react';
import classnames from 'classnames';
import defaultCss from './SectionHeader.css';
type Css = {
title: string,
strapline: string,
}
type Props = {
className?: string,
title: React.Node,
strapline: React.Node,
level: number,
css: Css
}
const SectionHeader = (props: Props) => {
const { title, strapline, className, level, css, ...rest } = props;
const titleClasses = classnames(
defaultCss.base,
strapline ? [defaultCss.titleWithStrapline] : [defaultCss.title],
css.title,
);
const straplineClasses = classnames(defaultCss.base, defaultCss.strapline, css.strapline);
const titleEl = <span className={titleClasses}>{title}</span>;
const straplineEl = strapline && <span className={straplineClasses}>{strapline}</span>;
return React.createElement(`h${level}`, { className, ...(rest: any) }, titleEl, straplineEl);
};
SectionHeader.defaultProps = {
level: 1,
css: {
title: '',
strapline: '',
},
};
export default SectionHeader;
|
process.on('message', (obj = {}) => {
const { id, ms } = obj;
setTimeout(() => {
try {
// process.send could throw if
// parent process has already exited
process.send({
id,
ms,
});
} catch (err) {
// eslint-disable no-empty
}
}, ms);
});
|
goog.module('one.two.SomeModule');
const Foo = goog.require('one.two.Foo');
const Bar = goog.require('one.two.Bar');
const Baz = goog.require('one.two.Baz');
const SomeModule = angular.module('one.two.SomeModule', [
Foo.name,
Bar.name,
Baz.name
]);
exports = SomeModule;
|
app.filter('topicCategory', function() {
return function(items, category) {
var filtered = new Array();
angular.forEach(items, function(topic) {
if(topic.category) {
if(topic.category.title == category.title) {
filtered.push(topic);
}
}
});
return filtered;
};
});
|
function metadata(error,data)
{
if (error) { alert(error);}
$("#title").text(data.title);
var result = "Authors: "
for (var i= 0;i < data.authors.length;i ++)
{
result += data.authors[i] + ", ";
}
result = result.slice(0, -2);
$("#authors").text(result);
$("#description").text(data.description);
$("#link").html("<a href=\"" + data.url +"\">" + "Link" + "</a>");
}
|
'use strict';
angular.module('erogeYoApp')
.controller('SignupCtrl', function ($scope, Auth, $location, $window) {
$scope.user = {};
$scope.errors = {};
$scope.register = function(form) {
$scope.submitted = true;
if(form.$valid) {
Auth.createUser({
name: $scope.user.name,
email: $scope.user.email,
password: $scope.user.password
})
.then( function() {
// Account created, redirect to home
$location.path('/');
})
.catch( function(err) {
err = err.data;
$scope.errors = {};
// Update validity of form fields that match the mongoose errors
angular.forEach(err.errors, function(error, field) {
form[field].$setValidity('mongoose', false);
$scope.errors[field] = error.message;
});
});
}
};
$scope.loginOauth = function(provider) {
$window.location.href = '/auth/' + provider;
};
});
|
'use strict';
describe('Services Tests ', function () {
beforeEach(module('jhipsterwebsocketApp'));
describe('Auth', function () {
var $httpBackend, spiedLocalStorageService, authService, spiedAuthServerProvider;
beforeEach(inject(function($injector, localStorageService, Auth, AuthServerProvider) {
$httpBackend = $injector.get('$httpBackend');
spiedLocalStorageService = localStorageService;
authService = Auth;
spiedAuthServerProvider = AuthServerProvider;
//Request on app init
$httpBackend.expectPOST(/api\/logout\?cacheBuster=\d+/).respond(200, '');
$httpBackend.expectGET('i18n/en/global.json').respond(200, '');
$httpBackend.expectGET('i18n/en/language.json').respond(200, '');
$httpBackend.expectGET('scripts/components/navbar/navbar.html').respond({});
$httpBackend.expectGET('i18n/en/global.json').respond(200, '');
$httpBackend.expectGET('i18n/en/language.json').respond(200, '');
$httpBackend.expectGET('i18n/en/main.json').respond(200, '');
$httpBackend.expectGET('scripts/app/main/main.html').respond({});
$httpBackend.expectGET(/api\/account\?cacheBuster=\d+/).respond({});
}));
//make sure no expectations were missed in your tests.
//(e.g. expectGET or expectPOST)
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('should call backend on logout then call authServerProvider.logout', function(){
//GIVEN
//Set spy
spyOn(spiedAuthServerProvider, 'logout').and.callThrough();
spyOn(spiedLocalStorageService, "clearAll").and.callThrough();
//WHEN
authService.logout();
//flush the backend to "execute" the request to do the expectedGET assertion.
$httpBackend.flush();
//THEN
expect(spiedAuthServerProvider.logout).toHaveBeenCalled();
expect(spiedLocalStorageService.clearAll).toHaveBeenCalled();
});
});
});
|
var gulp = require('gulp');
var jshint = require('gulp-jshint');
gulp.task('lint', function(){
return gulp.src('./lib/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('test', ['lint'], function(){
var bleep = require('./lib/bleep');
bleep();
});
|
/**
* Created by Dat Tran on 1/25/17.
*/
import React from 'react'
import {View, Text, StyleSheet, Modal, TouchableOpacity} from 'react-native'
import Spinner from 'react-native-spinkit'
import PropTypes from 'prop-types'
export default class IndicatorDialog extends React.Component {
static propTypes = {
message: PropTypes.string.isRequired,
}
constructor(props) {
super(props);
this.state = {
modalVisible: true
}
}
render() {
const {message, showGlobalIndicator} = this.props;
return (
<View>
<Modal animationType='fade'
transparent={true}
visible={true}
onRequestClose={() => {
console.log('android click back')
}}>
<View style={[styles.container, {backgroundColor: 'rgba(0, 0, 0, 0.2)'}]}>
<View style={[styles.innerContainer]}>
<Spinner isVisible={true}
size={60}
type='ThreeBounce'
color='#4286f4'/>
<Text>{message}</Text>
</View>
</View>
</Modal>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 20,
},
innerContainer: {
borderRadius: 10,
alignItems: 'center',
backgroundColor: '#fff',
paddingBottom: 20,
width: 280
},
row: {
alignItems: 'center',
flex: 1,
flexDirection: 'row',
marginBottom: 20,
},
rowTitle: {
flex: 1,
fontWeight: 'bold',
},
button: {
borderRadius: 5,
flex: 1,
height: 44,
alignSelf: 'stretch',
justifyContent: 'center',
overflow: 'hidden',
},
buttonText: {
fontSize: 18,
margin: 5,
textAlign: 'center',
color: 'white'
},
modalButton: {
borderRadius: 4,
marginTop: 10,
padding: 4,
backgroundColor: 'orange'
},
});
|
/* global module:false */
module.exports = function(grunt) {
var port = grunt.option('port') || 8000;
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner:
'/*!\n' +
' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
' * http://lab.hakim.se/reveal-js\n' +
' * MIT licensed\n' +
' *\n' +
' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
' */'
},
qunit: {
files: [ 'test/*.html' ]
},
uglify: {
options: {
banner: '<%= meta.banner %>\n'
},
build: {
src: 'js/reveal.js',
dest: 'js/reveal.min.js'
}
},
sass: {
core: {
files: {
'css/reveal.css': 'css/reveal.scss',
}
},
themes: {
files: {
'css/theme/black.css': 'css/theme/source/black.scss',
'css/theme/white.css': 'css/theme/source/white.scss',
'css/theme/league.css': 'css/theme/source/league.scss',
'css/theme/beige.css': 'css/theme/source/beige.scss',
'css/theme/night.css': 'css/theme/source/night.scss',
'css/theme/serif.css': 'css/theme/source/serif.scss',
'css/theme/simple.css': 'css/theme/source/simple.scss',
'css/theme/sky.css': 'css/theme/source/sky.scss',
'css/theme/moon.css': 'css/theme/source/moon.scss',
'css/theme/solarized.css': 'css/theme/source/solarized.scss',
'css/theme/blood.css': 'css/theme/source/blood.scss'
}
}
},
autoprefixer: {
dist: {
src: 'css/reveal.css'
}
},
cssmin: {
compress: {
files: {
'css/reveal.min.css': [ 'css/reveal.css' ]
}
}
},
jshint: {
options: {
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,
browser: true,
expr: true,
globals: {
head: false,
module: false,
console: false,
unescape: false,
define: false,
exports: false
}
},
files: [ 'Gruntfile.js', 'js/reveal.js' ]
},
connect: {
server: {
options: {
port: port,
base: '.',
livereload: true,
open: true
}
}
},
zip: {
'reveal-js-presentation.zip': [
'index.html',
'css/**',
'js/**',
'lib/**',
'images/**',
'plugin/**'
]
},
watch: {
options: {
livereload: true
},
js: {
files: [ 'Gruntfile.js', 'js/reveal.js' ],
tasks: 'js'
},
theme: {
files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
tasks: 'css-themes'
},
css: {
files: [ 'css/reveal.scss' ],
tasks: 'css-core'
},
html: {
files: [ 'index.html']
}
}
});
// Dependencies
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-sass' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-autoprefixer' );
grunt.loadNpmTasks( 'grunt-zip' );
// Default task
grunt.registerTask( 'default', [ 'css', 'js' ] );
// JS task
grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );
// Theme CSS
grunt.registerTask( 'css-themes', [ 'sass:themes' ] );
// Core framework CSS
grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );
// All CSS
grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );
// Package presentation to archive
grunt.registerTask( 'package', [ 'default', 'zip' ] );
// Serve presentation locally
grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
// Run tests
grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
};
|
import DS from 'ember-data';
var MedicationProductBatchComponent = DS.Model.extend({
lotNumber: DS.attr('string'),
expirationDate: DS.attr('date')
});
export default MedicationProductBatchComponent;
|
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require italian-rails
//= require_tree .
|
function getTotal (state , products, operator , deliveryPrice , props){
let newTotal = 0
products.forEach(product=>{
if(operator === '+'){
newTotal += product.price
}else{
newTotal -= product.price
}
});
// Find the current delivery selection by id
// unless current delivery is default 0
if(state.deliveryOption > 0){
deliveryPrice = deliveryPrice ? deliveryPrice : props.delivery[state.deliveryOption - 1].additional_price
}else{
deliveryPrice = deliveryPrice ? deliveryPrice : 0
}
let totalSum = deliveryPrice + +Math.abs(newTotal)
let totalObj = {
total : parseFloat(totalSum).toFixed(2),
productsTotal : parseFloat(Math.abs(newTotal)).toFixed(2),
deliveryTotal : parseFloat(deliveryPrice).toFixed(2)
}
// Probably a proper library shoulf be used to manage currencies...
return totalObj //parseFloat(Math.abs(newTotal)).toFixed(2)// this may be done with a currency library
}
function basket(state = {} , action){
switch(action.type){
// Add item to the Basket
case 'ADD_TO_BASKET':
// Remove any other instance
// TODO: this needs to be improved to properly support
// options like 'size' against quantity
const uniqueProducts = state['products'].filter(function( product ) {
return product.sku !== action.sku
})
const products = [...uniqueProducts, {
sku : action.sku,
size : action.size,
price : action.price
}]
let updatedTotal = getTotal(state, products , '+' , null, action.props)
return { ...state, products , total : updatedTotal }// this may be done with a currency library
// Remove from Basket
case 'REMOVE_FROM_BASKET':
const prod = state['products'].filter(function( product ) {
return product.sku !== action.sku
})
return { ...state, products : prod , total : getTotal(state, prod , '-' , null, action.props) }
// Select delivery option
case 'SET_DELIVERY':
if(action.id == false){
return state;
}else{
let i = action.deliveryOptions.findIndex((delivery) => delivery.id == action.id)
let deliverySelection = action.deliveryOptions[i] || []
let additional_price = deliverySelection.additional_price
let deliveryTotal = getTotal(state, state.products , '+' , additional_price) // the plus sign convert string to number
return { ...state, total : deliveryTotal , deliveryOption : action.id}
}
case 'RESET_BASKET':
const clonedBasket = state
clonedBasket.submitted = true
return { ...state, products : [] , total : 0 , deliveryOption : 0 , submitted : clonedBasket}
default :
return state;
}
return state;
}
export default basket;
|
/**
* ExceptionController
*
* @description :: Server-side logic for managing exceptions
* @help :: See http://links.sailsjs.org/docs/controllers
*/
module.exports = {
};
|
import Vue from '../../utils/vue'
import { mergeData } from 'vue-functional-data-merge'
import BMediaBody from './media-body'
import BMediaAside from './media-aside'
import { normalizeSlot } from '../../utils/normalize-slot'
export const props = {
tag: {
type: String,
default: 'div'
},
rightAlign: {
type: Boolean,
default: false
},
verticalAlign: {
type: String,
default: 'top'
},
noBody: {
type: Boolean,
default: false
}
}
// @vue/component
export default Vue.extend({
name: 'BMedia',
functional: true,
props,
render(h, { props, data, slots, scopedSlots, children }) {
let childNodes = props.noBody ? children : []
if (!props.noBody) {
const $slots = slots()
const $scopedSlots = scopedSlots || {}
const $aside = normalizeSlot('aside', {}, $scopedSlots, $slots)
const $default = normalizeSlot('default', {}, $scopedSlots, $slots)
if ($aside && !props.rightAlign) {
childNodes.push(
h(
BMediaAside,
{ staticClass: 'mr-3', props: { verticalAlign: props.verticalAlign } },
$aside
)
)
}
childNodes.push(h(BMediaBody, {}, $default))
if ($aside && props.rightAlign) {
childNodes.push(
h(
BMediaAside,
{ staticClass: 'ml-3', props: { verticalAlign: props.verticalAlign } },
$aside
)
)
}
}
return h(props.tag, mergeData(data, { staticClass: 'media' }), childNodes)
}
})
|
import Ractive from 'ractive';
component.exports = {
onrender () {
const preview = this.find('iframe').contentWindow;
const component = this.get( 'component' );
preview.component = {
template: component.template.result,
style: component.style.result,
data: component.data.result,
script: component.script.result
};
function setComponent ( value, property ) {
const c = preview.component || ( preview.component = {} );
c[ property ] = value;
if ( preview.load ) {
preview.load();
}
}
this.observe( 'component.template.result', template => {
setComponent( template, 'template' );
}, { init: false } );
this.observe( 'component.style.result', style => {
setComponent( style, 'style' );
}, { init: false } );
this.observe( 'component.data.result', data => {
setComponent( data, 'data' );
}, { init: false } );
this.observe( 'component.script.result', script => {
setComponent( script, 'script' );
}, { init: false } );
}
}
|
import { COMPONENT_TYPE } from 'constants/pogues-constants';
const { FILTER, NESTEDFILTRE } = COMPONENT_TYPE;
function getFiltersState(filter, parent, type) {
const {
Description: description,
Expression: expression,
IfTrue: members,
id,
name,
} = filter;
const initialMember = members.substring(0, members.lastIndexOf('-'));
const finalMember = members.substring(
members.indexOf('-') + 1,
members.length,
);
return {
id,
name: name || '',
initialMember,
finalMember,
description,
filter: expression,
type: type,
TargetMode: [],
pageBreak: false,
parent: parent,
filterImbriquer: [],
};
}
function remoteToStateNestedFilter(remote, parent, type, store) {
const { Next: filters } = remote;
const stateNestedFilter = getFiltersState(remote, parent, type);
if (filters) {
filters.forEach(filt => {
const nested = remoteToStateNestedFilter(
filt,
parent,
NESTEDFILTRE,
store,
);
stateNestedFilter.filterImbriquer.push(nested.stateNestedFilter.id);
});
}
const store1 = store;
if (stateNestedFilter.id && !store1[stateNestedFilter.id]) {
store1[stateNestedFilter.id] = stateNestedFilter;
}
return { stateNestedFilter, store1 };
}
export function remoteToState(remote, parent, store) {
const stateFilter = getFiltersState(remote, parent, FILTER);
const { Next: filters } = remote;
if (filters) {
filters.forEach(filt => {
const nested = remoteToStateNestedFilter(
filt,
parent,
NESTEDFILTRE,
store,
);
stateFilter.filterImbriquer.push(nested.stateNestedFilter.id);
});
}
if (stateFilter.id && !store[stateFilter.id]) {
store[stateFilter.id] = stateFilter;
}
return store;
}
function getNextFlowControle(filterImbriquers, store) {
const imbriquerControle = [];
filterImbriquers.forEach(filtere => {
const {
id,
name,
description,
filter,
initialMember,
finalMember,
filterImbriquer,
} = store[filtere];
const redirection = {
id,
name,
Description: description,
Expression: filter,
IfTrue: `${initialMember}-${finalMember}`,
};
if (filterImbriquer && filterImbriquer.length > 0) {
redirection.Next = getNextFlowControle(filterImbriquer, store);
}
imbriquerControle.push(redirection);
});
return imbriquerControle;
}
export function stateToRemote(store) {
return Object.values(store)
.filter(element => element.type === FILTER)
.map(component => {
const {
id,
filterImbriquer,
description,
filter,
initialMember,
finalMember,
} = component;
const redirection = {
id,
Description: description,
Expression: filter,
IfTrue: `${initialMember}-${finalMember}`,
};
if (filterImbriquer && filterImbriquer.length > 0) {
redirection.Next = getNextFlowControle(filterImbriquer, store);
}
return redirection;
});
}
|
/* */
"format cjs";
define( function() {
"use strict";
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
// Support: IE <=9 only
option: [ 1, "<select multiple='multiple'>", "</select>" ],
// XHTML parsers do not magically insert elements in the
// same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [ 1, "<table>", "</table>" ],
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
_default: [ 0, "", "" ]
};
// Support: IE <=9 only
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
return wrapMap;
} );
|
//
// Basic usage
//
// refence our library relative, but should be different once
// installed via npm require('game-loop-dispatch');
var GameLoopDispatch = require('../index.js');
var gameLoop = new GameLoopDispatch({
// only require value is the interval in milliseconds
'interval':1000
});
gameLoop.tick = function(){
console.log('tick');
};
gameLoop.start();
|
/**
* Created by liushuo on 17/7/6.
*/
import Tab1 from './tabs/oneTab'
import Tab2 from './tabs/twoTab'
import {TabNavigator} from 'react-navigation'
import React from 'react'
import {StyleSheet,Image} from 'react-native';
const TabNavigatorDemo = TabNavigator({
tab1:{screen:Tab1,
navigationOptions : {
title:"首页",
tabBarLabel:"首页",
tabBarIcon:({tintColor,focused})=>{
// 设置自定义的tabBar viewStyle
if (focused) {
}
return (
<Image source={require("../source/images/icon_home.png")}
style={[{tintColor: tintColor},styles.iconStyle]}/>
)
}
}},
tab2: {
screen: Tab2,
navigationOptions: {
title: "我的",
tabBarLabel: "我的",
tabBarIcon: (tintColor) => {
return (
<Image source={require("../source/images/icon_crm.png")}
style={[styles.iconStyle,]}/>
)
}
}
}
},{
tabBarOptions: {
animationEnabled: false, // 切换页面时不显示动画
tabBarPosition: 'bottom', // 显示在底端,android 默认是显示在页面顶端的
swipeEnabled: false, // 禁止左右滑动
backBehavior: 'none', // 按 back 键是否跳转到第一个 Tab, none 为不跳转
activeBackgroundColor:'red',
inactiveBackgroundColor:'white',
activeTintColor:'white',
inactiveTintColor:'#666',
showLabel:true,
labelStyle:{
fontSize:13
}
}
})
const styles = StyleSheet.create({
iconStyle:{
width:30,
height:30
}
})
export default TabNavigatorDemo;
|
module.exports = {
plugins: [
'transform-decorators-legacy',
'transform-class-properties',
],
presets: [
'react-hmre',
'stage-0',
'es2015',
'react',
],
cacheDirectory: true,
};
|
(function() {
self.JSREPLEngine = (function() {
function JSREPLEngine(input, output, result, error, sandbox, ready) {
var Kaffeine;
this.result = result;
this.error = error;
this.sandbox = sandbox;
this.inspect = this.sandbox.console.inspect;
this.functionClass = this.sandbox.Function;
this.sandbox.__eval = this.sandbox.eval;
this.tokenizer = this.sandbox.require('kaffeine/token');
Kaffeine = this.sandbox.require('kaffeine');
this.kaffeine = new Kaffeine;
ready();
}
JSREPLEngine.prototype.Compile = function(command) {
var js;
js = this.kaffeine.compile(command);
try {
new this.functionClass(js);
} catch (e) {
js = "(" + js + ")";
}
return js;
};
JSREPLEngine.prototype.Eval = function(command) {
var js, result;
try {
js = this.Compile(command);
} catch (e) {
e.message = 'Compiling: ' + e.message;
this.error(e);
return;
}
try {
result = this.sandbox.__eval(js);
return this.result(result === void 0 ? '' : this.inspect(result));
} catch (e) {
return this.error(e);
}
};
JSREPLEngine.prototype.EvalSync = function(command) {
return this.sandbox.__eval(this.Compile(command));
};
JSREPLEngine.prototype.GetNextLineIndent = function(command) {
var js, last_line, token;
try {
token = this.tokenizer.ize(command);
while (token != null) {
if (token.bang) return 0;
token = token.next;
}
} catch (e) {
return 1;
}
try {
js = this.kaffeine.compile(command);
try {
new this.functionClass(js);
} catch (e) {
js = "(" + js + ")";
new this.functionClass(js);
}
last_line = command.split('\n').slice(-1)[0];
if (/^\s+/.test(last_line)) {
return 0;
} else {
return false;
}
} catch (e) {
if (/^\s*(for|while|if|else)\b|[\[\{\(]$/.test(command)) {
return 1;
} else {
return 0;
}
}
};
return JSREPLEngine;
})();
}).call(this);
|
const pgp = require('pg-promise')()
const cn = process.env.DATABASE_URL || 'postgres://localhost:5432/roam'
const db = pgp(cn)
module.exports = db
|
import BBPromise from 'bluebird';
import { Serializer } from 'dstore-helpers';
var knex = require('knex')({dialect: 'postgres'});
var st = require('knex-postgis')(knex);
/**
* PostgresqlSerializer
*
* @class PostgresqlSerializer
* @extends {Serializer}
*/
class PostgresqlSerializer extends Serializer {
/**
* Serialize item for postgresql.
*
* @param {Object} blueprint
* @param {Object} item
*
* @return {Object} The serialized item
*/
serialize(blueprint, item) {
return this.serializeItem(blueprint, item);
}
/**
* Serialize a point.
*
* @protected
* @param {string} value
*/
serializePoint(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize a point array.
*
* @protected
* @param {string} value
*/
serializePointArray(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize a linestring.
*
* @protected
* @param {string} value
*/
serializeLinestring(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize a linestring array.
*
* @protected
* @param {string} value
*/
serializeLinestringArray(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize a polygon.
*
* @protected
* @param {string} value
*/
serializePolygon(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize a polygon array.
*
* @protected
* @param {string} value
*/
serializePolygonArray(value) {
return this.serializeGeoJSON(value);
}
/**
* Serialize to geojson.
*
* @protected
* @param {string} value
*/
serializeGeoJSON(value) {
if ( ! value.crs) {
value.crs = {
type: 'name',
properties: {name: 'EPSG:4326'}
};
}
return st.geomFromGeoJSON(value);
}
}
export default PostgresqlSerializer;
|
angular.module('pirates')
.controller('IndexController', ['$scope', '$http', function($scope, $http) {
}]);
|
import Services from './services';
const { ipcMain } = require('electron');
ipcMain.on('departures', async (e, crs) => {
let reply;
const code = crs.toUpperCase();
Services.getDepartures(code)
.then((result) => {
reply = result;
})
.catch((err) => {
const error = err.response?.statusText || err?.message || err;
reply = { error };
})
.finally(() => {
e.reply('departures', reply);
});
});
ipcMain.on('arrivals', async (e, crs) => {
let reply;
const code = crs.toUpperCase();
Services.getArrivals(code)
.then((result) => {
reply = result;
})
.catch((err) => {
const error = err.response?.statusText || err?.message || err;
reply = { error };
})
.finally(() => {
e.reply('arrivals', reply);
});
});
|
'use strict';
// `jwt.js` - how to used in combination with JSON Web Tokens (JWT) `securityDefinition`
var Hapi = require('hapi');
var jwt = require('jsonwebtoken');
const Blipp = require('blipp');
const Inert = require('inert');
const Vision = require('vision');
const HapiSwagger = require('../');
let swaggerOptions = {
info: {
title: 'Test API Documentation',
description: 'This is a sample example of API documentation.'
},
securityDefinitions: {
jwt: {
type: 'apiKey',
name: 'Authorization',
in: 'header'
}
}
};
var people = {
// our "users database"
56732: {
id: 56732,
name: 'Jen Jones',
scope: ['a', 'b']
}
};
var privateKey = 'hapi hapi joi joi';
var token = jwt.sign({ id: 56732 }, privateKey, { algorithm: 'HS256' });
// bring your own validation function
var validate = function(decoded, request, callback) {
// do your checks to see if the person is valid
if (!people[decoded.id]) {
return callback(null, false);
}
return callback(null, true, people[decoded.id]);
};
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 3000
});
server.register(
[
require('hapi-auth-jwt2'),
Inert,
Vision,
Blipp,
{
register: HapiSwagger,
options: swaggerOptions
}
],
function(err) {
if (err) {
console.log(err);
}
server.auth.strategy('jwt', 'jwt', {
key: privateKey, // Never Share your secret key
validateFunc: validate, // validate function defined above
verifyOptions: { algorithms: ['HS256'] } // pick a strong algorithm
});
server.auth.default('jwt');
server.route([
{
method: 'GET',
path: '/',
config: {
auth: false,
handler: function(request, reply) {
reply({ text: 'Token not required' });
}
}
},
{
method: 'GET',
path: '/restricted',
config: {
auth: 'jwt',
tags: ['api'],
handler: function(request, reply) {
reply({
text: 'You used a Token! ' + request.auth.credentials.name
}).header('Authorization',request.headers.authorization);
}
}
},
{
method: 'GET',
path: '/token',
config: {
auth: false,
tags: ['api'],
handler: function(request, reply) {
reply({ token: token });
}
}
}
]);
}
);
server.start(function() {
console.log('Server running at:', server.info.uri);
});
|
function SOEditor(textareaId) {
var style = css($(textareaId))
$(textareaId).replaceWith('<div class="wmd-panel">' +
'<div id="wmd-button-bar" class="wmd-button-bar">' +
'</div><textarea class="wmd-input" id="wmd-input">' +
'</textarea></div><div id="wmd-preview" ' +
'class="wmd-panel wmd-preview markdown-body"></div>');
$(".wmd-panel").css(style)
var converter = Markdown.getSanitizingConverter();
var helpUrl = 'https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet'
var help = function() {
window.open(helpUrl, '_blank');
}
var options = {
helpButton: {handler: help},
strings: {quoteexample: "Blockquote"}
};
var editor = new Markdown.Editor(converter, "", options);
editor.run();
}
|
'use strict';
import Velocity from 'velocity-animate';
export default class SearchHeaderController {
/*@ngInject*/
constructor() {
this.isCollapsed = false;
}
handleClick() {
let elements = $('.collapsable');
let left = 20;
if (!this.isCollapsed) {
left = elements.width() * -1;
}
this.isCollapsed = !this.isCollapsed;
Velocity(elements, {
left: left
}, {
duration: 300
});
}
}
|
define(['underscore'], function (_) {
function not(f) {
return function (v) {
return !f(v)
}
}
function get(p) {
return function (v) {
return v[p];
}
}
function always(v) {
return function (_) {
return v;
}
}
function eq(a) {
return function (b) {
return a === b || _.isEqual(a, b)
}
}
function say(constant) {
return function(v) {
console.log(constant || v)
}
}
function concat(a, b) {
return a.concat(b);
}
function empty(xs) {
return xs.length === 0
}
function sum(xs) {
return _.reduce(xs, function (acc, x) {
return acc + x
}, 0)
}
return {
get: get,
sum: sum,
not: not,
concat: concat,
always: always,
empty: empty,
say: say,
eq: eq
}
});
|
import React, { PropTypes } from 'react';
import {
ActionSheetIOS,
Platform,
Text,
TouchableOpacity,
View,
} from 'react-native';
import { FormSettings, ASStyles } from './DefaultStyles';
export default class ActionSheetCell extends React.Component {
constructor(props) {
super(props);
this.state = {
value: this.getValueTextFromIndex(props.selectedValueIndex) || '',
};
if (this.state.value.length) {
props.onChange && props.onChange(this.state.value);
}
}
getWrappedChildren(titleText, valueText) {
const children = [];
if (this.props.icon) {
children.push(
React.cloneElement(this.props.icon, {
key: `${this.props.icon.type}titleTextIcon`,
style: ASStyles.icon,
})
);
}
children.push(titleText);
children.push(valueText);
return (
<View style={ASStyles.container}>
{children}
</View>
);
}
getValueTextFromIndex(index) {
if (typeof(index) !== 'undefined') {
return this.props.options[index];
}
return undefined;
}
handleChange(index) {
const value = this.getValueTextFromIndex(index);
this.setState({
value,
});
this.props.onChange && this.props.onChange(value);
try {
this.props.validator && this.props.validator(value);
this.props.onValidationPass && this.props.onValidationPass();
} catch (e) {
this.props.onValidationError && this.props.onValidationError(e);
}
}
handlePress() {
const cancelButtonIndex = this.props.options.length;
ActionSheetIOS.showActionSheetWithOptions({
options: [...this.props.options, 'Cancel'],
cancelButtonIndex,
}, (index) => {
if (index !== cancelButtonIndex) {
this.handleChange.bind(this)(index);
}
});
}
render() {
if (Platform.OS === 'android') {
return null;
}
const titleStyle = this.props.titleStyle || ASStyles.defaultTitleStyle;
const titleText = (
<Text
key={'titleText'}
style={titleStyle}
>
{this.props.title}
</Text>
);
const valueStyle = this.props.valueStyle || ASStyles.defaultValueStyle;
const valueText = (
<Text
key={'valueText'}
style={valueStyle}
>
{this.state.value}
</Text>
);
const wrapped = this.getWrappedChildren.bind(this)(titleText, valueText);
const containerStyle = this.props.containerStyle || ASStyles.container;
const cellHeight = this.props.cellHeight || FormSettings.defaultCellHeight;
return (
<TouchableOpacity
style={[
containerStyle,
{ height: cellHeight },
]}
onPress={this.handlePress.bind(this)}
>
{wrapped}
</TouchableOpacity>
);
}
}
ActionSheetCell.propTypes = {
cellHeight: PropTypes.number,
containerStyle: PropTypes.object,
icon: PropTypes.element,
onChange: PropTypes.func,
onValidationError: PropTypes.func,
onValidationPass: PropTypes.func,
options: PropTypes.array.isRequired,
selectedValueIndex: PropTypes.number,
title: PropTypes.string,
titleStyle: PropTypes.object,
validator: PropTypes.func,
valueStyle: PropTypes.object,
};
|
version https://git-lfs.github.com/spec/v1
oid sha256:43fb1c0a6c7301fe8298f6abd2e19e63262202d40243f9d741acf4f0a7e4b93b
size 1239
|
version https://git-lfs.github.com/spec/v1
oid sha256:4157fb4de92e35053068fbaead09f3a1940d881f12de5c197b310789b0ecaad7
size 3324
|
'use strict'
import defaults from 'lodash/defaults'
export class Positioner {
constructor (browserWindow, screen, setBounds) {
this.browserWindow = browserWindow
this.electronScreen = screen
if (setBounds) {
browserWindow.setBounds(setBounds)
}
}
_getCoords (position = 'center', trayPosition) {
let screenSize = this._getScreenSize()
let windowSize = this._getWindowSize()
if (trayPosition === undefined) trayPosition = {}
// Positions
let positions = {
trayLeft: {
x: Math.floor(trayPosition.x),
y: screenSize.y
},
trayBottomLeft: {
x: Math.floor(trayPosition.x),
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
trayRight: {
x: Math.floor(trayPosition.x - (windowSize[0]) + trayPosition.width),
y: screenSize.y
},
trayBottomRight: {
x: Math.floor(trayPosition.x - (windowSize[0]) + trayPosition.width),
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
trayCenter: {
x: Math.floor(trayPosition.x - ((windowSize[0] / 2)) + (trayPosition.width / 2)),
y: screenSize.y
},
trayBottomCenter: {
x: Math.floor(trayPosition.x - ((windowSize[0] / 2)) + (trayPosition.width / 2)),
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
topLeft: {
x: screenSize.x,
y: screenSize.y
},
topRight: {
x: Math.floor(screenSize.x + (screenSize.width - windowSize[0])),
y: screenSize.y
},
bottomLeft: {
x: screenSize.x,
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
bottomRight: {
x: Math.floor(screenSize.x + (screenSize.width - windowSize[0])),
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
topCenter: {
x: Math.floor(screenSize.x + ((screenSize.width / 2) - (windowSize[0] / 2))),
y: screenSize.y
},
bottomCenter: {
x: Math.floor(screenSize.x + ((screenSize.width / 2) - (windowSize[0] / 2))),
y: Math.floor(screenSize.height - (windowSize[1] - screenSize.y))
},
center: {
x: Math.floor(screenSize.x + ((screenSize.width / 2) - (windowSize[0] / 2))),
y: Math.floor(((screenSize.height + screenSize.y) / 2) - (windowSize[1] / 2))
}
}
// Default to right if the window is bigger than the space left.
// Because on Windows the window might get out of bounds and dissappear.
if (position.substr(0, 4) === 'tray') {
if ((positions[position].x + windowSize[0]) > (screenSize.width + screenSize.x)) {
return {
x: positions['topRight'].x,
y: positions[position].y
}
}
}
return positions[position]
}
_getWindowSize () {
return this.browserWindow.getSize()
}
_getScreenSize () {
return this.electronScreen.getDisplayNearestPoint(this.electronScreen.getCursorScreenPoint()).workArea
}
move (position, trayPos) {
// Get positions coords
var coords = this._getCoords(position, trayPos)
// Set the windows position
this.browserWindow.setPosition(coords.x, coords.y)
}
calculate (position, trayPos) {
// Get positions coords
var coords = this._getCoords(position, trayPos)
return {
x: coords.x,
y: coords.y
}
}
}
export default Positioner
|
/**
* Created by A.Hofmann on 15.03.2015.
*/
mix.declare("mix.Objects", ["mix.Utils", "mix.Detector", "mix.Constants"], function(Utils, Detector, Constants)
{
"use strict";
//-----------------------------------------------------------------------------------------------------------------------
var Objects = {
};
//-----------------------------------------------------------------------------------------------------------------------
return Objects;
});
|
(function(window, angular, undefined){
TicketItemController.$inject = [];
function TicketItemController() {
var ticketItem = this;
}
angular.module('bug-tracker')
.controller('ticketItemController', TicketItemController);
})(window, angular);
|
class StandardError extends Error {
constructor(msg, code = 500, isServerError = false) {
super(msg);
this.name = this.constructor.name;
this.message = msg;
this.code = code;
this.isServerError = isServerError;
// Error.captureStackTrace is not defined in phantomJS
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor.name);
}
}
}
export class CustomError extends StandardError {
constructor(message, code, isServerError) {
super(message, code, isServerError);
}
}
|
let commentController = (function () {
function addComment(ctx) {
let isLoggedIn = userController.isLoggedIn();
ctx.isLoggedIn = isLoggedIn;
if (!isLoggedIn) {
ctx.redirect('#/home');
}
let postId = ctx.params.id;
let content = ctx.params.content;
let author = userController.getUsername();
let data = {
postId,
content,
author,
}
requestService.post('appdata', 'comments', 'Kinvey', data)
.then(function(res) {
ctx.redirect('#/details/' + postId);
infoService.showInfo('Comment added successfully!');
}).catch(function(err) {
infoService.handleAjaxError(err);
});
}
function deleteComment(ctx) {
let isLoggedIn = userController.isLoggedIn();
ctx.isLoggedIn = isLoggedIn;
if (!isLoggedIn) {
ctx.redirect('#/home');
}
let id = ctx.params.id;
requestService.remove('appdata', 'comments/' + id, 'Kinvey')
.then(function(res) {
ctx.redirect('#/posts');
infoService.showInfo('Comment deleted successfully!');
}).catch(function(err) {
infoService.handleAjaxError(err);
});
}
return {
addComment,
deleteComment
}
})()
|
import React from 'react';
import styled from 'styled-components';
import { colors } from '../utils/theme';
const StyledWrapper = styled.div`
position: fixed;
bottom: 16px;
right: 16px;
max-width: 420px;
padding: 16px;
background-color: ${colors.gray700};
border-radius: 8px;
border: 1px solid ${colors.text};
box-shadow: 29px 24px 47px -35px rgba(0, 0, 0, 0.75);
p {
margin-bottom: 16px;
color: ${colors.text};
font-size: 16px;
text-align: left;
}
button {
border: 0;
padding: 0;
margin: 0;
background-color: transparent;
cursor: pointer;
color: ${colors.green};
font-size: 16px;
}
`;
export default () => {
const [swUpdated, setSwUpdated] = React.useState(false);
React.useEffect(() => {
if (window.localStorage) {
setSwUpdated(JSON.parse(window.localStorage.getItem('sw-updated') || 'false'));
}
}, []);
return swUpdated ? (
<div className="fixed bottom-4 md:right-4 p-4 md:max-w-sm mx-4 md:mx-0 bg-gray-200 dark:bg-gray-800 border border-foreground shadow-md rounded-md text-base">
<p className="">This website has been updated. Please refresh to get the new version! ✨</p>
<button
className="text-green-600 dark:text-green"
onClick={() => {
window.location.reload();
if (window.localStorage) {
window.localStorage.setItem('sw-updated', 'false');
setSwUpdated(false);
}
}}
>
Refresh
</button>
</div>
) : null;
};
|
export default class CustomError extends Error {
constructor(message) {
super(message);
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
get name() {
return this.constructor.name;
}
}
export class UDPError extends CustomError {
constructor(message) {
super(message);
}
}
export class UPnPError extends CustomError {
constructor(message) {
super(message);
}
}
export class ServiceError extends CustomError {
constructor(message) {
super(message);
}
}
export class PlayerError extends CustomError {
constructor(message) {
super(message);
}
}
export class SonosError extends CustomError {
constructor(message) {
super(message);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.