_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q28400 | train | function (callback) {
IdentityCounter.findOneAndUpdate(
{ model: settings.model, field: settings.field },
{ count: settings.startAt - settings.incrementBy },
{ new: true }, // new: true specifies that the callback should get the updated counter.
function (err) {
if (err) return callb... | javascript | {
"resource": ""
} | |
q28401 | train | function (err, updatedIdentityCounter) {
if (err) return next(err);
// If there are no errors then go ahead and set the document's field to the current count.
doc[settings.field] = updatedIdentityCounter.count;
// Continue with default document save functi... | javascript | {
"resource": ""
} | |
q28402 | addUnscrollClassName | train | function addUnscrollClassName() {
if (document.getElementById('unscroll-class-name')) {
return;
}
var css = '.unscrollable { overflow-y: hidden !important; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
... | javascript | {
"resource": ""
} |
q28403 | train | function (el)
{
// Extract the href or the onclick event if no submit event is passed
if (!this.options.confirm) {
var submit = el.attr('onclick') ? el.attr('onclick') : (el.attr('href') ? (el.attr('target') ? 'window.open("' + el.attr('href') + '", "' + el.attr('target') + '");' : 'window.loca... | javascript | {
"resource": ""
} | |
q28404 | train | function ()
{
// Set the new action for the submit button
this.submitButton.off('click.jBox-Confirm' + this.id).on('click.jBox-Confirm' + this.id, function () { this.options.confirm ? this.options.confirm() : eval(this.source.data('jBox-Confirm-submit')); this.options.closeOnConfirm && this.close(); }.b... | javascript | {
"resource": ""
} | |
q28405 | train | function ()
{
// Append image label containers
this.imageLabel = jQuery('<div/>', {'class': 'jBox-image-label-container'}).appendTo(this.wrapper);
this.imageLabel.append(jQuery('<div/>', {'class': 'jBox-image-pointer-prev', click: function () { this.showImage('prev'); }.bind(this)})).append(jQuery... | javascript | {
"resource": ""
} | |
q28406 | train | function ()
{
// Add key events
jQuery(document).on('keyup.jBox-Image-' + this.id, function (ev) {
(ev.keyCode == 37) && this.showImage('prev');
(ev.keyCode == 39) && this.showImage('next');
}.bind(this));
// Load the image from the attached element
this.showImage('ope... | javascript | {
"resource": ""
} | |
q28407 | train | function ()
{
// Cache position values
this.defaultNoticePosition = jQuery.extend({}, this.options.position);
// Type Notice has its own adjust position function
this._adjustNoticePositon = function () {
var win = jQuery(window);
var windowDimensions = {
x: win.wid... | javascript | {
"resource": ""
} | |
q28408 | train | function ()
{
// Bail if we're stacking
if (this.options.stack) {
return;
}
// Adjust position when opening
this._adjustNoticePositon();
// Loop through notices at same window corner destroy them
jQuery.each(jQuery('.jBox-Notice'), function (index, el)
{
... | javascript | {
"resource": ""
} | |
q28409 | train | function ()
{
var stacks = {};
jQuery.each(jQuery('.jBox-Notice'), function (index, el)
{
el = jQuery(el);
var pos = el.data('jBox-Notice-position');
if (!stacks[pos]) {
stacks[pos] = [];
}
stacks[pos].push(el);
});
... | javascript | {
"resource": ""
} | |
q28410 | train | function () {
// Create the containers for the liked or disliked avatars
if (initial) {
$('<div id="LikedAvatars" class="AvatarsCollection"/>').appendTo($('body'));
$('<div id="DislikedAvatars" class="AvatarsCollection"/>').appendTo($('body'));
}
$.each(this.footer.... | javascript | {
"resource": ""
} | |
q28411 | train | function () {
// Set title and content depending on current index
this.setTitle(DemoAvatars.Avatars[DemoAvatars.current]);
this.content.css({backgroundImage: 'url(https://stephanwagner.me/img/jBox/avatar/' + DemoAvatars.Avatars[DemoAvatars.current] + '.svg)'});
// If it's the inita... | javascript | {
"resource": ""
} | |
q28412 | getCredential | train | function getCredential(accessKey, region, requestDate) {
if (!isString(accessKey)) {
throw new TypeError('accessKey should be of type "string"')
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"')
}
if (!isObject(requestDate)) {
throw new TypeError('requestDate shou... | javascript | {
"resource": ""
} |
q28413 | getSignedHeaders | train | function getSignedHeaders(headers) {
if (!isObject(headers)) {
throw new TypeError('request should be of type "object"')
}
// Excerpts from @lsegal - https://github.com/aws/aws-sdk-js/issues/659#issuecomment-120477258
//
// User-Agent:
//
// This is ignored from signing because signing this caus... | javascript | {
"resource": ""
} |
q28414 | getSigningKey | train | function getSigningKey(date, region, secretKey) {
if (!isObject(date)) {
throw new TypeError('date should be of type "object"')
}
if (!isString(region)) {
throw new TypeError('region should be of type "string"')
}
if (!isString(secretKey)) {
throw new TypeError('secretKey should be of type "string... | javascript | {
"resource": ""
} |
q28415 | getStringToSign | train | function getStringToSign(canonicalRequest, requestDate, region) {
if (!isString(canonicalRequest)) {
throw new TypeError('canonicalRequest should be of type "string"')
}
if (!isObject(requestDate)) {
throw new TypeError('requestDate should be of type "object"')
}
if (!isString(region)) {
throw new... | javascript | {
"resource": ""
} |
q28416 | probe | train | function probe (mdns, service, cb) {
var sent = false
var retries = 0
var timer
mdns.on('response', onresponse)
setTimeout(send, Math.random() * 250)
function send () {
// abort if the service have or is being stopped in the meantime
if (!service._activated || service._destroyed) return
mdns.... | javascript | {
"resource": ""
} |
q28417 | announce | train | function announce (server, service) {
var delay = 1000
var packet = service._records()
server.register(packet)
;(function broadcast () {
// abort if the service have or is being stopped in the meantime
if (!service._activated || service._destroyed) return
server.mdns.respond(packet, function () {... | javascript | {
"resource": ""
} |
q28418 | teardown | train | function teardown (server, services, cb) {
if (!Array.isArray(services)) services = [services]
services = services.filter(function (service) {
return service._activated // ignore services not currently starting or started
})
var records = flatten.depth(services.map(function (service) {
service._activa... | javascript | {
"resource": ""
} |
q28419 | Browser | train | function Browser (mdns, opts, onup) {
if (typeof opts === 'function') return new Browser(mdns, null, opts)
EventEmitter.call(this)
this._mdns = mdns
this._onresponse = null
this._serviceMap = {}
this._txt = dnsTxt(opts.txt)
if (!opts || !opts.type) {
this._name = WILDCARD
this._wildcard = true
... | javascript | {
"resource": ""
} |
q28420 | train | function (obj, columnName) {
if (typeof obj !== "object" || typeof columnName !== "string") {
return obj;
}
var args = columnName.split('.');
var cObj = obj;
if (args.length > 1) {
for (var i = 1, len = args.length; i < len; i++) {
cObj = cObj[args[i]];
if (!cObj) {
return obj;
... | javascript | {
"resource": ""
} | |
q28421 | stringify | train | function stringify(obj) {
try {
return JSON.stringify(obj);
} catch (e) {
var cache = [];
return JSON.stringify(obj, function (key, value) {
if (angular.isObject(value) && value !== null) {
if (cache.inde... | javascript | {
"resource": ""
} |
q28422 | getModuleConfig | train | function getModuleConfig(moduleName) {
if (!angular.isString(moduleName)) {
throw new Error('You need to give the name of the module to get');
}
if (!modules[moduleName]) {
return null;
}
... | javascript | {
"resource": ""
} |
q28423 | setModuleConfig | train | function setModuleConfig(moduleConfig) {
if (!angular.isObject(moduleConfig)) {
throw new Error('You need to give the module config object to set');
}
modules[moduleConfig.name] = moduleConfig;
return moduleConfig;
... | javascript | {
"resource": ""
} |
q28424 | isLoaded | train | function isLoaded(modulesNames) {
var moduleLoaded = function moduleLoaded(module) {
var isLoaded = regModules.indexOf(module) > -1;
if (!isLoaded) {
isLoaded = !!moduleExists(module);
}
... | javascript | {
"resource": ""
} |
q28425 | getModule | train | function getModule(moduleName) {
try {
return ngModuleFct(moduleName);
} catch (e) {
// this error message really suxx
if (/No module/.test(e) || e.message.indexOf('$injector:nomod') > -1) {
... | javascript | {
"resource": ""
} |
q28426 | inject | train | function inject(moduleName) {
var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
var self = this,
deferred =... | javascript | {
"resource": ""
} |
q28427 | getOptions | train | function getOptions(loaderContext) {
const options = {
plugins: [],
relativeUrls: true,
...clone(loaderUtils.getOptions(loaderContext)),
};
// We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
options.filename = loaderContext.resource;... | javascript | {
"resource": ""
} |
q28428 | createWebpackLessPlugin | train | function createWebpackLessPlugin(loaderContext) {
const { fs } = loaderContext;
const resolve = pify(loaderContext.resolve.bind(loaderContext));
const loadModule = pify(loaderContext.loadModule.bind(loaderContext));
const readFile = pify(fs.readFile.bind(fs));
class WebpackFileManager extends less.FileManage... | javascript | {
"resource": ""
} |
q28429 | processResult | train | function processResult(loaderContext, resultPromise) {
const { callback } = loaderContext;
resultPromise
.then(
({ css, map, imports }) => {
imports.forEach(loaderContext.addDependency, loaderContext);
return {
// Removing the sourceMappingURL comment.
// See removeSou... | javascript | {
"resource": ""
} |
q28430 | formatLessError | train | function formatLessError(err) {
/* eslint-disable no-param-reassign */
const msg = err.message;
// Instruct webpack to hide the JS stack from the console
// Usually you're only interested in the SASS stack in this case.
err.hideStack = true;
err.message = [
os.EOL,
...getFileExcerptIfPossible(err)... | javascript | {
"resource": ""
} |
q28431 | getColumnPropertiesFromColumnArray | train | function getColumnPropertiesFromColumnArray(columnProperties, columns) {
return columns.reduce((previous, current, i) => {
previous[current] = { id: current, order: offset + i };
return previous;
},
columnProperties);
} | javascript | {
"resource": ""
} |
q28432 | buildGriddleReducerObject | train | function buildGriddleReducerObject(reducerObjects) {
let reducerMethodsWithoutHooks = [];
let beforeHooks = [];
let afterHooks = [];
let beforeReduceAll = [];
let afterReduceAll = [];
if (reducerObjects.length > 0) {
// remove the hooks and extend the object
for(const key in reducerObjects) {
... | javascript | {
"resource": ""
} |
q28433 | train | function(name, fullPath, fileSystem, nativeURL) {
// remove trailing slash if it is present
if (fullPath && /\/$/.test(fullPath)) {
fullPath = fullPath.substring(0, fullPath.length - 1);
}
if (nativeURL && /\/$/.test(nativeURL)) {
nativeURL = nativeURL.substring(0, nativeURL.length - 1);... | javascript | {
"resource": ""
} | |
q28434 | run | train | function run(context) {
const preferences = configPreferences.read(context);
const platforms = context.opts.cordova.platforms;
platforms.forEach(platform => {
if (platform === ANDROID) {
androidManifest.writePreferences(context, preferences);
}
if (platform === IOS) {
iosD... | javascript | {
"resource": ""
} |
q28435 | execute | train | function execute(method, params) {
var output = !params ? [] : params;
if (method == "getStandardEvents") {
return new Promise(function promise(resolve, reject) {
resolve(standardEvent);
});
}
return new Promise(function promise(resolve, reject) {
exec(
function success(res) {
... | javascript | {
"resource": ""
} |
q28436 | train | function() {
this._readyState = 0;
this._error = null;
this._result = null;
this._progress = null;
this._localURL = '';
this._realReader = origFileReader ? new origFileReader() : {};
} | javascript | {
"resource": ""
} | |
q28437 | addDevelopmentTeam | train | function addDevelopmentTeam(preferences) {
const file = path.join(preferences.projectRoot, FILENAME);
let content = getBuildJson(file);
content = convertStringToJson(content);
createDefaultBuildJson(content);
updateDevelopmentTeam(content, preferences);
content = convertJsonToString(content);
... | javascript | {
"resource": ""
} |
q28438 | updateDevelopmentTeam | train | function updateDevelopmentTeam(content, preferences) {
const release = preferences.iosTeamRelease;
const debug = preferences.iosTeamDebug
? preferences.iosTeamDebug
: preferences.iosTeamRelease;
if (release === null) {
throw new Error(
'BRANCH SDK: Invalid "ios-team-release" in <b... | javascript | {
"resource": ""
} |
q28439 | train | function (successCB, failureCB, args, env) {
var result = new PluginResult(args, env);
var response = g11n.getInstance().InvokeMethod('getPreferredLanguage', args);
var data = JSON.parse(response);
console.log('getPreferredLanguage: ' + JSON.stringify(response));
if (data.error ... | javascript | {
"resource": ""
} | |
q28440 | train | function (successCB, failureCB, args, env) {
var result = new PluginResult(args, env);
var response = g11n.getInstance().InvokeMethod('getNumberPattern', args);
var data = JSON.parse(response);
console.log('getNumberPattern: ' + JSON.stringify(response));
if (data.error !== unde... | javascript | {
"resource": ""
} | |
q28441 | train | function (date, successCB, failureCB, options) {
argscheck.checkArgs('dfFO', 'Globalization.dateToString', arguments);
var dateValue = date.valueOf();
exec(successCB, failureCB, 'Globalization', 'dateToString', [{'date': dateValue, 'options': options}]);
} | javascript | {
"resource": ""
} | |
q28442 | train | function (currencyCode, successCB, failureCB) {
argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
exec(successCB, failureCB, 'Globalization', 'getCurrencyPattern', [{'currencyCode': currencyCode}]);
} | javascript | {
"resource": ""
} | |
q28443 | train | function(name, localURL, type, lastModifiedDate, size){
MediaFile.__super__.constructor.apply(this, arguments);
} | javascript | {
"resource": ""
} | |
q28444 | collectEventData | train | function collectEventData(element, eventType, touches, ev) {
// find out pointerType
var pointerType = ionic.Gestures.POINTER_TOUCH;
if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {
pointerType = ionic.Gestures.POINTER_MOUSE;
}
... | javascript | {
"resource": ""
} |
q28445 | train | function() {
if (keyboardHasPlugin()) {
window.removeEventListener('native.keyboardshow', debouncedKeyboardNativeShow );
window.removeEventListener('native.keyboardhide', keyboardFocusOut);
} else {
document.body.removeEventListener('focusout', keyboardFocusOut);
}
document.body.remov... | javascript | {
"resource": ""
} | |
q28446 | keyboardNativeShow | train | function keyboardNativeShow(e) {
clearTimeout(keyboardFocusOutTimer);
//console.log("keyboardNativeShow fired at: " + Date.now());
//console.log("keyboardNativeshow window.innerHeight: " + window.innerHeight);
if (!ionic.keyboard.isOpen || ionic.keyboard.isClosing) {
ionic.keyboard.isOpening = true;
io... | javascript | {
"resource": ""
} |
q28447 | keyboardFocusOut | train | function keyboardFocusOut() {
clearTimeout(keyboardFocusOutTimer);
//console.log("keyboardFocusOut fired at: " + Date.now());
//console.log("keyboardFocusOut event type: " + e.type);
if (ionic.keyboard.isOpen || ionic.keyboard.isOpening) {
ionic.keyboard.isClosing = true;
ionic.keyboard.isOpening = fal... | javascript | {
"resource": ""
} |
q28448 | keyboardOrientationChange | train | function keyboardOrientationChange() {
//console.log("orientationchange fired at: " + Date.now());
//console.log("orientation was: " + (ionic.keyboard.isLandscape ? "landscape" : "portrait"));
// toggle orientation
ionic.keyboard.isLandscape = !ionic.keyboard.isLandscape;
// //console.log("now orientation is... | javascript | {
"resource": ""
} |
q28449 | keyboardShow | train | function keyboardShow() {
ionic.keyboard.isOpen = true;
ionic.keyboard.isOpening = false;
var details = {
keyboardHeight: keyboardGetHeight(),
viewportHeight: keyboardCurrentViewportHeight
};
if (keyboardActiveElement) {
details.target = keyboardActiveElement;
var elementBounds = keyboardA... | javascript | {
"resource": ""
} |
q28450 | train | function(touches, timeStamp) {
var self = this;
// remember if the deceleration was just stopped
self.__decStopped = !!(self.__isDecelerating || self.__isAnimating);
self.hintResize();
if (timeStamp instanceof Date) {
timeStamp = timeStamp.valueOf();
}
if (typeof timeStamp !== "numb... | javascript | {
"resource": ""
} | |
q28451 | train | function(left, top, animate) {
var self = this;
if (!animate) {
self.el.scrollTop = top;
self.el.scrollLeft = left;
self.resize();
return;
}
var oldOverflowX = self.el.style.overflowX;
var oldOverflowY = self.el.style.overflowY;
clearTimeout(self.__s... | javascript | {
"resource": ""
} | |
q28452 | train | function() {
this.el = this.listEl = this.scrollEl = this.scrollView = null;
// ensure no scrolls have been left frozen
if (this.isScrollFreeze) {
self.scrollView.freeze(false);
}
} | javascript | {
"resource": ""
} | |
q28453 | train | function(isInstant) {
if (this._lastDragOp) {
this._lastDragOp.clean && this._lastDragOp.clean(isInstant);
this._lastDragOp.deregister && this._lastDragOp.deregister();
this._lastDragOp = null;
}
} | javascript | {
"resource": ""
} | |
q28454 | compilationGenerator | train | function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
var compiled;
if (eager) {
return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
}
return function lazyCompilation() {
... | javascript | {
"resource": ""
} |
q28455 | roundNumber | train | function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
var digits = parsedNumber.d;
var fractionLen = digits.length - parsedNumber.i;
// determine fractionSize if it is not specified; `+fractionSize` converts it to a number
fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(mi... | javascript | {
"resource": ""
} |
q28456 | train | function(scope, $element, attrs, ctrl, $transclude) {
var previousElement, previousScope;
scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {
if (previousElement) {
$animate.leave(previousElement);
}
if (previousScope) {
previousScope.$de... | javascript | {
"resource": ""
} | |
q28457 | run | train | function run() {
var template;
$ionicTemplateCache._runCount++;
hasRun = true;
// ignore if race condition already zeroed out array
if (toCache.length === 0) return;
var i = 0;
while (i < 4 && (template = toCache.pop())) {
// note that inline templates are ignored by this request
... | javascript | {
"resource": ""
} |
q28458 | checkInfiniteBounds | train | function checkInfiniteBounds() {
if (self.isLoading) return;
var maxScroll = {};
if (self.jsScrolling) {
maxScroll = self.getJSMaxScroll();
var scrollValues = self.scrollView.getValues();
if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||
(maxScroll.top !== -1 &... | javascript | {
"resource": ""
} |
q28459 | calculateMaxValue | train | function calculateMaxValue(maximum) {
var distance = ($attrs.distance || '2.5%').trim();
var isPercent = distance.indexOf('%') !== -1;
return isPercent ?
maximum * (1 - parseFloat(distance) / 100) :
maximum - parseFloat(distance);
} | javascript | {
"resource": ""
} |
q28460 | train | function(newWidth, newHeight) {
var requiresRefresh = self.dataLength && newWidth && newHeight &&
(newWidth !== self.width || newHeight !== self.height);
self.width = newWidth;
self.height = newHeight;
return !!requiresRefresh;
} | javascript | {
"resource": ""
} | |
q28461 | train | function(newData) {
var requiresRefresh = newData.length > 0 || newData.length < self.dataLength;
self.dataLength = newData.length;
return !!requiresRefresh;
} | javascript | {
"resource": ""
} | |
q28462 | toggleElements | train | function toggleElements() {
// convert arguments to array
var args = Array.prototype.slice.call(arguments);
args.forEach(function(buttonId) {
var buttonEl = document.getElementById(buttonId);
if (buttonEl) {
var curDisplayStyle = buttonEl.style.display;
... | javascript | {
"resource": ""
} |
q28463 | startCameraPreview | train | function startCameraPreview(takeCallback, errorCallback, selectCallback, retakeCallback) {
// try to select appropriate device for capture
// rear camera is preferred option
var expectedPanel = Windows.Devices.Enumeration.Panel.back;
Windows.Devices.Enumeration.DeviceInformation.findAllA... | javascript | {
"resource": ""
} |
q28464 | destroyCameraPreview | train | function destroyCameraPreview() {
capturePreview.pause();
capturePreview.src = null;
if (previewContainer) {
document.body.removeChild(previewContainer);
}
if (capture) {
capture.stopRecordAsync();
capture = null;
}
} | javascript | {
"resource": ""
} |
q28465 | train | function (successCallback, errorCallback) {
try {
createCameraUI();
startCameraPreview(function () {
// This callback called twice: whem video capture started and when it ended
// so we need to check capture status
i... | javascript | {
"resource": ""
} | |
q28466 | train | function (successCallback, errorCallback) {
try {
createCameraUI();
startCameraPreview(
// Callback for Take button - captures intermediate image file.
function () {
var encodingProperties = Windows.Media.MediaPr... | javascript | {
"resource": ""
} | |
q28467 | train | function () {
var encodingProperties = Windows.Media.MediaProperties.ImageEncodingProperties.createJpeg(),
overwriteCollisionOption = Windows.Storage.CreationCollisionOption.replaceExisting,
tempFolder = Windows.Storage.ApplicationData.curr... | javascript | {
"resource": ""
} | |
q28468 | train | function () {
var generateUniqueCollisionOption = Windows.Storage.CreationCollisionOption.generateUniqueName,
localFolder = Windows.Storage.ApplicationData.current.localFolder;
capturedPictureFile.copyAsync(localFolder, capturedPictureFile.nam... | javascript | {
"resource": ""
} | |
q28469 | run | train | function run(context) {
const preferences = configPreferences.read(context);
const platforms = context.opts.cordova.platforms;
platforms.forEach(platform => {
if (platform === IOS) {
iosPlist.addBranchSettings(preferences);
iosCapabilities.enableAssociatedDomains(preferences);
... | javascript | {
"resource": ""
} |
q28470 | writePreferences | train | function writePreferences(context, preferences) {
// read manifest
const manifest = getManifest(context);
// update manifest
manifest.file = updateBranchMetaData(manifest.file, preferences);
manifest.file = updateBranchReferrerTracking(manifest.file);
manifest.file = updateLaunchOptionToSingleT... | javascript | {
"resource": ""
} |
q28471 | getManifest | train | function getManifest(context) {
let pathToManifest;
let manifest;
try {
// cordova platform add android@6.0.0
pathToManifest = path.join(
context.opts.projectRoot,
"platforms",
"android",
"AndroidManifest.xml"
);
manifest = xmlHelper.readXmlAsJson(pat... | javascript | {
"resource": ""
} |
q28472 | train | function(file) {
this.fileName = "";
this.length = 0;
if (file) {
this.localURL = file.localURL || file;
this.length = file.size || 0;
}
// default is to write at the beginning of the file
this.position = 0;
this.readyState = 0; // EMPTY
this.result = null;
// Erro... | javascript | {
"resource": ""
} | |
q28473 | makeCallbackButton | train | function makeCallbackButton (labelIndex) {
return function () {
if (modalWindow) {
modalWindow.removeEventListener('unload', onUnload, false);
modalWindow.close();
}
// checking if prompt
var promptInput = modalDocument.getElementById... | javascript | {
"resource": ""
} |
q28474 | enableAssociatedDomains | train | function enableAssociatedDomains(preferences) {
const entitlementsFile = path.join(
preferences.projectRoot,
"platforms",
"ios",
preferences.projectName,
"Resources",
`${preferences.projectName}.entitlements`
);
activateAssociativeDomains(
preferences.iosProjectMod... | javascript | {
"resource": ""
} |
q28475 | activateAssociativeDomains | train | function activateAssociativeDomains(xcodeProject, entitlementsFile) {
const configurations = removeComments(
xcodeProject.pbxXCBuildConfigurationSection()
);
let config;
let buildSettings;
for (config in configurations) {
buildSettings = configurations[config].buildSettings;
build... | javascript | {
"resource": ""
} |
q28476 | removeComments | train | function removeComments(obj) {
const keys = Object.keys(obj);
const newObj = {};
for (let i = 0, len = keys.length; i < len; i++) {
if (!COMMENT_KEY.test(keys[i])) {
newObj[keys[i]] = obj[keys[i]];
}
}
return newObj;
} | javascript | {
"resource": ""
} |
q28477 | install | train | function install(context) {
// set properties
const q = context.requireCordovaModule("q");
var async = new q.defer(); // eslint-disable-line
const installFlagLocation = path.join(
context.opts.projectRoot,
"plugins",
context.opts.plugin.id,
INSTALLFLAGNAME
);
const depend... | javascript | {
"resource": ""
} |
q28478 | installNodeModules | train | function installNodeModules(modules, callback) {
// base case
if (modules.length <= 0) {
return callback();
}
// install one at a time
const module = modules.pop();
console.log(`BRANCH SDK: Installing node dependency ${module}`);
const install = `npm install --prefix ./plugins/${SDK}... | javascript | {
"resource": ""
} |
q28479 | getNodeModulesToInstall | train | function getNodeModulesToInstall(dependencies) {
const modules = [];
for (const module in dependencies) {
if (dependencies.hasOwnProperty(module)) {
try {
require(module);
} catch (err) {
modules.push(module);
}
}
}
return modules;
} | javascript | {
"resource": ""
} |
q28480 | showCameraDialog | train | function showCameraDialog (done, cancel, fail) {
var wv = qnx.webplatform.createWebView(function () {
wv.url = 'local:///chrome/camera.html';
wv.allowQnxObject = true;
wv.allowRpc = true;
wv.zOrder = 1;
wv.setGeometry(0, 0, screen.width, screen.height);
wv.backgroundC... | javascript | {
"resource": ""
} |
q28481 | saveImage | train | function saveImage(data, success, fail) {
var name = savePath + imgName();
require('lib/webview').setSandbox(false);
window.webkitRequestFileSystem(window.PERSISTENT, 0, function (fs) {
fs.root.getFile(name, { create: true }, function (entry) {
entry.createWriter(function (writer) {
... | javascript | {
"resource": ""
} |
q28482 | addAssociatedDomains | train | function addAssociatedDomains(preferences) {
const files = getEntitlementFiles(preferences);
for (let i = 0; i < files.length; i++) {
const file = files[i];
let entitlements = getEntitlements(file);
entitlements = updateEntitlements(entitlements, preferences);
setEntitlements(file, ent... | javascript | {
"resource": ""
} |
q28483 | getEntitlementFiles | train | function getEntitlementFiles(preferences) {
const files = [];
const entitlements = path.join(
preferences.projectRoot,
"platforms",
"ios",
preferences.projectName,
"Resources",
`${preferences.projectName}.entitlements`
);
files.push(
path.join(
preferenc... | javascript | {
"resource": ""
} |
q28484 | updateAssociatedDomains | train | function updateAssociatedDomains(preferences) {
const domainList = [];
const prefix = "applinks:";
const linkDomains = preferences.linkDomain;
for (let i = 0; i < linkDomains.length; i++) {
const linkDomain = linkDomains[i];
// add link domain to associated domain
domainList.push(pre... | javascript | {
"resource": ""
} |
q28485 | train | function () {
window.removeEventListener("focus", savePhotoOnFocus);
// call only when the app is in focus again
savePhoto(cameraPicture, {
destinationType: destinationType,
targetHeight: targetHeight,
targetWidth: targetWidth,
encodingType: encodi... | javascript | {
"resource": ""
} | |
q28486 | train | function (id, name, version, installed) {
this.id = id;
this.name = name;
this.installed = installed || false;
this.metadata = {
version: version
};
} | javascript | {
"resource": ""
} | |
q28487 | train | function (type, data, bNoDetach) {
var evt = createEvent(type, data);
if (typeof documentEventHandlers[type] !== 'undefined') {
if (bNoDetach) {
documentEventHandlers[type].fire(evt);
} else {
setTimeout(function () {
// Fire de... | javascript | {
"resource": ""
} | |
q28488 | train | function (callbackId, args) {
cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
} | javascript | {
"resource": ""
} | |
q28489 | train | function (callbackId, args) {
// TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative.
// Derive success from status.
cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
} | javascript | {
"resource": ""
} | |
q28490 | recursiveMerge | train | function recursiveMerge (target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
clobber(target.prototype, prop, src[... | javascript | {
"resource": ""
} |
q28491 | train | function (type, sticky) {
this.type = type;
// Map of guid -> function.
this.handlers = {};
// 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired.
this.state = sticky ? 1 : 0;
// Used in sticky mode to remember args passed to fire().
this.fireArgs = null;
// Used by onHasSubscribersC... | javascript | {
"resource": ""
} | |
q28492 | train | function (h, c) {
var len = c.length;
var i = len;
var f = function () {
if (!(--i)) h();
};
for (var j = 0; j < len; j++) {
if (c[j].state === 0) {
throw Error('Can only use join with sticky channels.');
}
c[j].subs... | javascript | {
"resource": ""
} | |
q28493 | handlePluginsObject | train | function handlePluginsObject (moduleList) {
// if moduleList is not defined or empty, we've nothing to do
if (!moduleList || !moduleList.length) {
return;
}
// Loop through all the modules and then through their clobbers and merges.
for (var i = 0, module; module = moduleList[i]; i++) { // ... | javascript | {
"resource": ""
} |
q28494 | createPromptDialog | train | function createPromptDialog (title, message, buttons, defaultText, callback) {
var isPhone = cordova.platformId === 'windows' && WinJS.Utilities.isPhone;
var isWindows = !!cordova.platformId.match(/windows/);
createCSSElem('notification.css');
var dlgWrap = document.createElement('div');
dlgWrap.... | javascript | {
"resource": ""
} |
q28495 | readXmlAsJson | train | function readXmlAsJson(file) {
let xmlData;
let xmlParser;
let parsedData;
try {
xmlData = fs.readFileSync(file);
xmlParser = new xml2js.Parser();
xmlParser.parseString(xmlData, (err, data) => {
if (!err && data) {
parsedData = data;
}
});
} catch (... | javascript | {
"resource": ""
} |
q28496 | writeJsonAsXml | train | function writeJsonAsXml(file, content, options) {
const xmlBuilder = new xml2js.Builder(options);
const changedXmlData = xmlBuilder.buildObject(content);
let isSaved = true;
try {
fs.writeFileSync(file, changedXmlData);
} catch (err) {
isSaved = false;
throw new Error(`BRANCH SDK:... | javascript | {
"resource": ""
} |
q28497 | relativeParts | train | function relativeParts (seconds) {
seconds = Math.abs(seconds);
var descriptors = {};
var units = [
'years', 86400 * 365,
'months', 86400 * 30,
'weeks', 86400 * 7,
'days', 86400,
'hours', 3600,
'minutes', 60
];
... | javascript | {
"resource": ""
} |
q28498 | prettyDate | train | function prettyDate (time, useCompactFormat, maxDiff) {
maxDiff = maxDiff || 86400 * 10; // default = 10 days
switch (time.constructor) {
case String: // timestamp
time = parseInt(time);
break;
case Date:
time = time.getTime();
break;
... | javascript | {
"resource": ""
} |
q28499 | resolve | train | function resolve(success, fail, path, fsType, sandbox, options, size) {
options = options || { create: false };
size = size || info.MAX_SIZE;
if (size > info.MAX_SIZE) {
//bb10 does not respect quota; fail at unreasonably large size
fail(FileError.QUOTA_EXCEEDED_ERR);
} else if (path.ind... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.