_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q58700 | getIndicesOfCharacter | validation | function getIndicesOfCharacter( text, characterToFind ) {
const indices = [];
if ( text.indexOf( characterToFind ) > -1 ) {
for ( let i = 0; i < text.length; i++ ) {
if ( text[ i ] === characterToFind ) {
indices.push( i );
}
}
}
return indices;
} | javascript | {
"resource": ""
} |
q58701 | replaceCharactersByIndex | validation | function replaceCharactersByIndex( text, indices, substitute ) {
const modifiedTextSplitByLetter = text.split( "" );
indices.forEach( function( index ) {
modifiedTextSplitByLetter.splice( index, 1, substitute );
} );
return modifiedTextSplitByLetter.join( "" );
} | javascript | {
"resource": ""
} |
q58702 | validation | function( values ) {
this._hasScore = false;
this._identifier = "";
this._hasMarks = false;
this._marker = emptyMarker;
this.score = 0;
this.text = "";
this.marks = [];
if ( isUndefined( values ) ) {
values = {};
}
if ( ! isUndefined( values.score ) ) {
this.setScore( values.score );
}
if ( ! isUndef... | javascript | {
"resource": ""
} | |
q58703 | validation | function( sentence, locale ) {
this._sentenceText = sentence || "";
this._locale = locale || defaultAttributes.locale;
this._isPassive = false;
} | javascript | {
"resource": ""
} | |
q58704 | validation | function( app ) {
var elems = [ "content", "focusKeyword", "synonyms" ];
for ( var i = 0; i < elems.length; i++ ) {
document.getElementById( elems[ i ] ).addEventListener( "input", app.refresh.bind( app ) );
}
document.getElementById( "locale" ).addEventListener( "input", setLocale.bind( app ) );
document.getEle... | javascript | {
"resource": ""
} | |
q58705 | streamToString | validation | async function streamToString(readableStream) {
return new Promise((resolve, reject) => {
const chunks = [];
readableStream.on("data", data => {
chunks.push(data.toString());
});
readableStream.on("end", () => {
resolve(chunks.join(""));
});
readableStream.on("error", reject);
})... | javascript | {
"resource": ""
} |
q58706 | authenticate | validation | function authenticate() {
const authPromtpts = [
{
type: "text",
name: "username",
message: "Username"
},
{
type: "password",
name: "password",
message: "Password"
}
];
let session;
// prompts returns a `Promise` that resolves with the users input
return p... | javascript | {
"resource": ""
} |
q58707 | searchForItems | validation | function searchForItems(session) {
const searchPrompts = [
{
type: "text",
name: "searchText",
message: "Search Query"
},
{
type: "list",
name: "itemTypes",
message: "Item Types"
},
{
type: "list",
name: "itemTags",
message: "Tags"
},
{... | javascript | {
"resource": ""
} |
q58708 | deleteItems | validation | async function deleteItems(items, session) {
// create our iterator which should return a `Promise`
const asyncIterable = {
[Symbol.asyncIterator]: () => ({
// every time we ask for a new item
next: function() {
// remove the next item from the array
const item = items.pop();
... | javascript | {
"resource": ""
} |
q58709 | validation | function() {
// remove the next item from the array
const item = items.pop();
// we are done if there is no item
if (!item) {
return Promise.resolve({ done: true });
}
// prompt to delete this item.
return deleteItem(item, session);
} | javascript | {
"resource": ""
} | |
q58710 | validation | function (kb, x, displayables) {
var t = kb.findTypeURIs(subject)
for (var k = 0; k < displayables.length; k++) {
if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {
return true
}
}
return false
} | javascript | {
"resource": ""
} | |
q58711 | validation | function (newPaneOptions) {
var kb = UI.store
var newInstance = newPaneOptions.newInstance
if (!newInstance) {
let uri = newPaneOptions.newBase
if (uri.endsWith('/')) {
uri = uri.slice(0, -1)
newPaneOptions.newBase = uri
}
newInstance = kb.sym(uri)
}
var cont... | javascript | {
"resource": ""
} | |
q58712 | validation | function (subject) {
var kb = UI.store
var ns = UI.ns
var t = kb.findTypeURIs(subject)
if (t[ns.ldp('Resource').uri]) return 'Sharing' // @@ be more sophisticated?
if (t[ns.ldp('Container').uri]) return 'Sharing' // @@ be more sophisticated?
if (t[ns.ldp('BasicContainer').uri]) return 'Sharing' ... | javascript | {
"resource": ""
} | |
q58713 | validation | function (kb, x, contentTypes) {
var cts = kb.fetcher.getHeader(x, 'content-type')
if (cts) {
for (var j = 0; j < cts.length; j++) {
for (var k = 0; k < contentTypes.length; k++) {
if (cts[j].indexOf(contentTypes[k]) >= 0) {
return true
}
}
... | javascript | {
"resource": ""
} | |
q58714 | validation | function () {
var query = new $rdf.Query('IRC log entries')
var v = []
var vv = ['chan', 'msg', 'date', 'list', 'pred', 'creator', 'content']
vv.map(function (x) {
query.vars.push(v[x] = $rdf.variable(x))
})
query.pat.add(v['chan'], ns.foaf('chatEventList'), v['... | javascript | {
"resource": ""
} | |
q58715 | Click | validation | function Click (e) {
var target = UI.utils.getTarget(e)
if (UI.utils.getTerm(target).termType !== 'Literal') return
this.literalModification(target)
// this prevents the generated inputbox to be clicked again
e.preventDefault()
e.stopPropagation()
} | javascript | {
"resource": ""
} |
q58716 | removefromview | validation | function removefromview () {
var trIterator
for (trIterator = removedTr;
trIterator.childNodes.length === 1;
trIterator = trIterator.previousSibling);
if (trIterator === removedTr) {
var theNext = trIterator.nextSibling
if (theNext.nextSibling && the... | javascript | {
"resource": ""
} |
q58717 | WildCardButtons | validation | function WildCardButtons () {
var menuDiv = myDocument.getElementById(outline.UserInput.menuID)
var div = menuDiv.insertBefore(myDocument.createElement('div'), menuDiv.firstChild)
var input1 = div.appendChild(myDocument.createElement('input'))
var input2 = div.appendChild(myDocument.createElemen... | javascript | {
"resource": ""
} |
q58718 | validation | function (subject) {
var target = kb.any(subject, ns.meeting('target')) || subject
var count = kb.each(target, predicate).length
if (count > 0) {
return UI.utils.label(predicate) + ' ' + count
}
return null
} | javascript | {
"resource": ""
} | |
q58719 | validation | function (subject) {
var kb = UI.store
var t = kb.findTypeURIs(subject)
var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
if (t['http://www.w3.org/ns/pim/trip#Trip'] || // If in any subclass
subject.uri === 'http://... | javascript | {
"resource": ""
} | |
q58720 | validation | function (kb, subject) {
if (kb.updater.editable(subject.doc(), kb)) return subject.doc()
var store = kb.any(subject.doc(), QU('annotationStore'))
return store
} | javascript | {
"resource": ""
} | |
q58721 | validation | function (c) {
var sortBy = kb.sym({
'http://www.w3.org/2005/01/wf/flow#Task': 'http://purl.org/dc/elements/1.1/created',
'http://www.w3.org/ns/pim/trip#Trip': // @@ put this into the ontologies
'http://www.w3.org/2002/12/cal/ical#dtstart',
'http://www.w3.org/2000/10/swap/pim/qif#T... | javascript | {
"resource": ""
} | |
q58722 | validation | function (x, event, selected) {
if (selected) {
currentSubject = x
} else {
currentSubject = null
if (currentMode === 1) deselectObject()
} // If all are displayed, refresh would just annoy:
if (currentMode !== 0) showFiltered(currentMode) // Refresh the objects
} | javascript | {
"resource": ""
} | |
q58723 | validation | function () {
var id = mb.getUser(Post.creator).id
var xupdateStatus = doc.getElementById('xupdateStatus')
var xinReplyToContainer = doc.getElementById('xinReplyToContainer')
var xupdateSubmit = doc.getElementById('xupdateSubmit')
xupdateStatus.value = '@' + id + ' '
xupd... | javascript | {
"resource": ""
} | |
q58724 | validation | function (a, success) {
if (success) {
that.notify('Post deleted.')
// update the ui to reflect model changes.
var deleteThisNode = evt.target.parentNode
deleteThisNode.parentNode.removeChild(deleteThisNode)
kb.removeMany(deleteMe)
... | javascript | {
"resource": ""
} | |
q58725 | validation | function (a, success) {
if (success) {
var deleteContainer = kb.statementsMatching(
undefined, SIOC('container_of'), kb.sym(doc.getElementById(
'post_' + evt.target.parentNode.id).getAttribute('content')))
sparqlUpdater.batch_delete_statement(del... | javascript | {
"resource": ""
} | |
q58726 | displayFormsForRelation | validation | function displayFormsForRelation (pred, allowCreation) {
var sts = kb.statementsMatching(subject, pred)
const outliner = panes.getOutliner(dom)
if (sts.length) {
for (var i = 0; i < sts.length; i++) {
outliner.appendPropertyTRs(box, [ sts[i] ])
var f... | javascript | {
"resource": ""
} |
q58727 | validation | function (subject) {
var kb = UI.store
var n = kb.each(
undefined, ns.rdf('type'), subject).length
if (n > 0) return 'List (' + n + ')' // Show how many in hover text
return null // Suppress pane otherwise
} | javascript | {
"resource": ""
} | |
q58728 | viewAndSaveQuery | validation | function viewAndSaveQuery (outline, selection) {
var qs = outline.qs
UI.log.info('outline.doucment is now ' + outline.document.location)
var q = saveQuery(selection, qs)
/*
if (tabulator.isExtension) {
// tabulator.drawInBestView(q)
} else
*/
for (let i = 0; i < qs.listeners.length; i++) {
qs.l... | javascript | {
"resource": ""
} |
q58729 | validation | function (store, subject) {
kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)
// Render the forms
var forms = UI.widgets.formsFor(subject)
// complain('Form for editing this... | javascript | {
"resource": ""
} | |
q58730 | validation | function (kb, subject, path) {
if (path.length === 0) return [ subject ]
var oo = kb.each(subject, path[0])
var res = []
for (var i = 0; i < oo.length; i++) {
res = res.concat(followeach(kb, oo[i], path.slice(1)))
}
return res
} | javascript | {
"resource": ""
} | |
q58731 | validation | function (subject, dom) {
var outliner = panes.getOutliner(dom)
var kb = UI.store
var arg = UI.ns.arg
subject = kb.canon(subject)
// var types = kb.findTypeURIs(subject)
var div = dom.createElement('div')
div.setAttribute('class', 'argumentPane')
// var title = kb.any(subject, UI.ns.d... | javascript | {
"resource": ""
} | |
q58732 | propertyTree | validation | function propertyTree (subject) {
// print('Proprty tree for '+subject)
var rep = myDocument.createElement('table')
var lastPred = null
var sts = subjects[sz.toStr(subject)] // relevant statements
if (!sts) { // No statements in tree
rep.appendChild(myDocument.createTextNode('...')... | javascript | {
"resource": ""
} |
q58733 | objectTree | validation | function objectTree (obj) {
var res
switch (obj.termType) {
case 'NamedNode':
let anchor = myDocument.createElement('a')
anchor.setAttribute('href', obj.uri)
anchor.addEventListener('click', UI.widgets.openHrefInOutlineMode, true)
anchor.appendChild(myDocument... | javascript | {
"resource": ""
} |
q58734 | validation | function (subject, myDocument) {
function alternativeRendering () {
var sz = UI.rdf.Serializer(UI.store)
var res = sz.rootSubjects(sts)
var roots = res.roots
var p = {}
p.render = function (s2) {
var div = myDocument.createElement('div')
div.setAttribute('class', 'withi... | javascript | {
"resource": ""
} | |
q58735 | validation | function (subject) {
var kb = UI.store
var ns = UI.ns
var t = kb.findTypeURIs(subject)
if (t[ns.ldp('Container').uri] || t[ns.ldp('BasicContainer').uri]) {
var contents = kb.each(subject, ns.ldp('contains'))
var count = 0
contents.map(function (file) {
if (UI.widgets.isImage(fi... | javascript | {
"resource": ""
} | |
q58736 | removeAndRefresh | validation | function removeAndRefresh (d) {
var table = d.parentNode
var par = table.parentNode
var placeholder = dom.createElement('table')
placeholder.setAttribute('style', 'width: 100%;')
par.replaceChild(placeholder, table)
table.removeChild(d)
par.replaceChild(table, placeholder) // Attempt to
} | javascript | {
"resource": ""
} |
q58737 | optOnIconMouseDownListener | validation | function optOnIconMouseDownListener (e) { // outlineIcons.src.icon_opton needed?
var target = thisOutline.targetOf(e)
var p = target.parentNode
termWidget.replaceIcon(p.parentNode,
outlineIcons.termWidgets.optOn,
outlineIcons.termWidgets.optOff, optOffIconMouseDownListener)
p.parentNode.par... | javascript | {
"resource": ""
} |
q58738 | handleFileSelect | validation | function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
// Get the FileList object that contains the list of files that were dropped
var files = evt.dataTransfer.files;
// this UI is only built for a single file so just dump the first one
dumpFile(... | javascript | {
"resource": ""
} |
q58739 | sha1 | validation | function sha1(buffer, offset, length) {
offset = offset || 0;
length = length || buffer.length;
var subArray = dicomParser.sharedCopy(buffer, offset, length);
var rusha = new Rusha();
return rusha.digest(subArray);
} | javascript | {
"resource": ""
} |
q58740 | getMarkdownToTextConverter | validation | function getMarkdownToTextConverter() {
const remark = require('remark')
const strip = require('strip-markdown')
const converter = remark().use(strip)
return (md) => String(converter.processSync(md))
} | javascript | {
"resource": ""
} |
q58741 | validation | function(password, count) {
// Errors
if(!password) throw new Error('Missing argument !');
if(!count || count <= 0) throw new Error('Please provide a count number above 0');
// Processing
let data = password;
console.time('sha3^n generation time');
for (let i = 0; i < count; ++i) {
d... | javascript | {
"resource": ""
} | |
q58742 | validation | function(privateKey, password) {
// Errors
if (!privateKey || !password) throw new Error('Missing argument !');
//if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !');
// Processing
let pass = derivePassSha(password, 20);
let r = encrypt(privateKey, convert.h... | javascript | {
"resource": ""
} | |
q58743 | validation | function(senderPriv, recipientPub, msg) {
// Errors
if (!senderPriv || !recipientPub || !msg) throw new Error('Missing argument !');
//if (!Helpers.isPrivateKeyValid(senderPriv)) throw new Error('Private key is not valid !');
//if (!Helpers.isPublicKeyValid(recipientPub)) throw new Error('Public key is ... | javascript | {
"resource": ""
} | |
q58744 | validation | function(recipientPrivate, senderPublic, _payload) {
// Errorsp
if(!recipientPrivate || !senderPublic || !_payload) throw new Error('Missing argument !');
// Processing
let binPayload = convert.hexToUint8(_payload);
let salt = new Uint8Array(binPayload.buffer, 0, 32);
let iv = new Uint8Array(bin... | javascript | {
"resource": ""
} | |
q58745 | validation | function(ua, uaLength) {
let temp = [];
for (let i = 0; i < uaLength; i += 4) {
let x = ua[i] * 0x1000000 + (ua[i + 1] || 0) * 0x10000 + (ua[i + 2] || 0) * 0x100 + (ua[i + 3] || 0);
temp.push((x > 0x7fffffff) ? x - 0x100000000 : x);
}
return CryptoJS.lib.WordArray.create(temp, uaLength);... | javascript | {
"resource": ""
} | |
q58746 | validation | function(destUa, cryptowords) {
for (let i = 0; i < destUa.length; i += 4) {
let v = cryptowords.words[i / 4];
if (v < 0) v += 0x100000000;
destUa[i] = (v >>> 24);
destUa[i + 1] = (v >>> 16) & 0xff;
destUa[i + 2] = (v >>> 8) & 0xff;
destUa[i + 3] = v & 0xff;
}
... | javascript | {
"resource": ""
} | |
q58747 | validation | function(p) {
var dx = p.x - this.x,
dy = p.y - this.y;
return dx * dx + dy * dy;
} | javascript | {
"resource": ""
} | |
q58748 | validation | function(e) {
var self = this;
// necessary for mobile webkit devices (manual focus triggering
// is ignored unless invoked within a click event)
// also necessary to reopen a dropdown that has been closed by
// closeAfterSelect
if (!self.isFocused || !self.isOpen) {
self.focus();
e.preventDefaul... | javascript | {
"resource": ""
} | |
q58749 | validation | function(data) {
var key = hash_key(data[this.settings.valueField]);
if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
data.$order = data.$order || ++this.order;
this.options[key] = data;
return key;
} | javascript | {
"resource": ""
} | |
q58750 | validation | function() {
var self = this;
self.loadedSearches = {};
self.userOptions = {};
self.renderCache = {};
var options = self.options;
$.each(self.options, function(key, value) {
if(self.items.indexOf(key) == -1) {
delete options[key];
}
});
self.options = self.sifter.items = options;
self.lastQ... | javascript | {
"resource": ""
} | |
q58751 | validation | function(values, silent) {
this.buffer = document.createDocumentFragment();
var childNodes = this.$control[0].childNodes;
for (var i = 0; i < childNodes.length; i++) {
this.buffer.appendChild(childNodes[i]);
}
var items = $.isArray(values) ? values : [values];
for (var i = 0, n = items.length; i < n; i... | javascript | {
"resource": ""
} | |
q58752 | validation | function(value, silent) {
var self = this;
var $item, i, idx;
$item = (value instanceof $) ? value : self.getItem(value);
value = hash_key($item.attr('data-value'));
i = self.items.indexOf(value);
if (i !== -1) {
$item.remove();
if ($item.hasClass('active')) {
idx = self.$activeItems.indexOf($it... | javascript | {
"resource": ""
} | |
q58753 | validation | function() {
if (!this.isRequired) return false;
var invalid = !this.items.length;
this.isInvalid = invalid;
this.$control_input.prop('required', invalid);
this.$input.prop('required', !invalid);
} | javascript | {
"resource": ""
} | |
q58754 | validation | function() {
var self = this;
var trigger = self.isOpen;
if (self.settings.mode === 'single' && self.items.length) {
self.hideInput();
// Do not trigger blur while inside a blur event,
// this fixes some weird tabbing behavior in FF and IE.
// See #1164
if (!self.isBlurring) {
self.$control_i... | javascript | {
"resource": ""
} | |
q58755 | validation | function($el) {
var caret = Math.min(this.caretPos, this.items.length);
var el = $el[0];
var target = this.buffer || this.$control[0];
if (caret === 0) {
target.insertBefore(el, target.firstChild);
} else {
target.insertBefore(el, target.childNodes[caret]);
}
this.setCaret(caret + 1);
} | javascript | {
"resource": ""
} | |
q58756 | validation | function(templateName, data) {
var value, id, label;
var html = '';
var cache = false;
var self = this;
var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
if (templateName === 'option' || templateName === 'item') {
value = hash_key(data[self.settings.valueField]);
cache = !!v... | javascript | {
"resource": ""
} | |
q58757 | updateMetrics | validation | function updateMetrics() {
isVwDirty = false;
DPR = window.devicePixelRatio;
cssCache = {};
sizeLengthCache = {};
pf.DPR = DPR || 1;
units.width = Math.max(window.innerWidth || 0, docElem.clientWidth);
units.height = Math.max(window.innerHeight || 0, docElem.clientHeight);
units.vw = units.width / 1... | javascript | {
"resource": ""
} |
q58758 | parseDescriptors | validation | function parseDescriptors() {
// 9. Descriptor parser: Let error be no.
var pError = false,
// 10. Let width be absent.
// 11. Let density be absent.
// 12. Let future-compat-h be absent. (We're implementing it now as h)
w, d, h, i,
candidate = {},
desc, lastChar, value, intVal, fl... | javascript | {
"resource": ""
} |
q58759 | extend | validation | function extend(style, rule, sheet, newStyle = {}) {
mergeExtend(style, rule, sheet, newStyle)
mergeRest(style, rule, sheet, newStyle)
return newStyle
} | javascript | {
"resource": ""
} |
q58760 | convertCase | validation | function convertCase(style) {
const converted = {}
for (const prop in style) {
const key = prop.indexOf('--') === 0 ? prop : hyphenate(prop)
converted[key] = style[prop]
}
if (style.fallbacks) {
if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase)
else co... | javascript | {
"resource": ""
} |
q58761 | ResourceNamespace | validation | function ResourceNamespace(stripe, resources) {
for (var name in resources) {
var camelCaseName = name[0].toLowerCase() + name.substring(1);
var resource = new resources[name](stripe);
this[camelCaseName] = resource;
}
} | javascript | {
"resource": ""
} |
q58762 | validation | function(args) {
if (args.length < 1 || !isPlainObject(args[0])) {
return {};
}
if (!utils.isOptionsHash(args[0])) {
return args.shift();
}
var argKeys = Object.keys(args[0]);
var optionKeysInArgs = argKeys.filter(function(key) {
return OPTIONS_KEYS.indexOf(key) > -1;
})... | javascript | {
"resource": ""
} | |
q58763 | validation | function(args) {
var opts = {
auth: null,
headers: {},
};
if (args.length > 0) {
var arg = args[args.length - 1];
if (utils.isAuthKey(arg)) {
opts.auth = args.pop();
} else if (utils.isOptionsHash(arg)) {
var params = args.pop();
var extraKeys = Object.... | javascript | {
"resource": ""
} | |
q58764 | validation | function(sub) {
var Super = this;
var Constructor = hasOwn.call(sub, 'constructor') ? sub.constructor : function() {
Super.apply(this, arguments);
};
// This initialization logic is somewhat sensitive to be compatible with
// divergent JS implementations like the one found in Qt. See here for... | javascript | {
"resource": ""
} | |
q58765 | validation | function(obj) {
if (typeof obj !== 'object') {
throw new Error('Argument must be an object');
}
Object.keys(obj).forEach(function(key) {
if (obj[key] === null || obj[key] === undefined) {
delete obj[key];
}
});
return obj;
} | javascript | {
"resource": ""
} | |
q58766 | safeExec | validation | function safeExec(cmd, cb) {
try {
utils._exec(cmd, cb);
} catch (e) {
cb(e, null);
}
} | javascript | {
"resource": ""
} |
q58767 | validation | function(opts) {
if (!opts) {
throw new Error.StripeError({
message: 'Options are required',
});
}
opts.timestamp = Math.floor(opts.timestamp) || Math.floor(Date.now() / 1000);
opts.scheme = opts.scheme || signature.EXPECTED_SCHEME;
opts.signature = opts.signature ||
sign... | javascript | {
"resource": ""
} | |
q58768 | StripeResource | validation | function StripeResource(stripe, urlData) {
this._stripe = stripe;
this._urlData = urlData || {};
this.basePath = utils.makeURLInterpolator(this.basePath || stripe.getApiField('basePath'));
this.resourcePath = this.path;
this.path = utils.makeURLInterpolator(this.path);
if (this.includeBasic) {
this.in... | javascript | {
"resource": ""
} |
q58769 | stripeMethod | validation | function stripeMethod(spec) {
return function() {
var self = this;
var args = [].slice.call(arguments);
var callback = typeof args[args.length - 1] == 'function' && args.pop();
var requestPromise = utils.callbackifyPromiseWithTimeout(makeRequest(self, args, spec, {}), callback)
if (spec.methodT... | javascript | {
"resource": ""
} |
q58770 | validation | function(cb) {
if (Stripe.USER_AGENT_SERIALIZED) {
return cb(Stripe.USER_AGENT_SERIALIZED);
}
this.getClientUserAgentSeeded(Stripe.USER_AGENT, function(cua) {
Stripe.USER_AGENT_SERIALIZED = cua;
cb(Stripe.USER_AGENT_SERIALIZED);
})
} | javascript | {
"resource": ""
} | |
q58771 | validation | function(seed, cb) {
var self = this;
utils.safeExec('uname -a', function(err, uname) {
var userAgent = {};
for (var field in seed) {
userAgent[field] = encodeURIComponent(seed[field]);
}
// URI-encode in case there are unusual characters in the system's uname.
userAgent.... | javascript | {
"resource": ""
} | |
q58772 | createSharingUrl | validation | function createSharingUrl (network) {
return this.baseNetworks[network].sharer
.replace(/@url/g, encodeURIComponent(this.url))
.replace(/@title/g, encodeURIComponent(this.title))
.replace(/@description/g, encodeURIComponent(this.description))
.replace(/@quote/g, encodeURIComponent(... | javascript | {
"resource": ""
} |
q58773 | share | validation | function share (network) {
this.openSharer(network, this.createSharingUrl(network));
this.$root.$emit('social_shares_open', network, this.url);
this.$emit('open', network, this.url);
} | javascript | {
"resource": ""
} |
q58774 | touch | validation | function touch (network) {
window.open(this.createSharingUrl(network), '_self');
this.$root.$emit('social_shares_open', network, this.url);
this.$emit('open', network, this.url);
} | javascript | {
"resource": ""
} |
q58775 | openSharer | validation | function openSharer (network, url) {
var this$1 = this;
// If a popup window already exist it will be replaced, trigger a close event.
var popupWindow = null;
if (popupWindow && this.popup.interval) {
clearInterval(this.popup.interval);
popupWindow.close();// Force close (for F... | javascript | {
"resource": ""
} |
q58776 | mounted | validation | function mounted () {
if (!inBrowser) {
return;
}
/**
* Center the popup on dual screens
* http://stackoverflow.com/questions/4068373/center-a-popup-window-on-screen/32261263
*/
var dualScreenLeft = $window.screenLeft !== undefined ? $window.screenLeft : screen.left;
var dualSc... | javascript | {
"resource": ""
} |
q58777 | loadAndParseFile | validation | function loadAndParseFile(filename, settings, nextFile) {
if (settings.debug) {
debug('loadAndParseFile(\'' + filename +'\')');
debug('totalFiles: ' + settings.totalFiles);
debug('filesLoaded: ' + settings.filesLoaded);
}
if (filename !== null && typeof filen... | javascript | {
"resource": ""
} |
q58778 | validation | function(event, g) {
var chartPos = utils.findPos(g.canvas_);
var box = {
left: chartPos.x,
right: chartPos.x + g.canvas_.offsetWidth,
top: chartPos.y,
bottom: chartPos.y + g.canvas_.offsetHeight
};
var pt = {
x: utils.pageX(event),
y: utils.pageY(event)
};
var dx = distanceFromInt... | javascript | {
"resource": ""
} | |
q58779 | validation | function(event, g, context) {
// Right-click should not initiate a zoom.
if (event.button && event.button == 2) return;
context.initializeMouseDown(event, g, context);
if (event.altKey || event.shiftKey) {
DygraphInteraction.startPan(event, g, context);
} else {
DygraphInteraction.star... | javascript | {
"resource": ""
} | |
q58780 | validation | function(event, g, context) {
if (context.cancelNextDblclick) {
context.cancelNextDblclick = false;
return;
}
// Give plugins a chance to grab this event.
var e = {
canvasx: context.dragEndX,
canvasy: context.dragEndY,
cancelable: true,
};
if (g.cascadeEvents_('dbl... | javascript | {
"resource": ""
} | |
q58781 | getControlPoints | validation | function getControlPoints(p0, p1, p2, opt_alpha, opt_allowFalseExtrema) {
var alpha = (opt_alpha !== undefined) ? opt_alpha : 1/3; // 0=no smoothing, 1=crazy smoothing
var allowFalseExtrema = opt_allowFalseExtrema || false;
if (!p2) {
return [p1.x, p1.y, null, null];
}
// Step 1: Position the control p... | javascript | {
"resource": ""
} |
q58782 | validation | function(dygraph) {
this.dygraph_ = dygraph;
/**
* Array of points for each series.
*
* [series index][row index in series] = |Point| structure,
* where series index refers to visible series only, and the
* point index is for the reduced set of points for the current
* zoom region (including one p... | javascript | {
"resource": ""
} | |
q58783 | validation | function(event, g, contextB) {
// prevents mouse drags from selecting page text.
if (event.preventDefault) {
event.preventDefault(); // Firefox, Chrome, etc.
} else {
event.returnValue = false; // IE
event.cancelBubble = true;
}
var canvasPos = utils.findPos(g.ca... | javascript | {
"resource": ""
} | |
q58784 | validation | function(idx) {
// If we've previously found a non-NaN point and haven't gone past it yet,
// just use that.
if (nextPointIdx >= idx) return;
// We haven't found a non-NaN point yet or have moved past it,
// look towards the right to find a non-NaN point.
for (var j = idx; j < points.length; ++... | javascript | {
"resource": ""
} | |
q58785 | validateNativeFormat | validation | function validateNativeFormat(data) {
const firstRow = data[0];
const firstX = firstRow[0];
if (typeof firstX !== 'number' && !utils.isDateLike(firstX)) {
throw new Error(`Expected number or date but got ${typeof firstX}: ${firstX}.`);
}
for (let i = 1; i < firstRow.length; i++) {
const val = firstRow... | javascript | {
"resource": ""
} |
q58786 | validation | function(opt_options) {
this.canvas_ = document.createElement("canvas");
opt_options = opt_options || {};
this.direction_ = opt_options.direction || null;
} | javascript | {
"resource": ""
} | |
q58787 | validation | function(div) {
var sizeSpan = document.createElement('span');
sizeSpan.setAttribute('style', 'margin: 0; padding: 0 0 0 1em; border: 0;');
div.appendChild(sizeSpan);
var oneEmWidth=sizeSpan.offsetWidth;
div.removeChild(sizeSpan);
return oneEmWidth;
} | javascript | {
"resource": ""
} | |
q58788 | Keycloak | validation | function Keycloak (config, keycloakConfig) {
// If keycloakConfig is null, Config() will search for `keycloak.json`.
this.config = new Config(keycloakConfig);
this.grantManager = new GrantManager(this.config);
this.stores = [ BearerStore ];
if (!config) {
throw new Error('Adapter configuration must be ... | javascript | {
"resource": ""
} |
q58789 | GrantManager | validation | function GrantManager (config) {
this.realmUrl = config.realmUrl;
this.clientId = config.clientId;
this.secret = config.secret;
this.publicKey = config.publicKey;
this.public = config.public;
this.bearerOnly = config.bearerOnly;
this.notBefore = 0;
this.rotation = new Rotation(config);
} | javascript | {
"resource": ""
} |
q58790 | Rotation | validation | function Rotation (config) {
this.realmUrl = config.realmUrl;
this.minTimeBetweenJwksRequests = config.minTimeBetweenJwksRequests;
this.jwks = [];
this.lastTimeRequesTime = 0;
} | javascript | {
"resource": ""
} |
q58791 | Config | validation | function Config (config) {
if (!config) {
config = path.join(process.cwd(), 'keycloak.json');
}
if (typeof config === 'string') {
this.loadConfiguration(config);
} else {
this.configure(config);
}
} | javascript | {
"resource": ""
} |
q58792 | Enforcer | validation | function Enforcer (keycloak, config) {
this.keycloak = keycloak;
this.config = config || {};
if (!this.config.response_mode) {
this.config.response_mode = 'permissions';
}
if (!this.config.resource_server_id) {
this.config.resource_server_id = this.keycloak.getConfig().clientId;
}
} | javascript | {
"resource": ""
} |
q58793 | Token | validation | function Token (token, clientId) {
this.token = token;
this.clientId = clientId;
if (token) {
try {
const parts = token.split('.');
this.header = JSON.parse(Buffer.from(parts[0], 'base64').toString());
this.content = JSON.parse(Buffer.from(parts[1], 'base64').toString());
this.signatu... | javascript | {
"resource": ""
} |
q58794 | filterCss | validation | function filterCss(abstractSyntaxTree, allowedStyles) {
if (!allowedStyles) {
return abstractSyntaxTree;
}
var filteredAST = cloneDeep(abstractSyntaxTree);
var astRules = abstractSyntaxTree.nodes[0];
var selectedRule;
// Merge global and tag-specific styles into new AST.
if (allowedS... | javascript | {
"resource": ""
} |
q58795 | stringifyStyleAttributes | validation | function stringifyStyleAttributes(filteredAST) {
return filteredAST.nodes[0].nodes
.reduce(function(extractedAttributes, attributeObject) {
extractedAttributes.push(
attributeObject.prop + ':' + attributeObject.value
);
return extractedAttributes;
}, [])
.join(';'... | javascript | {
"resource": ""
} |
q58796 | filterDeclarations | validation | function filterDeclarations(selectedRule) {
return function (allowedDeclarationsList, attributeObject) {
// If this property is whitelisted...
if (selectedRule.hasOwnProperty(attributeObject.prop)) {
var matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {
... | javascript | {
"resource": ""
} |
q58797 | readUint64 | validation | function readUint64(buffer, offset) {
var hi = (buffer[offset] << 24 |
buffer[offset + 1] << 16 |
buffer[offset + 2] << 8 |
buffer[offset + 3] << 0) >>> 0;
var lo = (buffer[offset + 4] << 24 |
buffer[offset + 5] << 16 |
buffer[offset + 6] << 8 |
... | javascript | {
"resource": ""
} |
q58798 | check | validation | function check(type, hash, callback) {
if (typeof type !== "string") throw new TypeError("type must be string");
if (typeof hash !== "string") throw new TypeError("hash must be string");
if (hasCache[hash]) return callback(null, true);
local.hasHash(hash, function (err, has) {
if (err) return call... | javascript | {
"resource": ""
} |
q58799 | readLength | validation | function readLength() {
var byte = delta[deltaOffset++];
var length = byte & 0x7f;
var shift = 7;
while (byte & 0x80) {
byte = delta[deltaOffset++];
length |= (byte & 0x7f) << shift;
shift += 7;
}
return length;
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.