_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q49900 | ComponentContext | train | function ComponentContext(zuixInstance, options, eventCallback) {
zuix = zuixInstance;
this._options = null;
this.contextId = (options == null || options.contextId == null) ? null : options.contextId;
this.componentId = null;
this.trigger = function(context, eventPath, eventValue) {
if (type... | javascript | {
"resource": ""
} |
q49901 | trigger | train | function trigger(context, path, data) {
if (util.isFunction(_hooksCallbacks[path])) {
_hooksCallbacks[path].call(context, data, context);
}
} | javascript | {
"resource": ""
} |
q49902 | Logger | train | function Logger(ctx) {
_console = window ? window.console : {};
_global = window ? window : {};
this._timers = {};
this.args = function(context, level, args) {
let logHeader = '%c '+level+' %c'+(new Date().toISOString())+' %c'+context;
const colors = [_bc+_c1, _bc+_c2, _bc+_c3];
... | javascript | {
"resource": ""
} |
q49903 | lazyLoad | train | function lazyLoad(enable, threshold) {
if (enable != null) {
_disableLazyLoading = !enable;
}
if (threshold != null) {
_lazyLoadingThreshold = threshold;
}
return !_isCrawlerBotClient && !_disableLazyLoading;
} | javascript | {
"resource": ""
} |
q49904 | applyReplacementRules | train | function applyReplacementRules(rulesset, content) {
return rulesset.reduce((a,b) => {
return a.replace(b[0], b[1]);
}, content);
} | javascript | {
"resource": ""
} |
q49905 | normalize | train | function normalize(content) {
if (!content) {
if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.normalize.');
return '';
}
const result = content
.replace(/\u200B/g, '')
.replace(brakePointRegex, (m, g1, g2) => {
let chunk = g1 || '';
// Re-ordering
... | javascript | {
"resource": ""
} |
q49906 | spellingFix | train | function spellingFix(content, fontType){
if (!content) {
if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.spellingFix.');
return '';
}
if (content === '' || !mmCharacterRange.test(content))
return content;
if (!fontType)
fontType = fontDetect(content);
content = ... | javascript | {
"resource": ""
} |
q49907 | fontDetect | train | function fontDetect(content, fallback_font_type, options = {}){
if (!content) {
if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontDetect.');
return fallback_font_type || 'en';
}
if (content === '')
return content;
if (!mmCharacterRange.test(content))
return fall... | javascript | {
"resource": ""
} |
q49908 | syllBreak | train | function syllBreak(content, fontType, breakpoint){
if (!content) {
if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.syllBreak.');
return '';
}
if (content === '' || !mmCharacterRange.test(content))
return content;
content = content.trim().replace(/\u200B/g, '');
... | javascript | {
"resource": ""
} |
q49909 | fontConvert | train | function fontConvert(content, to, from) {
if (!content) {
if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontConvert.');
return '';
}
if (content === '' || !mmCharacterRange.test(content))
return content;
if (!to) {
if (!globalOptions.isSilentMode()) consol... | javascript | {
"resource": ""
} |
q49910 | compileFile | train | function compileFile(file, src) {
var compiled;
compiled = compile(file, src, exports.traceurOverrides);
if (compiled.error) throw new Error(compiled.error);
return compiled.source;
} | javascript | {
"resource": ""
} |
q49911 | Tree | train | function Tree(left, label, right) {
this.left = left;
this.label = label;
this.right = right;
} | javascript | {
"resource": ""
} |
q49912 | make | train | function make(array) {
// Leaf node:
if (array.length == 1) return new Tree(null, array[0], null);
return new Tree(make(array[0]), array[1], make(array[2]));
} | javascript | {
"resource": ""
} |
q49913 | checkAvailable | train | function checkAvailable(host, port) {
return new Promise(function(resolve, reject) {
const socket = new net.Socket();
socket.on('connect', () => {
cleanupSocket(socket);
resolve(true);
});
socket.on('error', err => {
cleanupSocket(socket);
if (err.code !== 'ECONNREFUSED') {
... | javascript | {
"resource": ""
} |
q49914 | waitForAvailable | train | function waitForAvailable(host, port, options) {
return co(function*() {
options = Object.assign(
{},
{
initialMS: 300,
retryMS: 100,
retryCount: 25
},
options
);
// Delay initial amount before attempting to connect
yield delay(options.initialMS);
... | javascript | {
"resource": ""
} |
q49915 | train | function(className, options) {
if (!(this instanceof Logger)) return new Logger(className, options);
options = options || {};
// Current reference
this.className = className;
// Current logger
if (currentLogger == null && options.logger) {
currentLogger = options.logger;
} else if (currentLogger == ... | javascript | {
"resource": ""
} | |
q49916 | loadScript | train | function loadScript(options, cb) {
if (!options) {
throw new Error('Can\'t load nothing...');
}
// Allow for the simplest case, just passing a `src` string.
if (type(options) === 'string') {
options = { src : options };
}
var https = document.location.protocol === 'https:' || document.location.pro... | javascript | {
"resource": ""
} |
q49917 | transformer | train | function transformer(tree, file, next) {
if (loadError) {
next(loadError)
} else if (config.checker) {
all(tree, file, config)
next()
} else {
queue.push([tree, file, config, next])
}
} | javascript | {
"resource": ""
} |
q49918 | all | train | function all(tree, file, config) {
var ignore = config.ignore
var ignoreLiteral = config.ignoreLiteral
var ignoreDigits = config.ignoreDigits
var apos = config.normalizeApostrophes
var checker = config.checker
var cache = config.cache
visit(tree, 'WordNode', checkWord)
// Check one word.
function ch... | javascript | {
"resource": ""
} |
q49919 | clone | train | function clone(a) {
var out = new Float32Array(3)
out[0] = a[0]
out[1] = a[1]
out[2] = a[2]
return out
} | javascript | {
"resource": ""
} |
q49920 | rotateX | train | function rotateX(out, a, b, c){
var by = b[1]
var bz = b[2]
// Translate point to the origin
var py = a[1] - by
var pz = a[2] - bz
var sc = Math.sin(c)
var cc = Math.cos(c)
// perform rotation and translate to correct position
out[0] = a[0]
out[1] = by + py * cc - pz * sc
... | javascript | {
"resource": ""
} |
q49921 | rotateZ | train | function rotateZ(out, a, b, c){
var bx = b[0]
var by = b[1]
//Translate point to the origin
var px = a[0] - bx
var py = a[1] - by
var sc = Math.sin(c)
var cc = Math.cos(c)
// perform rotation and translate to correct position
out[0] = bx + px * cc - py * sc
out[1] = by + px ... | javascript | {
"resource": ""
} |
q49922 | negate | train | function negate(out, a) {
out[0] = -a[0]
out[1] = -a[1]
out[2] = -a[2]
return out
} | javascript | {
"resource": ""
} |
q49923 | rotateY | train | function rotateY(out, a, b, c){
var bx = b[0]
var bz = b[2]
// translate point to the origin
var px = a[0] - bx
var pz = a[2] - bz
var sc = Math.sin(c)
var cc = Math.cos(c)
// perform rotation and translate to correct position
out[0] = bx + pz * sc + px * cc
out[1] = a[1... | javascript | {
"resource": ""
} |
q49924 | inverse | train | function inverse(out, a) {
out[0] = 1.0 / a[0]
out[1] = 1.0 / a[1]
out[2] = 1.0 / a[2]
return out
} | javascript | {
"resource": ""
} |
q49925 | angle | train | function angle(a, b) {
var tempA = fromValues(a[0], a[1], a[2])
var tempB = fromValues(b[0], b[1], b[2])
normalize(tempA, tempA)
normalize(tempB, tempB)
var cosine = dot(tempA, tempB)
if(cosine > 1.0){
return 0
} else {
return Math.acos(cosine)
}
} | javascript | {
"resource": ""
} |
q49926 | se | train | function se(me){/* jshint maxstatements: 18 */if(!(this instanceof se))return new se(me);var ge={};if(fe.isBuffer(me))ge=se._fromBufferReader(le(me));else if(de.isObject(me)){var _e;_e=me.header instanceof ce?me.header:ce.fromObject(me.header),ge={/**
* @name MerkleBlock#header
* @type {BlockHeader}
... | javascript | {
"resource": ""
} |
q49927 | he | train | function he(vr,xr,Sr){for(var kr=-1,Ir=vr.criteria,Ar=xr.criteria,wr=Ir.length,Er=Sr.length,Pr;++kr<wr;)if(Pr=se(Ir[kr],Ar[kr]),Pr){if(kr>=Er)return Pr;var Br=Sr[kr];return Pr*("asc"===Br||!0===Br?1:-1)}// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circums... | javascript | {
"resource": ""
} |
q49928 | uo | train | function uo(Kd,qd,Vd,Gd,Yd,Wd,Xd,Jd,Zd,Qd){function $d(){for(// Avoid `arguments` object use disqualifying optimizations by
// converting it to an array before providing it to other functions.
var dc=arguments.length,fc=dc,lc=Zn(dc);fc--;)lc[fc]=arguments[fc];if(Gd&&(lc=Da(lc,Gd,Yd)),Wd&&(lc=Ma(lc,Wd,Xd)),oc||ic){var p... | javascript | {
"resource": ""
} |
q49929 | ho | train | function ho(Kd,qd,Vd,Gd){function Yd(){for(// Avoid `arguments` object use disqualifying optimizations by
// converting it to an array before providing it `func`.
var Xd=-1,Jd=arguments.length,Zd=-1,Qd=Gd.length,$d=Zn(Qd+Jd);++Zd<Qd;)$d[Zd]=Gd[Zd];for(;Jd--;)$d[Zd++]=arguments[++Xd];var tc=this&&this!==gr&&this instanc... | javascript | {
"resource": ""
} |
q49930 | be | train | function be(Ce,Ne,je){je.negative=Ne.negative^Ce.negative;var Le=0|Ce.length+Ne.length;je.length=Le,Le=0|Le-1;// Peel one iteration (compiler can't do it, because of code complexity)
var ze=0|Ce.words[0],De=0|Ne.words[0],Me=ze*De,Ue=67108863&Me,Fe=0|Me/67108864;je.words[0]=Ue;for(var He=1;He<Le;He++){for(var Ke=Fe>>>26... | javascript | {
"resource": ""
} |
q49931 | train | function(Se){// Spawn
var ke=ce(this);// Augment
return Se&&ke.mixIn(Se),ke.hasOwnProperty("init")&&this.init!==ke.init||(ke.init=function(){ke.$super.init.apply(this,arguments)}),ke.init.prototype=ke,ke.$super=this,ke} | javascript | {
"resource": ""
} | |
q49932 | train | function(Se){// Convert
for(var ke=Se.length,Ie=[],Ae=0;Ae<ke;Ae++)Ie[Ae>>>2]|=(255&Se.charCodeAt(Ae))<<24-8*(Ae%4);// Shortcut
return new ue.init(Ie,ke)} | javascript | {
"resource": ""
} | |
q49933 | train | function(pe){// Shortcuts
var ue=pe.words,be=pe.sigBytes,he=this._map;pe.clamp();for(var me=[],ge=0;ge<be;ge+=3)for(var _e=255&ue[ge>>>2]>>>24-8*(ge%4),ve=255&ue[ge+1>>>2]>>>24-8*((ge+1)%4),Se=255&ue[ge+2>>>2]>>>24-8*((ge+2)%4),ke=0;4>ke&&ge+0.75*ke<be;ke++)me.push(he.charAt(63&(_e<<16|ve<<8|Se)>>>6*(3-ke)));// Add pad... | javascript | {
"resource": ""
} | |
q49934 | train | function(pe){// Shortcuts
var ue=pe.length,be=this._map,he=this._reverseMap;if(!he){he=this._reverseMap=[];for(var me=0;me<be.length;me++)he[be.charCodeAt(me)]=me}// Ignore padding
var ge=be.charAt(64);if(ge){var _e=pe.indexOf(ge);-1!==_e&&(ue=_e)}// Convert
return se(pe,ue,he)} | javascript | {
"resource": ""
} | |
q49935 | train | function(pe){// Convert
for(var ue=pe.length,be=[],he=0;he<ue;he++)be[he>>>1]|=pe.charCodeAt(he)<<16-16*(he%2);// Shortcut
return fe.create(be,2*ue)} | javascript | {
"resource": ""
} | |
q49936 | train | function(ue){// Shortcut
var be=this._hasher,he=be.finalize(ue);// Compute HMAC
be.reset();var me=be.finalize(this._oKey.clone().concat(he));return me} | javascript | {
"resource": ""
} | |
q49937 | me | train | function me(Me){// Don't use UCS-2
var Ue=[],Fe=Me.length,Ke=0,qe=Be,Ve=Pe,He,Ge,Ye,We,Xe,Je,Ze,Qe,$e,/** Cached calculation results */et;// Handle the basic code points: let `basic` be the number of input code
// points before the last delimiter, or `0` if there is none, then copy
// the first basic code points to the... | javascript | {
"resource": ""
} |
q49938 | de | train | function de(Me,Ue){// default options
var Fe={seen:[],stylize:fe};// legacy...
return 3<=arguments.length&&(Fe.depth=arguments[2]),4<=arguments.length&&(Fe.colors=arguments[3]),ve(Ue)?Fe.showHidden=Ue:Ue&&te._extend(Fe,Ue),Ae(Fe.showHidden)&&(Fe.showHidden=!1),Ae(Fe.depth)&&(Fe.depth=2),Ae(Fe.colors)&&(Fe.colors=!1),Ae... | javascript | {
"resource": ""
} |
q49939 | train | function(proxy_address, signer, controller_address) {
this.proxy_address = proxy_address;
this.controller_address = controller_address || proxy_address;
this.signer = signer;
} | javascript | {
"resource": ""
} | |
q49940 | uint16BEtoNumber | train | function uint16BEtoNumber(bytes) {
var n = 0;
for (var i = 0; i < 1; i++) {
n |= bytes[i];
n <<= 8;
}
n |= bytes[1];
return n;
} | javascript | {
"resource": ""
} |
q49941 | readNumber | train | function readNumber(bf, numfmt) {
var value = new Uint8Array(bf);
if (numfmt === NUMFMT_UINT32) {
// uint32
return uint32BEtoNumber(value);
} else if (numfmt === NUMFMT_UINT64) {
// uint64
return uint64BEtoNumber(value);
} else if (numfmt === NUMFMT_UINT16) {
// uint16
return uint16BEtoN... | javascript | {
"resource": ""
} |
q49942 | appendBuffer | train | function appendBuffer(buffer1, buffer2) {
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
tmp.set(new Uint8Array(buffer1), 0);
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
return tmp.buffer;
} | javascript | {
"resource": ""
} |
q49943 | concat | train | function concat(a, b) {
if (!a && !b) throw new Error("Please specify valid arguments for parameters a and b.");
if (!b || b.length === 0) return a;
if (!a || a.length === 0) return b;
const c = new a.constructor(a.length + b.length);
c.set(a);
c.set(b, a.length);
return c;
} | javascript | {
"resource": ""
} |
q49944 | Name | train | function Name() {
/**
* The prefix value
* @member
*/
this.prefix = null;
/**
* The first value
* @member
*/
this.first = null;
/**
* The middle value
* @member
*/
this.middle = null;
/**
* The last value
* @member
*/
this.last ... | javascript | {
"resource": ""
} |
q49945 | Customer | train | function Customer() {
/**
* The contactId value
* @member
*/
this.contactId = null;
/**
* The isGuest value
* @member
*/
this.isGuest = null;
/**
* The name of value
* @member
* @type { Name }
*/
this.name = Object.create(Name.prototype);
/**... | javascript | {
"resource": ""
} |
q49946 | HotelPurchaseFailedSchema | train | function HotelPurchaseFailedSchema() {
/**
* The reservationId value
* @member
*/
this.reservationId = null;
/**
* The guests of value
* @member
* @type { Guests }
*/
this.guests = Object.create(Guests.prototype);
/**
* The stay of value
* @member
* ... | javascript | {
"resource": ""
} |
q49947 | train | function(instance, secret, validator) {
// spilt the instance into signature and data
if (instance === null || typeof secret !== 'string' || instance.split('.').length !== 2) {
throw {
name: "WixSignatureException",
message: "Missing instance or secret key"
... | javascript | {
"resource": ""
} | |
q49948 | Recipient | train | function Recipient() {
/**
* The method value
* @member
*/
this.method = null;
/**
* The destination of value
* @member
* @type { Destination }
*/
this.destination = Object.create(Destination.prototype);
/**
* The contactId value
* @member
*/
thi... | javascript | {
"resource": ""
} |
q49949 | SendSchema | train | function SendSchema() {
/**
* The recipient of value
* @member
* @type { Recipient }
*/
this.recipient = Object.create(Recipient.prototype);
/**
* The messageId value
* @member
*/
this.messageId = null;
/**
* The conversionTarget of value
* @member
*... | javascript | {
"resource": ""
} |
q49950 | HotelConfirmationSchema | train | function HotelConfirmationSchema() {
/**
* The source value
* @member
*/
this.source = null;
/**
* The reservationId value
* @member
*/
this.reservationId = null;
/**
* The guests of value
* @member
* @type { Guests }
*/
this.guests = Object.crea... | javascript | {
"resource": ""
} |
q49951 | TrackPlaySchema | train | function TrackPlaySchema() {
/**
* The track of value
* @member
* @type { Track }
*/
this.track = Object.create(Track.prototype);
/**
* The album of value
* @member
* @type { Album }
*/
this.album = Object.create(Album.prototype);
} | javascript | {
"resource": ""
} |
q49952 | TrackShareSchema | train | function TrackShareSchema() {
/**
* The track of value
* @member
* @type { Track }
*/
this.track = Object.create(Track.prototype);
/**
* The album of value
* @member
* @type { Album }
*/
this.album = Object.create(Album.prototype);
/**
* The sharedTo valu... | javascript | {
"resource": ""
} |
q49953 | ItemsItem | train | function ItemsItem() {
/**
* The id value
* @member
*/
this.id = null;
/**
* The sku value
* @member
*/
this.sku = null;
/**
* The title value
* @member
*/
this.title = null;
/**
* The quantity value
* @member
*/
this.quantity =... | javascript | {
"resource": ""
} |
q49954 | BillingAddress | train | function BillingAddress() {
/**
* The firstName value
* @member
*/
this.firstName = null;
/**
* The lastName value
* @member
*/
this.lastName = null;
/**
* The email value
* @member
*/
this.email = null;
/**
* The phone value
* @member
... | javascript | {
"resource": ""
} |
q49955 | PurchaseSchema | train | function PurchaseSchema() {
/**
* The cartId value
* @member
*/
this.cartId = null;
/**
* The storeId value
* @member
*/
this.storeId = null;
/**
* The orderId value
* @member
*/
this.orderId = null;
/**
* The payment of value
* @member
... | javascript | {
"resource": ""
} |
q49956 | TrackSkippedSchema | train | function TrackSkippedSchema() {
/**
* The track of value
* @member
* @type { Track }
*/
this.track = Object.create(Track.prototype);
/**
* The album of value
* @member
* @type { Album }
*/
this.album = Object.create(Album.prototype);
} | javascript | {
"resource": ""
} |
q49957 | AddressesItem | train | function AddressesItem() {
/**
* The tag value
* @member
*/
this.tag = null;
/**
* The address value
* @member
*/
this.address = null;
/**
* The neighborhood value
* @member
*/
this.neighborhood = null;
/**
* The city value
* @member
... | javascript | {
"resource": ""
} |
q49958 | ContactCreateSchema | train | function ContactCreateSchema() {
/**
* The name of value
* @member
* @type { Name }
*/
this.name = Object.create(Name.prototype);
/**
* The picture value
* @member
*/
this.picture = null;
/**
* The company of value
* @member
* @type { Company }
... | javascript | {
"resource": ""
} |
q49959 | WixPagingData | train | function WixPagingData(initialResult, wixApiCallback, dataHandler) {
this.currentData = initialResult;
if(dataHandler !== undefined && dataHandler !== null) {
this.resultData = _.map(initialResult.results, function(elem) {
return dataHandler(elem);
});
} else {
this.resul... | javascript | {
"resource": ""
} |
q49960 | WixActivityData | train | function WixActivityData() {
/**
* Information about the Activity
* @typedef {Object} WixActivityData.ActivityDetails
* @property {?String} additionalInfoUrl Url linking to more specific contextual information about the activity for use in the Dashboard
* @property {?string} summary A short desc... | javascript | {
"resource": ""
} |
q49961 | WixActivity | train | function WixActivity() {
/**
* Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated.
* @member
* @type {Object}
*/
this.contactUpdate = schemaFactory(this.TYPES.CONTACT_CREATE.name);
... | javascript | {
"resource": ""
} |
q49962 | Name | train | function Name(obj){
this._prefix = obj && obj.prefix;
this._first = obj && obj.first;
this._last = obj && obj.last;
this._middle = obj && obj.middle;
this._suffix = obj && obj.suffix;
} | javascript | {
"resource": ""
} |
q49963 | Company | train | function Company(obj){
this._role = obj && obj.role;
this._name = obj && obj.name;
} | javascript | {
"resource": ""
} |
q49964 | Email | train | function Email(obj){
this._id = obj && obj.id;
this._tag = obj && obj.tag;
this._email = obj && obj.email;
this._emailStatus = obj && obj.emailStatus;
if (this._tag == undefined || this._tag == null){
throw 'Tag is a required field'
}
if (this._email == undefined || this._email == n... | javascript | {
"resource": ""
} |
q49965 | Phone | train | function Phone(obj){
this._id = obj && obj.id;
this._tag = obj && obj.tag;
this._phone = obj && obj.phone;
this._normalizedPhone = obj && obj.normalizedPhone;
} | javascript | {
"resource": ""
} |
q49966 | Address | train | function Address(obj){
this._id = obj && obj.id;
this._tag = obj && obj.tag;
this._address = obj && obj.address;
this._city = obj && obj.city;
this._neighborhood = obj && obj.neighborhood;
this._region = obj && obj.region;
this._country = obj && obj.country;
this._postalCode = obj && obj... | javascript | {
"resource": ""
} |
q49967 | Url | train | function Url(obj){
this._id = obj && obj.id;
this._tag = obj && obj.tag;
this._url = obj && obj.url;
} | javascript | {
"resource": ""
} |
q49968 | StateLink | train | function StateLink(obj){
this._id = obj && obj.id;
this._href = obj && obj.href;
this._rel = obj && obj.rel;
} | javascript | {
"resource": ""
} |
q49969 | ImportantDate | train | function ImportantDate(obj){
this._id = obj && obj.id;
this._tag = obj && obj.tag;
this._date = obj && obj.date;
} | javascript | {
"resource": ""
} |
q49970 | Note | train | function Note(obj){
this._id = obj && obj.id;
this._modifiedAt = obj && obj.modifiedAt;
this._content = obj && obj.content;
} | javascript | {
"resource": ""
} |
q49971 | WixLabelData | train | function WixLabelData() {
/**
* The id of the Label
* @member WixLabelData#id
* @type {string}
*/
/**
* A timestamp to indicate when this Label was created
* @member
* @type {Date}
*/
this.createdAt = new Date().toISOString();
/**
* Label name
* @memb... | javascript | {
"resource": ""
} |
q49972 | WixLabel | train | function WixLabel() {
this.isValid = function() {
//TODO provide slightly better validation
return this.name !== null
&& this.description !== null;
};
this.toJSON = function() {
var _this = this;
return {
name : _this.name,
description : ... | javascript | {
"resource": ""
} |
q49973 | APIBuilder | train | function APIBuilder() {
/**
* Creates a {@link Wix} API object with the give credentials.
* @method
* @param {APIBuilder.APICredentials} data JSON data containing credentials for the API
* @throws an exception if signatures don't match when using the API with the instance param
* @throws an... | javascript | {
"resource": ""
} |
q49974 | TrackPlayedSchema | train | function TrackPlayedSchema() {
/**
* The track of value
* @member
* @type { Track }
*/
this.track = Object.create(Track.prototype);
/**
* The album of value
* @member
* @type { Album }
*/
this.album = Object.create(Album.prototype);
} | javascript | {
"resource": ""
} |
q49975 | train | function(client, key, ttl) {
client.ttl(key, function(err, currentTtl) {
if (currentTtl === -1) {
// There is no expiry set on this key, set it
client.expire(key, ttl);
}
});
} | javascript | {
"resource": ""
} | |
q49976 | train | function(callback) {
crypto.randomBytes(16, function(err, buffer) {
if (err) {
return callback(err);
}
return callback(null, buffer.toString('base64'));
});
} | javascript | {
"resource": ""
} | |
q49977 | encode | train | function encode (data, buffer, offset) {
var buffers = []
var result = null
encode._encode(buffers, data)
result = Buffer.concat(buffers)
encode.bytes = result.length
if (Buffer.isBuffer(buffer)) {
result.copy(buffer, offset)
return buffer
}
return result
} | javascript | {
"resource": ""
} |
q49978 | decode | train | function decode (data, start, end, encoding) {
if (data == null || data.length === 0) {
return null
}
if (typeof start !== 'number' && encoding == null) {
encoding = start
start = undefined
}
if (typeof end !== 'number' && encoding == null) {
encoding = end
end = undefined
}
decode.... | javascript | {
"resource": ""
} |
q49979 | copyFile | train | function copyFile (src, dest, ncpOpts, callback) {
var orchestrator = new Orchestrator();
var parts = dest.split(path.sep);
var fileName = parts.pop();
var destDir = parts.join(path.sep);
var destFile = path.resolve(destDir, fileName);
orchestrator.add('ensureDir', function (done) {
mkdirp(destDir, func... | javascript | {
"resource": ""
} |
q49980 | train | function (filename) {
var contents = fs.readFileSync(filename, 'utf-8');
if(contents) {
//Windows is the BOM. Skip the Byte Order Mark.
contents = contents.substring(contents.indexOf('<'));
}
return new et.ElementTree(et.XML(contents));
... | javascript | {
"resource": ""
} | |
q49981 | carbonReporter | train | async function carbonReporter (registry, tags) {
const {
CarbonMetricReporter
} = require('inspector-carbon')
const reporter = new CarbonMetricReporter({
host: 'http://localhost/',
log: null,
minReportingTimeout: 30,
reportInterval: 5000
})
reporter.setTags(tags)
reporter.addMetricRegi... | javascript | {
"resource": ""
} |
q49982 | getEnrichedConfig | train | function getEnrichedConfig(rule, config) {
if (!config) { return rule; }
if (config.include) {
rule.include = config.include;
}
if (config.exclude) {
rule.exclude = config.exclude;
}
return rule;
} | javascript | {
"resource": ""
} |
q49983 | getViewCombinations | train | function getViewCombinations(action) {
const pathes = [action];
const positions = [];
let i;
let j;
for (i = 0; i < action.length; i++) {
if (action[i] === '-') {
positions.push(i);
}
}
const len = positions.length;
const combinations = [];
for (i = 1; i < (1 << len); i++) {
const c = [];
for (j ... | javascript | {
"resource": ""
} |
q49984 | pathname | train | function pathname (routename, isElectron) {
if (isElectron) routename = routename.replace(stripElectron, '')
else routename = routename.replace(prefix, '')
return decodeURI(routename.replace(suffix, '').replace(normalize, '/'))
} | javascript | {
"resource": ""
} |
q49985 | prepare | train | function prepare (binary, include = {memory: true, table: true}, symbol = '_') {
return inject(binary, include, symbol)
} | javascript | {
"resource": ""
} |
q49986 | hibernate | train | function hibernate (instance, symbol = '_') {
const json = {
globals: [],
table: [],
symbol
}
for (const key in instance.exports) {
const val = instance.exports[key]
if (key.startsWith(symbol)) {
const keyElems = key.slice(symbol.length).split('_')
// save the memory
if (val ... | javascript | {
"resource": ""
} |
q49987 | resume | train | function resume (instance, state) {
if (instance.__hibernated) {
instance.__hibernated = false
} else {
// initialize memory
const mem = instance.exports[`${state.symbol}memory`]
if (mem) {
(new Uint32Array(mem.buffer)).set(state.memory, 0)
}
// initialize table
if (instance.expor... | javascript | {
"resource": ""
} |
q49988 | encodeBuffer | train | function encodeBuffer(packet, supportsBinary, callback) {
if (!supportsBinary) {
return exports.encodeBase64Packet(packet, callback);
}
var data = packet.data;
var typeBuffer = new Buffer(1);
typeBuffer[0] = packets[packet.type];
return callback(Buffer.concat([typeBuffer, data]));
} | javascript | {
"resource": ""
} |
q49989 | map | train | function map(ary, each, done) {
var result = new Array(ary.length);
var next = after(ary.length, done);
for (var i = 0; i < ary.length; i++) {
each(ary[i], function(error, msg) {
result[i] = msg;
next(error, result);
});
}
} | javascript | {
"resource": ""
} |
q49990 | parseJSON | train | function parseJSON(data) {
var oData;
try {
oData = JSON.parse(data);
} catch (e) {
return false;
}
return oData;
} | javascript | {
"resource": ""
} |
q49991 | WebViewInterface | train | function WebViewInterface(webView) {
/**
* WebView to setup interface for
*/
this.webView = webView;
/**
* Mapping of webView event/command and its native handler
*/
this.eventListenerMap = {};
/**
* Mapping of js call request id and its success handler.
* B... | javascript | {
"resource": ""
} |
q49992 | getAndroidJSInterface | train | function getAndroidJSInterface(oWebViewInterface){
var AndroidWebViewInterface = com.shripalsoni.natiescriptwebviewinterface.WebViewInterface.extend({
/**
* On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class
*/
onWeb... | javascript | {
"resource": ""
} |
q49993 | train | function(webViewId, eventName, jsonData){
// getting webviewInterface object by webViewId from static map.
var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId);
if (oWebViewInterface) {
oWebViewInterface._onWebViewEvent(eventName, jsonData);
... | javascript | {
"resource": ""
} | |
q49994 | train | function(object) {
// if we're not an array or object, return the primative
if (object !== Object(object)) {
return object;
}
var decamelizeString = function(string) {
var separator = '_';
var split = /(?=[A-Z])/;
return string.split(split).join(separator).toLowerCase();
};... | javascript | {
"resource": ""
} | |
q49995 | train | function(client, initialData, totalLength, requestOptions, successStatuses, successRootKeys, promise) {
this.currentPage = 1; // default to start at page 1
// this.perPage = queryParams && queryParams.per_page || 25; // default to 25 per page
this.totalLength = totalLength;
// bootstrap with initial dat... | javascript | {
"resource": ""
} | |
q49996 | pollUntilDone | train | function pollUntilDone(id, done) {
client.droplets.get(id, function(err, droplet) {
if (!err && droplet.locked === false) {
// we're done!
done.call();
} else if (!err && droplet.locked === true) {
// back off 10s more
setTimeout(function() {
pollUntilDone(id, done);
}, (... | javascript | {
"resource": ""
} |
q49997 | generateModule | train | function generateModule (f) {
// f.dest must be a string or write will fail
var moduleNames = [];
var filePaths = f.src.filter(existsFilter);
if (options.watch) {
watcher.add(filePaths);
}
var modules = filePaths.map(function (filepath) {
var moduleName = normaliz... | javascript | {
"resource": ""
} |
q49998 | train | function (scope, elm, attrs) {
var id = 0,
mergedConfig;
mergedConfig = angular.extend({}, toasterConfig, scope.$eval(attrs.toasterOptions));
scope.config = {
position: mergedConfig['position-class'],
title: mergedConfig['title-class... | javascript | {
"resource": ""
} | |
q49999 | _setDefaultTranslations | train | function _setDefaultTranslations(){
$scope.mdtTranslations = $scope.mdtTranslations || {};
$scope.mdtTranslations.rowsPerPage = $scope.mdtTranslations.rowsPerPage || 'Rows per page:';
$scope.mdtTranslations.largeEditDialog = $scope.mdtTranslations.largeEditD... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.