query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
This function provides a template for the PUSH operation for constants. The process flow is as follows: | function generateConstantPUSH(memoryAddress) {
return `
@${memoryAddress}
D=A
@SP
A=M
M=D
@SP
M=M+1
`;
} | [
"function PushPrimitiveReference(value) {\n return [PushPrimitive(value), op(31\n /* PrimitiveReference */\n )];\n}",
"push(val) {\n this._stack.push(val);\n }",
"function PushPrimitive(primitive) {\n let p;\n\n switch (typeof primitive) {\n case 'number':\n if (isSmallInt(primitive)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterate over the marked diagnostics for the given editor state, calling `f` for each of them. Note that, if the document changed since the diagnostics were created, the `Diagnostic` object will hold the original outdated position, whereas the `to` and `from` arguments hold the diagnostic's current position. | function forEachDiagnostic(state, f) {
let lState = state.field(lintState, false)
if (lState && lState.diagnostics.size)
for (
let iter = RangeSet.iter([lState.diagnostics]);
iter.value;
iter.next()
)
f(iter.value.spec.diagnostic, iter.from, iter.to)
... | [
"iterChangedRanges(f, individual = false) {\n iterChanges(this, f, individual)\n }",
"function indentRange(state, from, to) {\n let updated = Object.create(null)\n let context = new IndentContext(state, {\n overrideIndentation: (start) => {\n var _a\n return (_a = up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function allows the user to add the ID of the item they wish to add to. | function addToInventory() {
connection.query('SELECT * FROM products', function(err,res) {
if(err) throw err;
console.log(res);
inquirer.prompt([
{
type: 'input',
message: 'enter the Item Id you would like to add more to.',
name: 'addInvId'
}
]).then(function(inquireResponse) {
var id ... | [
"addItem(item) {\n let newItem = { ...item, id: uuidv4() }; //taking the existing item with only name and id coming from the form and adding an id field\n this.setState(state => ({\n items: [...state.items, newItem] //spread operator syntax, it sets items to be all the existing state items plus the new i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the header text matches what we expect after a column move. Shouldn't need to be called by itself. Call testUI() instead. | function testHeaderContainer(order) {
var headerString;
headerText.length = 0;
// Gather header texts.
Ext.Array.each(grid.getVisibleColumnManager().getColumns(), function (c) {
headerText.push(c.text);
});
// Prepend 'Field' to each number to mat... | [
"function testMainHeaderText() {\n let { document } = getTestPage();\n let mainheader = document.querySelector('.mainheader h1');\n\n assertEquals('Header text should be correct', 'DSP Full Stack Submission', mainheader.textContent);\n}",
"function i2uiCheckForAlignmentRow(tableid)\r\n{\r\n var headeritem ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate merge strategy, throwing an error if invalid. Assumes mergeStrategy is not undefined. | static _validateMergeStrategy(mergeStrategy) {
if (!MERGE_STRATEGIES.includes(mergeStrategy)) {
throw Error(
`Unrecognized mergeStrategy provided. Options are: [${MERGE_STRATEGIES}]`
);
}
} | [
"ensureValidAlgorithm () {\r\n if (this.supportedAlgorithms.includes(this.getAlgorithm())) {\r\n return\r\n }\r\n\r\n throw new Error(`Invalid algorithm. Supported algorithms: ${this.supportedAlgorithms}`)\r\n }",
"static _validateData(data, mergeStrategy) {\n // Data must be a plain (map-like) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List Scores from Database | function listScores() {
db.query(readTable, function(err, rows) {
if(err) {
throw err;
console.log('Listing failed');
} else {
for(var i; i < rows.length; i++) {
console.log(rows[i].username);
}
}
});
} | [
"displayScores() {\r\n for (let i = 1; i <= this.total; i += 1) {\r\n const data = this.data.get(i);\r\n const div = this.createContent(data.name, data.level, Utils.formatNumber(data.score, \",\"));\r\n\r\n div.className = \"highScore\";\r\n this.scores.appendChil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new ``int136`` type for %%v%%. | static int136(v) { return n(v, -136); } | [
"static uint136(v) { return n(v, 136); }",
"static uint176(v) { return n(v, 176); }",
"static int144(v) { return n(v, -144); }",
"static uint120(v) { return n(v, 120); }",
"static uint104(v) { return n(v, 104); }",
"static uint144(v) { return n(v, 144); }",
"static int176(v) { return n(v, -176); }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
url, callback => error?, resizeUrl? | function resizeUrlForUrl(url, callback) {
var encodedUrl = encodeURIComponentsForURL(removeProtocolFromURL(url))
console.log('encodedUrl')
console.log(encodedUrl)
request(`http://${config.get('googleProjectId')}.appspot.com/${encodedUrl}`, handleResize)
function handleResize(error, response, respon... | [
"function setShowImgSize(url, callback) {\n $('<img/>').attr('src', url).on('load', function() {\n var w = this.naturalWidth,\n h = this.naturalHeight,\n s = imgShowMaxSize;\n if (w > s || h > s) {\n if (w > h) {\n h = Math.floor(h * (s / w));\n w = s;\n } ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the production build and print the deployment instructions. | function build(previousSizeMap) {
console.log('Creating an optimized production build...');
webpack(config).run((err, stats) => {
if (err) {
printErrors('Failed to compile.', [err]);
process.exit(1);
}
if (stats.compilation.errors.length > 0) {
printErrors('Failed to compile.', stats.compilation.error... | [
"function build(previousSizeMap) {\n console.log('Creating an optimized production build...');\n webpack(config).run((err, stats) => {\n if (err) {\n printErrors('Failed to compile.', [err]);\n process.exit(1);\n }\n\n if (stats.compilation.errors.length) {\n printErrors('Failed to compile... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function contains the actual quantum computation part of the algorithm. It returns either the frequency of the function f or some integer multiple (where "frequency" is the number of times the period of f will fit into 2^numInputBits) | function determineFrequency(f) {
var qstate = new jsqubits.QState(numInBits + numOutBits).hadamard(inputBits);
qstate = qstate.applyFunction(inputBits, outBits, f);
// We do not need to measure the outBits, but it does speed up the simulation.
qstate = qstate.measure(outBits).newState;
return qstate... | [
"updateFrequency() {\n const freq = this.channel.frequencyHz;\n const block = this.channel.block;\n const fnum = this.channel.fnumber;\n // key scaling (page 29 YM2608J translated)\n const f11 = fnum.bit(10), f10 = fnum.bit(9), f9 = fnum.bit(8), f8 = fnum.bit(7);\n const n4 = f11;\n const n3 = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Window transparency Toggle window transparency recreates the window to toggle the transparent flag | function toggleWindowTransparency (isChecked) {
var windowBounds = null
settings.window.transparencyActive = isChecked
mb_options.transparent = isChecked
mb.setOption('transparent', isChecked)
windowBounds = mb.window.getBounds()
extend(mb_options, windowBounds)
recreateWindow()
attachWindowEvents()
... | [
"function toggleOverlay() {\n\tvar overlay = document.getElementById('overlay');\n\tvar inventoryWindow = document.getElementById('inventoryWindow');\n\toverlay.style.opacity = .7;\n\tif(overlay.style.display == \"block\"){\n\t\toverlay.style.display = \"none\";\n\t\tinventoryWindow.style.display = \"none\";\n\t} e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Change values in filter function / ============= END OF PARAMETERS ============= / Runs the experiment on spreadsheet of size `size` as specified by the mapping in `urls`. This is the main function to be called for running a trial of the experiment. | function experiment(size) {
var result = setFilter(urls[size]);
var results_sheet = SpreadsheetApp.openByUrl(RESULTS_URL).getSheetByName(SHEET_NAME);
writeToSheet(results_sheet, size, result);
} | [
"function setFilter(url) {\n var ss = SpreadsheetApp.openByUrl(url);\n // perform experiment on copy of spreadsheet\n // copy is added to \"Recent\", not to location of original spreadsheet\n var ss = ss.copy(ss.getName() + \"_\" + Date.now());\n var sheet = ss.getActiveSheet();\n var filterSettings = {};\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether this plugin is in dryRun mode. | isDryRun() {
return this.options.dryRun === true;
} | [
"get shouldNightModeStart() {\n const { score, nightMode } = this;\n const { DISTANCE } = GameScene.CONFIG.NIGHTMODE;\n return score > 0 && score % DISTANCE === 0 && !nightMode.isEnabled;\n }",
"get isSkipped() {\n return (this.flags & 2) /* NodeFlag.Skipped */ > 0\n }",
"function debugEna... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute and return the score for a match with e errors and x location. Accesses loc and pattern through being a closure. | function match_bitapScore_(e, x) {
var accuracy = e / pattern.length,
proximity = Math.abs(loc - x);
if (!Match_Distance) {
// Dodge divide by zero error.
return proximity ? 1.0 : accuracy;
}
return accuracy + (proximity / Match_Distance);
} | [
"match(word) {\n if (this.pattern.length == 0) return [-100 /* NotFull */]\n if (word.length < this.pattern.length) return null\n let { chars, folded, any, precise, byWord } = this\n // For single-character queries, only match when they occur right\n // at the start\n if (c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts text string to an image layer using position, scale and space between characters. | function textToImage(text, x, y, opt_args) {
var features = textToFeatures(text, x, y, opt_args)
var args = opt_args || {};
var filled = typeof args['filled'] == 'undefined' ? true : args['filled'];
var image = ee.Image(0).toByte();
if(filled) {
image = image.paint(features, 1); // paint fill
}
im... | [
"function drawImgText(elText) {\n drawImage(gCurrImg)\n}",
"function smiley_text(text, smiley_names, width)\r\n{\r\n var smiley_codes = new Array();\r\n for each (var smiley in smiley_names) // Filters valid smileys\r\n {\r\n if (smileys.hasOwnProperty(smiley))\r\n {\r\n smile... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
walmartSuggestionInstantiation creates a new instance of WalmartSuggestionInformation and created for consistency in the attachClickHandlers function | function walmartSuggestionInstantiation(){
const walmartAPI = new WalmartSuggestionInformation(); // make a new instance from the WalmartSuggestionInformation constructor
walmartAPI.getItemInformation(); // use the getItemInformation method to make the network request for the information.
} | [
"function newSuggestion(topicID) {\n console.log('New Suggestion function triggered with: ' + topicID);\n\n window.open(\"../html/suggestion.html?\" + topicID);\n}",
"function createSuggestion(req, res, next) {\n var suggestionData = req.body;\n var user = req.user;\n\n suggestionService.createSuggestion... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a binary tree, return all roottoleaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1>2>5", "1>3"] Explanation: All roottoleaf paths are: 1>2>5, 1>3 | function binaryTreePathsBFS(root) {
if (!root) return [];
const res = [];
const queue = [[root]];
while (queue.length) {
const current = queue.shift();
const lastNodeVisited = current[current.length - 1];
if (lastNodeVisited.left || lastNodeVisited.right) {
if (lastNodeVisited.left)... | [
"function ternary_tree_paths(root) {\n let res = [];\n if (root) dfs(root, [], res);\n return res;\n}",
"function ternary_tree_paths(root) {\n let res = [];\n if(root) dfs(root, [], res)\n return res;\n}",
"function getLoopsFromTree(root) {\n let trees = [root];\n let stack = Array.from(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sum an array of vectors | static vSum(arr) {
const reducer = (acc, cur) => {return {x: acc.x+cur.x, y: acc.y+cur.y}};
return arr.reduce(reducer, {x: 0, y: 0});
} | [
"function calculateSum(vectors){\n var sum = new THREE.Vector2();\n for (let i = 0; i < vectors.length; i++) {\n sum.x += vectors[i].x;\n sum.y += vectors[i].y;\n }\n return sum;\n}",
"function multiDimSum(arr) {}",
"function sumArrays(arrays) {\n var i,j,output = [];\n\n arrays.forE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a message to the Verity Application Service via the Verity REST API | async function sendVerityRESTMessage (qualifier, msgFamily, msgFamilyVersion, msgName, message, threadId) {
// qualifier - either 'BzCbsNYhMrjHiqZDTUASHg' for Aries community protocols or '123456789abcdefghi1234' for Evernym-specific protocols
// msgFamily - message family (e.g. 'present-proof')
// msgFamilyVersi... | [
"function sendRenewLifeWelcomeMsg(recipientId) {\n var messageData = {\n recipient: {\n id: recipientId\n },\n message: {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"button\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the west layout options | function getWestLayoutOptions() {
return { // menu selection
size: 175,
minSize: 150,
maxSize: 300,
resizable: true,
spacing_open: 5, // cosmetic spacing
spacing_closed: 21, // wider space when closed
... | [
"function getEastLayoutOptions() {\n return { // menu selection\n size: 175,\n minSize: 150,\n maxSize: 300,\n spacing_open: 5, // cosmetic spacing\n spacing_closed: 0, // wider space when closed\n togglerLength_clo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Likes and dislikes acomment Parameters : int id, int comment_id, HTMLElement element Return : none | function likeComment(id, comment_id, element) {
if(jQuery(element).parents('[data-id]').hasClass('liked')) {
// Dislike comment
jQuery(element).parents('[data-id]').removeClass('liked');
// Decrease number of likes
var likes = parseInt(jQuery(element).children('span').html(... | [
"function answerComment(type, id, comment_id, element) {\r\r\n var content = jQuery(element).siblings('textarea').val();\r\r\n jQuery.post(\r\r\n swapchic_ajax.ajax_url,\r\r\n {\r\r\n 'action': 'ajaxAnswerComment',\r\r\n 'post_id': id,\r\r\n 'comment_id': comment... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a bloom filter at location `idx` in `array` into binary representation. | function toBloom(array, idx) {
return `${binary(array, idx + 7)}_${binary(array, idx + 6)}_${binary(array, idx + 5)}_${binary(array, idx + 4)}_${binary(array, idx + 3)}_${binary(array, idx + 2)}_${binary(array, idx + 1)}_${binary(array, idx + 0)}`;
} | [
"function dec2bin_array(array,no_of_variables)\n{\n\tvar bin_array = [];\n\tfor (var i = 0; i < array.length; i++)\n\t{\n\t\tbin_array.push(dec2bin(array[i]));\n\t}\n\tfix_size(bin_array,no_of_variables);\n\treturn bin_array;\n}",
"function encode_arr(arr) {\n var arr_out = []\n for (let i of arr) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Closes the activity and resets its fields. | close() {
// Pop the activity from the stack
utils.popStackActivity();
// Hide the disclaimer
this.disclaimer.scrollTop(0).hide();
// Hide the screen
this.screen.scrollTop(0).hide();
// Reset the fields
$("#field--register-email").val("");
$("#... | [
"function resetActivity() {\n displayActivity(MESSAGE);\n }",
"@action closeDialog() {\r\n\t\tif (this.dialog) this.dialog.opened = false;\r\n\t}",
"close() {\n this.showModal = false;\n\n this.onClose();\n }",
"close() {\n // _close will also be called later from the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the "Virus adds" (1. task) | function removeVirus(){
const sponsorsDiv = document.querySelector('.promo__adv');
const sponsorsAdds = sponsorsDiv.getElementsByTagName('img');
for(let i = sponsorsAdds.length - 1; i >= 0 ; i--){
sponsorsAdds[i].remove();
}
} | [
"function removeKVS() {\r\n\ttry {\r\n\t\tlogger.warn('removing older kvs and trying to enroll again');\r\n\t\tmisc.rmdir(helper.getKvsPath({ going2delete: true }));\t\t\t//delete old kvs folder\r\n\t\tlogger.warn('removed older kvs');\r\n\t} catch (e) {\r\n\t\tlogger.error('could not delete old kvs', e);\r\n\t}\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ENGINESHELL INIT FUNCTION "elRoot" :> DOM Element reference where the engine should paint itself. "params" :> Startup params passed by platform. Include the following sets of parameters: (a) State (Initial launch / Resume / Gradebook mode ). (b) TOC parameters (videoRoot, contentFile, keyframe, layout, etc.). "adaptor"... | function init(elRoot, params, adaptor, htmlLayout, jsonContentObj, callback) {
/* ---------------------- BEGIN OF INIT ---------------------------------*/
//Store the adaptor
activityAdaptor = adaptor;
//Clone the JSON so that original is preserved.
var jsonContent = ... | [
"function ksfHelp_mainTourInit()\n{\n\tksfHelp_mainTour.init();\n\tksfHelp_mainTour.start();\n}",
"function demoInitialize() {\n document.title = \"Visia\"\n // create the demo instance\n var demo = new Demo()\n demo.init()\n // register the callback that is called when all module contexts are created\n MLA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the configuration options for locking the ngcc process. | getLockingConfig() {
let { retryAttempts, retryDelay } = this.projectConfig.locking;
if (retryAttempts === undefined) {
retryAttempts = this.defaultConfig.locking.retryAttempts;
}
if (retryDelay === undefined) {
retryDelay = this.defaultConfig.locking.retryDelay;
... | [
"get options() {\n if (typeof MI === 'undefined') {\n window.MI = { options: {} };\n }\n const { options } = MI;\n return options;\n }",
"function getOptions() {\n var options = {},\n cProp,\n gOption; // update grapher options from component spec & defaults\n\n for (cProp in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fill the parent with the labels and canvases to display the specified waveforms and their labels. | makeWaveforms(parent, waveformDisplay, sampleSets) {
clearElement(parent);
const zoomControls = document.createElement("div");
zoomControls.appendChild(waveformDisplay.makeZoomControls());
parent.appendChild(zoomControls);
for (const sampleSet of sampleSets) {
let lab... | [
"draw() {\n for (const waveform of this.waveforms) {\n this.drawInCanvas(waveform.canvas, waveform.samples);\n }\n }",
"addCanvases(waveCanvas) {\n this.wave_canvas = waveCanvas;\n this.miniWave_wrapper.appendChild(waveCanvas.mainWave_canvas);\n this.setCanvasStyle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Carica la tabella delle ritenute a partire dalla lista fornita. | function caricaTabellaRitenute(lista, flagEditabilitaRitenute) {
var options = {
bServerSide: false,
bPaginate: false,
bLengthChange: false,
iDisplayLength: 5,
bSort: false,
bInfo: true,
bAutoWidth: true,
bFilter: fa... | [
"function listarRepartidores(){\n vm.listaRepartidores = servicioUsuarios.obtenerRepartidores();\n }",
"function _renderKurswahlListeTausch(){\n var sKurstypID=''; // sammelt bereits abgehandelte KurstypIDs.\n var sKurstypenMitTauschoption = $('#kurstypen_mit_tauschoption').val();\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the target specified by a user through the target search dropdown, set the selected_target variable and highlight the corresponding target elements | function targetSearchInput() {
piwikTracker.trackPageView('Set target for search');
if (selected_target != undefined) {
highlightNode(selected_target, "selected-target", false, true);
clearSearchResult();
if (selected_local_node_1 !== undefined) { svg.select("#arc-" + selected_local_node... | [
"highlightSelected() {\n\n this.highlighter.setPosition(this.xStart + this.selected * this.distance, this.yPosition + this.highlighterOffsetY);\n\n }",
"onTargetProviderChange() {\n this.selectedTarget = undefined;\n this.clearTargetSearch();\n }",
"function selectSelectableElement (selectableC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open a the menu as a submenu using the item node for positioning. | function openSubmenu(menu, item) {
// mount far offscreen for measurement
var node = menu.node;
var style = node.style;
style.visibility = 'hidden';
menu.attach(document.body);
menu.show();
// compute the adj... | [
"function open_menu(parent) {\n // Hide all the menus.\n $('.megamenu-bin').removeClass('displayed');\n $('.megamenu-bin').hide();\n $('.megamenu-parent').removeClass('displayed');\n // Remove the active-trail class, so that non-hovered menu parents don't show the ^.\n $('.megamenu-parent.active-t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a dropdown menu string with all types supported NOTE: We don't need a dim because only one dim can have types (typesInDim) ind = column/row index for which this string generated (or rowTypes) selected_index = the already selected index | function getTypeSelectStr(ind, selected_index, htmlId) {
str = "<select onchange='changeType(this," + ind + ",\"" + htmlId +
"\")'>";
for (var i = 0; i < TypesArr.length; i++) {
str += "<option value='" + i + "' ";
if (i == selected_index)
str ... | [
"function renderTypeOptions(overlay, currentType, datatypes) {\n var selectedFound = false;\n for (var i = 0; i < datatypes.length; i++) {\n var selected = '';\n if (datatypes[i] == currentType && !selectedFound) {\n selected = ' selected';\n selectedFound = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new editor model. You can specify the language that should be set for this model or let the language be inferred from the `uri`. | function createModel(value, language, uri) {
value = value || '';
if (!language) {
var path = uri ? uri.path : null;
var firstLF = value.indexOf('\n');
var firstLine = value;
if (firstLF !== -1) {
firstLine = value.substring(0, firstLF);
}
return doCre... | [
"function setModelLanguage(model, language) {\n __WEBPACK_IMPORTED_MODULE_5__standaloneServices_js__[\"b\" /* StaticServices */].modelService.get().setMode(model, __WEBPACK_IMPORTED_MODULE_5__standaloneServices_js__[\"b\" /* StaticServices */].modeService.get().getOrCreateMode(language));\n}",
"static of(spec)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes array indeces and returns string denoting the equivalent algebraic notation location. posRow (number): row value for 2d array OR an array of 2 numbers posCol (number): column value for 2d array OR undefined if posRow was an array of numbers containing both the row and col. Translates indeces such as 4,0 into the ... | indecesToAlgebraic(posRow, posCol){
let alphaCols = 'abcdefgh';
if(typeof posRow !== 'number'){//} && posCol === undefined){
[posRow,posCol] = posRow;
}
let row = 8 - posRow; //TODO fix this weakness
// if(this.boardSize !== undefined){
// let row = this.boardSize - posRow;
//... | [
"getPositionStringForIndex (index) {\n let { row, column } = this.getCoordinates(index)\n const number = Math.abs(row - 7) + 1\n const letter = String.fromCharCode(97 + column)\n return `${letter}${number}`\n }",
"function getIndExprStr(expr) {\r\n return expr2str(expr);\r\n}",
"algerbraicToInde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the input policy's init method to increment a _initCalled counter to track the number of times init is called. | function decorateInitWithCounter(policy) {
const baseInit = policy.init;
policy._initCalled = 0;
policy.init = function () {
policy._initCalled++;
baseInit.apply(policy, arguments);
};
return policy;
} | [
"init_() {\n this.passSharedData_();\n this.syncRemoteConsentState_();\n this.maybeSetUpTcfPostMessageProxy_();\n\n this.getConsentRequiredPromise_()\n .then((isConsentRequired) => {\n return this.initPromptUI_(isConsentRequired);\n })\n .then((isPostPromptUIRequired) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the control points. Regarding to the actual part of the letter. | function LetterB_drawControlPoints() {
alert("letterB: draw control points");
// draw all control points
for ( var i = 0; i < this.pt_control_x.length; i++) {
drawControlPoint(this, i, 0);
}
} | [
"function LetterB(n, r, w, x, y, messageDiv) {\n\tthis.name = n;\n\talert(\"Letter \" + n + \" initalized!\");\n\tthis.messageDiv = messageDiv;\n\n\tthis.canvas = document.getElementById('paint');\n\tthis.ctx = canvas.getContext('2d');\n\n\tthis.start = false;\n\tthis.control = false;\n\tthis.controlNr = new Array(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new FPSCounter / private | constructor()
{
this._fps = 60;
this._frames = 0;
this._updateInterval = UPDATE_INTERVAL;
this._lastUpdate = performance.now();
this._boundUpdate = this._update.bind(this);
// this should never happen...
if(instance !== null)
throw new _errors__WE... | [
"static init()\n {\n let aeFDC = Component.getElementsByClass(document, PCx86.APPCLASS, \"fdc\");\n for (let iFDC = 0; iFDC < aeFDC.length; iFDC++) {\n let eFDC = aeFDC[iFDC];\n let parmsFDC = Component.getComponentParms(eFDC);\n let fdc = new FDC(parmsFDC);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an EventSubscription which wraps the DEVICE_CONNECTED event type. | onDeviceConnected(listener) {
return this.createBluetoothEventSubscription(BluetoothEventType.DEVICE_CONNECTED, listener);
} | [
"onDeviceDiscovered(listener) {\n return this.createBluetoothEventSubscription(BluetoothEventType.DEVICE_DISCOVERED, listener);\n }",
"function SubscribeBluetoothDevice()\r\n{\r\n PrintLog(1, \"BT: SubscribeBluetoothDevice()\" );\r\n\r\n // Version 1.0.2 of the plugin\r\n var paramsObj = {\"add... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iterate over key crossproduct, create cells as needed | function generate(base, tuple, index) {
var name = dims[index],
v = vals[index++],
k, key$$1;
for (k in v) {
tuple[name] = v[k];
key$$1 = base ? base + '|' + k : k;
if (index < n) generate(key$$1, tuple, index);
else if (!curr[key$$1]) aggr.cell(key$$1, tuple);
}
} | [
"generateState() {\n const rows = this.props.row;\n const columns = this.props.column;\n const data = {};\n for (let i = 0; i <= rows; i += 1) {\n for (let j = 0; j <= columns; j += 1) {\n const key = this.generateKey(i, j);\n if (i === 0 || j === 0) {\n const val = i || this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uncomment when ready to test Write a function that will print the name of the student and their average test score Example printAverageGrade(students3) Anthony 61.333333333333336 Winnie 72.66666666666667 Pawandeep 73.33333333333333 | function printAverageGrade(students) {
//your code here...
for (let i = 0; i < students.length; i++) { //iterates through students
// console.log(students[i]["name"],students[i]["grades"] );
let student = students[i];
let grades = student.grades;
// let bestGrade = grades[0].scor... | [
"function printAverageGrades(students) {\n for (var i = 0; i < students.length; i++) {\n var student = students[i];\n var averageGrade = getAverageGrade(student.grades);\n\n console.log(student.name, averageGrade);\n }\n}",
"function printBestStudent(students) {\n //your code here...... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render([renderTarget,[forceClear]) Usage : render the plot renderTarget : target if the render if other than screen forceClear : boolean asking the renderer to clear the output before rendering. Default: false / render plot | render (renderTarget, forceClear){
this.context.clearRect(
0,
0,
this.canvas.width,
this.canvas.height
) ;
this.context.drawImage(
this.bcanvas,
0,
0,
this.canvas.width,
this.canvas.height... | [
"function redraw() {\n\n\t\t\t// hide tooltip and hover states\n\t\t\tif (tracker.resetTracker) {\n\t\t\t\ttracker.resetTracker();\n\t\t\t}\n\n\t\t\t// render the axis\n\t\t\trender();\n\n\t\t\t// move plot lines and bands\n\t\t\teach(plotLinesAndBands, function(plotLine) {\n\t\t\t\tplotLine.render();\n\t\t\t});\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Button event from own component happens when the 'Cut Video' button is clicked | handleCutVideo() {
let self = this;
// send event to parent that our task is starting
self.props.onTaskStart( { taskName : 'Cut Video' } );
let msg = { edl : this.edl.rawData() };
cutVideo( msg,function(progress) {
// send event to parent that our progress has upda... | [
"uploadClick (){\n this.upload.click();\n }",
"handleClick (event) {\n minusSlides(1);\n }",
"function video_click(e) {\n\t//console.log(e);\n\t//console.log(this);\n\tif (this.paused == true) {\n\t\tthis.play();\n\t} else {\n\t\tthis.pause();\n\t}\n}",
"function mousePressed() {\n if (mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively merges the payload object into the target object. Arrays are not supported. | function merge(target, payload){
// payload overrides target
for (var i in payload) {
if (payload.hasOwnProperty(i)) {
// if either side is a primitive, clobber
// otherwise merge
if (typeof target[i] == "boolean" ||
typeof target[i] == "number" ... | [
"function recursiveMerge(target, src) {\n for (var prop in src) {\n if (src.hasOwnProperty(prop)) {\n if (target.prototype && target.prototype.constructor === target) {\n // If the target object is a constructor override off prototype.\n clobber... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checking if element for page | function isOnPage(selector) {
return ($(selector).length) ? $(selector) : false;
} | [
"inDOM() {\n\t\t\treturn $(Utils.storyElement).find(this.dom).length > 0;\n\t\t}",
"function checkPage() {\r\n\r\n var page = $('#scroll-content').data('page');\r\n\r\n if(page == \"scroll-content\") {\r\n headerSticky();\r\n }\r\n\r\n }",
"async isCorrectP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs each test in testsQueue to build assertionsQueue. | function runTests(){
var len = testsQueue.length;
while(testsQueueIndex < len && !testIsRunning){
currentTestHash = testsQueue[testsQueueIndex];
currentTestStep = 0;
testIsRunning = true;
runTest();
}
if(testsQueueIndex === len){
... | [
"function runAssertions(){\n var i,\n len,\n item;\n //Show totals for groups, test, assertions before running the tests.\n showTotalsToBeRun();\n //A slight delay so user can see the totals and they don't flash.\n setTimeout(function(){\n //Synchr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======= OUTPUTS ======= Create function that will check if the outputs can be computed | function canCompute(inputs) {
// Exit function if any value in inputs is 0
for (const key in inputs) {
if (inputs[key] === 0) {
return;
}
}
// Run the computeTip function
computeTip(inputs);
} | [
"function monitorSupportsOutputValues() {\n return __awaiter(this, void 0, void 0, function* () {\n return monitorSupportsFeature(\"outputValues\");\n });\n}",
"function haveOutputErr() {\n return OUTPUT_ERROR;\n}",
"hasOutput(logicalId, props) {\n const matchError = (0, outputs_1.hasOutp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
task.8 Write a function that calculates a number of appearances of a given number in a given array. | function numOfAppear(a, array) {
var i;
var n = 0;
for (i = 0; i < array.length; i++) {
if (array[i] == a) {
n++;
}
}
return n;
} | [
"function countNum (array) {\n\tvar uniqueArr = [];\n\tfor (i=0; i<=uniqueNumbers.length - 1; i++){\n\t\tvar count = array.filter (function (n) {\n\t\t\treturn n === uniqueNumbers [i];\n\t\t})\n\t\tuniqueArr.push (count.length);\n\t}\n\treturn uniqueArr;\n}",
"function countNumber(arrayOfNumbers,number){\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new instance CylinderDirectedParticleEmitter | function CylinderDirectedParticleEmitter(radius,height,radiusRange,/**
* The min limit of the emission direction.
*/direction1,/**
* The max limit of the emission direction.
*/direction2){if(radius===void 0){radius=1;}if(height===void 0){height=1;}if(radiusRange===void 0){radiusRange... | [
"function CylinderParticleEmitter(/**\n * The radius of the emission cylinder.\n */radius,/**\n * The height of the emission cylinder.\n */height,/**\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\n */radiusRange,/**\n * How much to randomize... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================= struct TPremise p, double tStep | function evaluatePremise(p, tStep)
//
// Input: p = a control rule premise condition
// tStep = current time step (days)
// Output: returns true if the condition is true or false otherwise
// Purpose: evaluates the truth of a control rule premise condition.
//
{
let lhsValue, rhsValue;
let re... | [
"function Step(props) {\n return __assign({ Type: 'AWS::EMR::Step' }, props);\n }",
"getPhases (step) {\n\t\tstep = step % this.getTotalStepCount();\n\t\tlet ret = this.getPhaseMultipliers();\n\t\tlet mul = step / this.steps;\n\t\tfor (let i in ret)\n\t\t\tret[i] = (ret[i] * mul) - Math.floor(re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles and dispatches a command's events and routes them to plugin accordingly. If it handles the event, returns true; | handleCommandEvent (e) {
if (e == null || e.target == null) { return false }
var target = $(e.target)
var parent = target.parent()
var isCommand = parent.hasClass(Constants.commandClassName)
var eventType = e.type
if (eventType === 'click' && isCommand) {
var commandId = parent.attr('data-... | [
"function commandTrigger() {\n var line = promptText;\n if (typeof config.commandValidate == 'function') {\n var ret = config.commandValidate(line);\n if (ret == true || ret == false) {\n if (ret) {\n handleCommand();\n }\n } else {\n commandResul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is the function to display the message line by line | function lineByLine(array){
for(var i = 0; i < message.length; i++){
var ele = document.createElement("div");
ele.innerHTML = message[i];
resultEle.appendChild(ele);
}
} | [
"function displayMessage(array){\n message = []\n for(var i = 0; i < animals.length; i++){\n if(animals[i] === \"dog\"){\n message.push(\"Borf Borf\");\n }\n else if(animals[i] === \"cat\"){\n message.push(\"I am a cat\");\n }\n else{\n message.push(\"I'm an aminal\");\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper functions //////////////// This is a 1:1 copy of the same section in streaming_source.js delay_ms(ms) can be awaited and just resolves after ms milliseconds | async function delay_ms(ms) {
return new Promise( (resolve)=> { setTimeout( resolve , ms) } );
} | [
"function runAfterDelay(delay,callback){\n console.log('(Exercise 7).Wait for '+delay+' secs....'); \n callback(delay);\n }",
"function Delay(/* duration, exp* */) {\n var duration = arguments[0];\n var exps = slice_args(arguments, 1);\n precondition_arg_list(exps);\n exps.unshift(Apply(Timeout,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update local version of album (save will be fired only on Save action) | function updateAlbumLocally (text)
{
setUpdatedAlbum({...updatedAlbum, name : text, updated : true});
} | [
"static addAlbum(album) {\n const albums = Storage.getAlbums();\n\n albums.push(album);\n\n localStorage.setItem('albums', JSON.stringify(albums));\n }",
"updateSong(){\n return new Promise( (resolve, reject) => {\n this.player.getCurrentRemoteMeta( ({result}) => {\n if(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for adding new skills. Appends the entire element with the skill dropdown inside. Takes "parent", "rating" and "index at rating" (thus, the second Good skill will take 3,1). Or, while looping through slots, [i][j]. | function makeNewSkill (par,i, j) {
//Add space-breaking elements.
if ((j%3) == 0) {
//If it's a multiple of three, add two BRs.
par.appendChild( document.createElement('br') );
par.appendChild( document.createElement('br') );
}
else {
//Otherwise, just need a space.
par.append(" ");
}
/... | [
"function addSkill()\n{\n var count = document.getElementById(\"skill-count\");\n var it = count.getAttribute(\"value\");\n if (it >= 8) {\n alert(\"You have reached maximum number of skills\");\n return;\n }\n count.setAttribute(\"value\", ++it);\n\n mainDiv = document.getElementByI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setRecordingStatus(recording) : set this.recording | setRecordingStatus(recording){
this.recording = recording ;
} | [
"start(){\n this.recording = true ;\n }",
"updateRecordingState(recordingState) {\n // I'm the recorder, so I don't want to see any UI related to states.\n if (config.iAmRecorder)\n return;\n\n // If there's no state change, we ignore the update.\n if (!recordingSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the avr input selection. | _getAVRInputSelection() {
this._selectInputSource("i_request");
} | [
"selectInputSourceTuner() {\n this._selectInputSource(\"i_tuner\");\n }",
"selectInputSourceUsbIpod() {\n this._selectInputSource(\"i_usb_ipod\");\n }",
"selectInputSourceDvd() {\n this._selectInputSource(\"i_dvd\");\n }",
"selectInputSourceBluetooth() {\n this._selectInpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wait until a media source is loaded | function waitMediaToLoad(mediaSource, timeout = 30000)
{
// a promise that resolves as soon as the media is loaded
const waitUntil = eventName => new Promise((resolve, reject) => {
_utils_utils__WEBPACK_IMPORTED_MODULE_3__["Utils"].log(`Loading media ${mediaSource} ...`);
const timer = setTimeo... | [
"load(){\n console.debug(\"Loading\", this.id);\n for (let i = 0; i < this.mediaSourceListeners.length; i++) {\n if(typeof this.mediaSourceListeners[i].load === 'function')this.mediaSourceListeners[i].load(this);\n }\n if (this.element !== undefined) {\n return true... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
utility fonction get add request for the userAsking and userAsked | function getInvitationRequestFor(userAsking, userAsked) {
var addRequest = {};
invitationRequestDb.forEach(function(relation) {
if(relation.userAskingId === userAsking && relation.userAskedId === userAsked){
addRequest = relation;
}
}, this);
return addRequest;
} | [
"function getQuestionAndAnswersByUsername(req,res)\n{\n return onlyBy(req, 'username', true) && checkTable(req,'question_and_answer')\n}",
"requested(userId) {\n return this.getList(userId, STATE_KEY.requested);\n }",
"function onBtnAskClick(e) {\n e.preventDefault();\n \n // find out which of t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Nombre: cargar Parametros: partidaGuardada Retorna: Descripcion: Carga la partida de un fichero json | function cargar(partidaGuardada)
{
if(partidaGuardada.hasOwnProperty("tipoJuego"))//comprobamos que sea un objeto correcto con los datos que nos interesa
{
$("#tablero").empty();
numeroCelulas = partidaGuardada.numeroCelulas;
vecino = partidaGuardada.vecino;
partida = new juego(partidaGuardada.tipoJuego, null... | [
"function cargarDatos(){\n\n\tconsole.log(\"Cargando registro...\")\n\tfs.readFile('../personajes/partidas/registros.json', (err, data) => {\n\t\tif (!err){ //fichero existe\n\t\t\tregistro = JSON.parse(data);\n \t }\n\t\n\t});\n\tconsole.log(\"Registro Cargado\");\n\tconsole.log('Cargando personajes...');\n\tf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a `nackAll` to the underlying channel. | nackAll() {
return this._channel && this._channel.nackAll.apply(this._channel, arguments);
} | [
"ack(message_id) {\n this.sendCommand('ACK', {'id': message_id});\n this.log.debug(`acknowledged message: ${message_id}`);\n }",
"sendLoop() {\n\n while (this.sends.length > 0) {\n // TODO: Need to actually do resends for my own packets. This is related\n // if (this.packetsSen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the multi user rotation to this cluster. | addRotationMultiUser(id, options) {
var _a;
if (!this.secret) {
throw new Error('Cannot add multi user rotation for a cluster without secret.');
}
return new secretsmanager.SecretRotation(this, id, {
...options,
excludeCharacters: (_a = options.exclude... | [
"'addUserRole'(userid, role)\n {\n Roles.addUsersToRoles(userid,role);\n\n\n }",
"function UserToGroupAddition(props) {\n return __assign({ Type: 'AWS::IAM::UserToGroupAddition' }, props);\n }",
"startRotation() {\n this._options.rotation.enable = true;\n }",
"rotate() {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lowest Temperature Calculation /Lowest Temperature Calculation | function calculateLowestTemp() {
var lowTemp = 1111111111111;
for (var l = 0; l < $scope.data2.length; l++) {
if ($scope.data2[l].y < lowTemp) {
lowTemp = $scope.data2[l].y;
}
}
return lowTemp.toFixed(2);
} | [
"low() {\n let mark = Object.values(marks[0]).map(element => {\n return parseInt(element);\n });\n return Math.min(...mark);\n }",
"min() {\n const values = this.$checkAndCleanValues(this.values, \"min\");\n let smallestValue = values[0];\n for (let i = 0; i < values.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Undo the effect of the preceding call to the get method. A call to this method MUST be immediately preceded and immediately followed by a call to get. Only used during mode switching, i.e. after one token was got in the old mode but should get got again in a new mode with possibly different whitespace handling. | unget(token) {
this.stack.push(token);
while (this.discardedWhiteSpace.length !== 0) {
this.stack.push(this.discardedWhiteSpace.pop());
}
} | [
"function peek() {\n return tokens[position];\n }",
"reset() {\n this.authenticated = false;\n this.token = null;\n this.history = map();\n }",
"function _revertToPreviousContext() {\n if(!this.previousContext) {\n return this;\n }\n return this.previousContext.clone();\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates the `debug` property at config and use it to set the logger. | function validateLogger(settings) {
var debug = settings.debug;
var logLevel = initialLogLevel;
if (debug !== undefined) {
if (isLogger(debug))
return debug;
logLevel = (0, commons_1.getLogLevel)(settings.debug);
}
var log = new logger_1.Logger({ logLevel: logLevel || ini... | [
"constructor(debugEnabled) {\n /** The flag that enables or disables logging for this debug group. */\n this.debugEnabled = false;\n this.debugEnabled = debugEnabled;\n }",
"function setLogger(argv) {\n logger.level = argv.debug ? 'debug' : argv.verbose ? 'verbose' : 'info';\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validation functions validate Captcha | function validatecaptcha() {
var cap = $("#captcha").val();
var cap_hd = $("#hd_cap").val();
if (cap != cap_hd) {
$("#captcha").addClass("error");
$("#captchaInfo").text("Enter a valid security code\n");
$("#captchaInfo").addClass("error_message_side");
... | [
"function checkform(){\nvar why = \"\";\n\nif(document.forms[\"signupform\"][\"CaptchaInput\"].value == \"\"){\nwhy += \"- Please Enter CAPTCHA Code.\\n\";\n}\n\nif(document.forms[\"signupform\"][\"CaptchaInput\"].value != \"\"){\nif(ValidCaptcha(document.forms[\"signupform\"][\"CaptchaInput\"].value ) == false){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clone an existing view wrapper as the basis for our display. | cloneView(aViewWrapper) {
this.view = aViewWrapper.clone(this);
// generate a view created notification; this will cause us to do the right
// thing in terms of associating the view with the tree and such.
this.onCreatedView();
if (this._active) {
this.makeActive();
}
} | [
"copy() {\n const copy = new Grid(this.size);\n copy.grid = copyBoard(this.grid);\n return copy;\n }",
"clone(){\n\t\treturn new AnimatedMesh(\n\t\t\tthis.state \n\t\t);\n\t}",
"cloneListing() {\n const clone = this.clone();\n clone.unset('slug');\n clone.unset('hash');\n clone.guid = this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use ajax post to send object to server display "caculating" message call retrieveResult after 3 seconds | function postCalcObject(calcObject) {
$.ajax({
type: "POST",
url: "/calculate/" + calcObject.x + "/" + calcObject.y + "/" + calcObject.type,
data: calcObject,
success: function(response) {
calcMsgTimer = setInterval(retrieveResult, 3000);
displayValue("CALCULATING...");
}
});
} | [
"function submitMove(ev){\n ev.preventDefault();\n var form = $(\"#commandForm\");\n $.ajax({\n timeout:3000,\n type: form.attr('method'),\n url: form.attr('action'),\n data: form.serialize(),\n dataType: 'html',\n success: function(data){\n ev.preventDefault();\n $(data).fadeIn(\"slo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get All Gift Cards | function GetAllGiftCards() {
return $resource(_URLS.BASE_API + 'homegiftcard' + _URLS.TOKEN_API + $localStorage.token).get().$promise;
} | [
"ListOfCreditCards() {\n let url = `/me/paymentMean/creditCard`;\n return this.client.request('GET', url);\n }",
"function allCards(){\n createFile();\n var data = fs.readFileSync('deck.json');\n var dataParsed = JSON.parse(data);\n var keys = dataParsed[Object.keys(dataParsed)[0]];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extendConnections() increases length of links from seed according to selection.connections | function extendConnections() {
for (var iteration = 0; iteration < selection.connections; iteration++) {
var nodesCopy = [];
summaryNodes.forEach(function (d){nodesCopy.push(d);});
for (var i = 0; i < selection.network.links.length; i++) { // for each link {
var subjectFound = findNode(selection.networ... | [
"updateConnectionWeight () {\n if (!this.connections.length) { return false }\n this.connections[Math.floor(Math.random() * this.connections.length)].weight = Math.random()\n }",
"_addLink(r1, r2) {\n this.elements.push({\n group: \"edges\",\n data: {\n id: `${r1.id}_${r2.id}`,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disable listening for inputs via web audio | async disable () {
// Disconnect everything
this.mic.disconnect()
this.scriptNode.disconnect()
// Stop all media stream tracks and remove them
this.media.getAudioTracks().forEach(
(element) => {
element.stop()
this.media.removeTrack(element)
}
)
// Close the con... | [
"function disableAudioControls(reason) {\n\t//console.log('disableAudioControls');\n\t$(shell.audio.play).addClass('dim');\n\t//$(shell.audio.pause).addClass('dim');\n\t$(shell.audio.rewind).addClass('dim');\n\t$(shell.audio.play).css('cursor','default');\n\t//$(shell.audio.pause).css('cursor','default');\n\t$(shel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Signal that all operations for this depth are complete. Trigger the save operations for the next depth. | function depthOperationsComplete() {
operationsComplete();
self.saveWebLinksAtDepth(depth + 1, operations, successfulOperations, failedOperations, operationsComplete);
} | [
"function operationComplete() {\n completedOperationsCount++;\n if (completedOperationsCount >= depthOperationsCount) {\n depthOperationsComplete();\n }\n }",
"function operationComplete() {\n if ((successfulOperations.length + failedOperations.length) >= totalOperations) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear active state for all bullets | function removeActiveBulletClass() {
for (var i = 0; i < bullets.length; i++) {
bullets[i].classList.remove('active');
}
} | [
"_clearActiveList()\n {\n this.activeList = getDefaultList();\n }",
"function setActiveBulletClass() {\n for (var i = 0; i < bullets.length; i++) {\n if (slides[i].style['transform'] == 'translateX(0px)') {\n bullets[i].classList.add('active');\n }\n }\n }",
"function clearToggles()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================================== CHANGES HEIGHT OF SETTINGS BLOCKS | function ChangeHeightOfSettingsBlock() {
let HeightOfSettingsBlock = 0;
if ($(".hidden-user-settings-content-blocks form").eq(0).css("display") == "flex") {
HeightOfSettingsBlock = $(".hidden-user-settings-content-blocks form:nth-child(1)").outerHeight();
}
if ($(".hidden-use... | [
"set requestedHeight(value) {}",
"function getHeight() {\n return 2;\n }",
"_updateHeight() {\n this._updateSize();\n }",
"function setContainerHeight() {\n if (zwiperSettings.autoHeight === false) {\n if (zwiperSettings.height === undefined) {\n zwiperContainerHeight = pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function : writeEntry(strLine) purpose : simple function to display results and write to a file | function writeEntry(strLine)
{
WScript.Echo(strLine)
objFile.WriteLine(strLine);
} | [
"function formatResponse(searchTerm, res) {\n let docs = res.data.docs;\n docs.forEach((doc) => {\n let id = doc.id;\n let ingestDate = doc.ingestDate;\n let dataProvider = doc.provider.name;\n \n // Write line to file\n let writeData = `${searchTerm} ${id} ${ingestDate} ${dataProvider}\\r\\n`\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Since the function is called twice (once at very beginning before requests are sent to the API and again after the new data has been combined with the existing data, it is necessary to check whether the SVG has already been added to the DOM) | function evaluateIfSVG () {
let existingSVG = document.getElementById('for_svg')
if (existingSVG.hasChildNodes()) {
existingSVG.innerHTML = ''
}
} | [
"function loadSVGtemplate1() {\n fetch(\"img/template_1.svg\")\n .then(response => response.text())\n .then(svgdata => {\n console.log(\"loadSVGtemplate_1\");\n document.querySelector(\"#temp\").insertAdjacentHTML(\"afterbegin\", svgdata);\n loadSVGtemplate2();\n });\n}",
"async function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the MD5 of an array of littleendian words, and a bit length. | function binl_md5(x, len) {/* append padding */x[len >> 5] |= 0x80 << ((len) % 32);x[(((len + 64) >>> 9) << 4) + 14] = len;var i, olda, oldb, oldc, oldd,a = 1732584193,b = -271733879,c = -1732584194,d = 271733878;for (i = 0; i < x.length; i += 16) {olda = a;oldb = b;oldc = c;oldd = d;a = md5_ff(a, b, c, d, x[i], ... | [
"function core_sha1(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << (24 - len % 32);\n x[((len + 64 >> 9) << 4) + 15] = len;\n\n var w = Array(80);\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extracts, and normalizes a url attribute value of a node | function resolveUrlAttribute ($node, attr) {
var url = $node.attr(attr);
if (url === undefined) return '';
if (isAbsoluteUrl(url)) {
return url;
} else {
return urlUtil.resolve(base, url);
}
} | [
"function parsePropertyValue (node) {\n var $node = $(node);\n\n if ($node.is('meta')) {\n return resolveAttribute($node, 'content');\n } else if ($node.is('audio,embed,iframe,img,source,track,video')) {\n return resolveUrlAttribute($node, 'src');\n } else if ($node.is('a,area,link')) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add new Conversion Profile. | static add(conversionProfile){
let kparams = {};
kparams.conversionProfile = conversionProfile;
return new kaltura.RequestBuilder('conversionprofile', 'add', kparams);
} | [
"static update(id, conversionProfile){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.conversionProfile = conversionProfile;\n\t\treturn new kaltura.RequestBuilder('conversionprofile', 'update', kparams);\n\t}",
"static add(addResponseProfile){\n\t\tlet kparams = {};\n\t\tkparams.addResponseProfile = a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the icon that indicates the contents of a field have changed from the compared value (for instance the new side on maintenance documents) to the field markers span | function showChangeIcon(fieldId) {
var fieldMarkerSpan = jQuery("#" + fieldId + "_markers");
var fieldIcon = jQuery("#" + fieldId + "_changeIcon");
if (fieldMarkerSpan.length > 0 && fieldIcon.length == 0) {
fieldMarkerSpan.append("<img id='" + fieldId + "_changeIcon' alt='" + getMessage(kradVariabl... | [
"changeMarker() {\n\t\t_.forEach(this.markers, (a) => a.style.display = this.saved ? 'inline' : '');\n\t}",
"function qodeIconWithTextWidgetFieldDependency() {\n var iconPacks = {\n 'font_awesome': 'icon',\n 'font_elegant': 'fe_icon',\n 'ion_icons': 'ion_icon',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stop the controller. Unsubscribes the component from all channels it was listening to. | stop(){
var priv = PRIVATE.get(this);
priv.messenger.stopListenAll();
priv.messenger.disconnect();
if (typeof priv.syncCrtlQProducer !== "undefined")
{
priv.syncCrtlQProducer.shutdown();
}
logger.info("stopped listening to channels");
} | [
"_stopListening (channel) {\n\t\tthis._stopStatusListening(channel);\n\t\tdelete this.messageListeners[channel];\n\t}",
"stop$() {\n return Rx.Observable.from(this.subscriptions).map(subscription => {\n subscription.subscription.unsubscribe();\n return `Unsubscribed: aggregateType=${aggregateType}, e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check to see if path is a registered http endpoint | function isHttpEndpoint(pathname) {
for (let index in httpEndpoints) {
if (httpEndpoints[index][0] == pathname) {
return true;
}
}
return false;
} | [
"function isDelayEndpoint(pathname) {\n for (let index in delayEndpoints) {\n if (delayEndpoints[index][0] == pathname) {\n return true;\n }\n }\n return false;\n}",
"isUrlInBasePaths(request) {\n const url = request.url.toLowerCase();\n const path = this.basePaths.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init connection error handlers. Requires connection monitor to be started | initErrorHandlers() {
this.subscriberSocket.on('connect_delay', () => {
this.emit(ZmqClient.events.CONNECTION_DELAY, 'Dashcore ZMQ connection delay');
this.incrementErrorCount();
});
this.subscriberSocket.on('disconnect', () => {
this.emit(ZmqClient.events.DISCONNECTED, 'Dashcore ZMQ conne... | [
"function initializeConnection() {\n //Add my libs\n var handlers = require( './handlers.js' );\n\n //Initialize the ssh connection\n connection = new Connection(),\n handler = domain.create();\n //Handling \"error\" event inside domain handler.\n handler.add(connection);\n //Add global ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build list of books in left and right blocks | function buildListOfbooks(leftBlock, rightBlock) {
for (var i = 0; i < leftBlock.length; i++) {
builder(leftBlock[i], ".left");
}
for (var i = 0; i < rightBlock.length; i++) {
builder(rightBlock[i], ".right");
}
} | [
"function buildBook( book ){\n\n var title = $(\"<b></b>\").text( book.title );\n var isbn = $(\"<div></div>\").attr('class','col-sm-2').append( $(\"<b></b>\").text( \"ISBN:\" ) );\n var description = $(\"<div></div>\").attr('class','col-sm-2').append( $(\"<b></b>\").text( \"Description:\" ) );\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load election from the API | getElection({commit}, data) {
commit('setElectionLoadStatus', 1);
ElectionAPI.getElection(data.id)
.then(function(response) {
commit('setElection', response.data.data);
commit('setElectionLoadStatus', 2);
})
... | [
"async getOrGenerateElection (ctx) {\n //query for election first before creating one.\n let currElections = JSON.parse(await this.queryByObjectType(ctx, 'election'));\n let election;\n\n if (currElections.length === 0) {\n // TODO: Improve Date handling. Maybe using Luxon.\n let electionDate ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UserContactController handle register form & send request to server to submit form data. | function UserContactController(__Form, $state, appServices, __Utils, __Auth, $scope) {
var scope = this;
scope = __Form.setup(scope, 'user_contact_form', 'userData', {
secured : true,
unsecuredFields : ['message'],
});
// get logged in user Info
__Auth.... | [
"function registrationForm() {\n app.getForm('profile').handleAction({\n confirm: function () {\n var email, profileValidation, password, passwordConfirmation, existingCustomer, Customer, target, customerExist;\n\n Customer = app.getModel('Customer');\n email = app.getForm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Summernote WYSIWYG text editor | function summernote() {
$('#summernote').summernote({
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture',... | [
"render(){\n return(\n <div className=\"container-fluid d:flex\" id=\"main\">\n \n <div id=\"textAreaContainer\">\n <h3 id=\"editor-head\">Markdown Editor</h3>\n <textarea className=\"bg-dark \" id=\"editor\" value={this.state.input} onChange={... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get goals by Country | function getGoalsByCountry(){
var country = hashValue;
country = country.charAt(0).toUpperCase() + country.substring(1);
shotsPerCountry = _.where(data, {TEAM: country});
$('h1#title').html('All of '+ country + '\'s goals and shots at the 2014 World Cup mapped: click on the dots for more info')
_.each(shotsPe... | [
"function casesByCountry (){\n\n let today = dateToday();\n let endPoint = 'https://api.covid19tracking.narrativa.com/api/' \n let queryCountriesUrl = endPoint + today; \n let URL = {\n url: queryCountriesUrl,\n method: \"GET\" \n } \n\n // making request to pull all Covid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IterationStatement : WhileStatement : DoWhileStatement : ForStatement ; | IterationStatement() {
switch (this._lookahead.type) {
case "while":
return this.WhileStatement();
case "do":
return this.DoWhileStatement();
case "for":
return this.ForStatement();
}
} | [
"function for_while(start0, end, action) /* forall<a,e> (start : int, end : int, action : (int) -> e maybe<a>) -> e maybe<a> */ {\n return _bind_for_while(start0, end, action);\n}",
"function $while(predicate1, action1) /* forall<e> (predicate : () -> <div|e> bool, action : () -> <div|e> ()) -> <div|e> () */ {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draws line for song history linechart | function drawLineSongs(svgId, dataset, name, data) {
// make correct d3 line generator
var line;
if (name == "tempo") {
line = d3.line()
.x(function(d, i) { return xScale(i); })
.y(function(d) { return yScaleTempo(d.y); })
.curve(d3.curveMonotoneX);
}
els... | [
"function drawLine(svg){\t\n\t\t\tsvg.style.strokeOpacity = '0.6';\n\t\t\tvar length = svg.getTotalLength();\n\t\t\t// Clear any previous transition\n\t\t\tsvg.style.transition = svg.style.WebkitTransition ='none';\n\t\t\t// Set up the starting positions\n\t\t\tsvg.style.strokeDasharray = length + ' ' + length;\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Browser specific loadImplementation. Always uses `window.Promise` To register a custom implementation, must register with `Promise` option. | function loadImplementation(){
if(typeof window.Promise === 'undefined'){
throw new Error("any-promise browser requires a polyfill or explicit registration"+
" e.g: require('any-promise/register/bluebird')")
}
return {
Promise: window.Promise,
implementation: 'window.Promise'
}
} | [
"function assignPromiseEngine(engine) {\n NativePromise = engine;\n}",
"function loadAsync() {\n if (handlersIn.load) {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callHandler(handlersIn.load, transformE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change image and resize video | function videoResize() {
if (window.innerWidth <= 600) {
video.width = 320;
video.height = 240;
wallpaper.src="Images/whitney-houston-vertical-image.jpg";
} else {
video.width = 640;
video.height = 480;
wallpaper.src="Images/whitney-houston-horizontal-image.jpg"
}
} | [
"function onVideoResized(vs, isPreview, size) {\n // notify the AVComponent that the video window size has changed\n pcAV.invoke('SetVideoWindowSize', vs._id(), vs.source.sink._videoWindow(), isPreview, size.width, size.height);\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does some manual dirty checking on the native input `placeholder` attribute. | _dirtyCheckPlaceholder() {
var _a, _b;
// If we're hiding the native placeholder, it should also be cleared from the DOM, otherwise
// screen readers will read it out twice: once from the label and once from the attribute.
// TODO: can be removed once we get rid of the `legacy` style for... | [
"function setPlaceholder(){\n\t\tif ( !Modernizr.input.placeholder ){\n\t\t\t$('input[placeholder]:not(:password), textarea[placeholder]').each(function(i, input){\n\t\t\t\tvar $input = $(input);\n\t\t\t\tif ( $.trim($input.val()) === '' ){\n\t\t\t\t\t$input.val( $input.attr('placeholder') );\n\t\t\t\t\tsetPlacehol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logs the score/user details to the local storage only after certain conditions are met, otherwise alerts are shown in the browser and the function stops running. | function logScore() {
event.preventDefault();
var user = {
userInitials: inputName.value,
userScore: timer
};
if (user.userInitials === "") {
alert("You need to enter your initals")
return;
}
if ((user.userScore < 1) || (user.userScore === 60)) {
alert("Y... | [
"function postScoreOnline() {\n //check if user is login\n //check in local storage if user_username and user_id is stored\n\n var a = window.localStorage.getItem(\"user_id\");\n var b = window.localStorage.getItem(\"username\");\n var c = window.localStorage.getItem(\"local-storage-game-over-score\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
action to show goal info | changeShowGoalInfo({ commit }, data) {
commit("setShowGoalInfo", data)
} | [
"setShowGoalInfo(state, data) {\n state.showGoalInfo = data\n }",
"function editGoal() {\n\t\tprops.editTask(props.goalId);\n\t}",
"function displayGoal() {\n // Make the message disappear when a game over happens\n if (state === \"GAMEOVER\") {\n return;\n }\n push();\n // Setting the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the lines and for each of them parses the necessary files from the GTFS files. Keep in mind that line number is NOT equal to line id! | function parse_gtfs(lines) {
return new Promise(async (resolve, reject) => {
try {
//All lines are loaded into memory
let parsed_calendar = parse_gtfsfile(await fsPromises.readFile(path.join(__dirname, '/../tmp/gtfs/calendar.txt'), 'utf8'));
let trips_file = await fsPromi... | [
"function parse_gtfsfile(data) {\n let _data = data.split(\"\\n\");\n let _parsed_result = [];\n _data.forEach(element => {\n _parsed_result.push(element.split(\",\"));\n });\n return _parsed_result;\n}",
"function readHugeFiles(dirName, processOnFileLine, onError) {\n\tfs.readdir(dirName, f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load zoomout animation images to the background. | function loadZoomOutImages(i) {
if (i < 77) {
picnumstring = ('00000' + i).slice(-5);
innerProject = currentProject();
if (innerProject == 'MY_PE_ExWh_IntBk_21cUturb/MY_PE_ExWh_IntBk_21cUturb') {
innerProject = 'MY_PE_ExWh_IntBk_21cUturb/MY_PE_ExWh_IntBk_21cUturb_Spr';
}
picstring = '/sequences/rot... | [
"function zoomOut() {\n $(\".rocket img\").addClass('animated zoomOutUp');\n }",
"initZoomOut()\n {\n this.animStyle = Target.ANIM_ZOOM_OUT;\n }",
"function loadZoomInImages(i) {\n\t\tif (i < 77) {\n\t\t\tpicnumstring = ('00000' + i).slice(-5);\n\t\t\tinnerProject = currentProject();\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RELATIVE require.resolve to cwd since we might be going into module dirs we want to find relative modules to modules... | function resolvePath(module, cwd) {
return resolve.sync(module, {
basedir: cwd
});
if(cwd && module.substr(0, 1) == ".") {
return require.resolve(cwd + "/" + module);
}
//not local?
try {
return require.resolve(module);
} catch(e) {
return null;
}
} | [
"nodeModulesPaths(start) {\n assert(typeof start === 'string');\n assert(isAbsolute(start));\n\n const paths = [];\n\n let globalPaths = this.npm ? NPM_PATHS : GLOBAL_PATHS;\n\n if (this.paths.length > 0)\n globalPaths = this.paths.concat(globalPaths);\n\n let last = start.length;\n let p ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Type of the NgModule decorator / constructor function. | function NgModuleDecorator() { } | [
"function ClassDecoParm(NAME) {\r\n return function (target) {\r\n console.log(`Class Decorator`);\r\n console.log(`My Name is :${NAME} Target ${target}`);\r\n };\r\n}",
"static define() {\n return new AnnotationType()\n }",
"function makePropertyDecorator(typeFunction) {\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
place thumb image retrun false, if already loaded return true if was set on this function isForce set the image anyway | function placeThumbImage(image, isForce){
if(!isForce)
var isForce = false;
var objImage = jQuery(image);
var objThumb = objImage.parent();
var thumbIndex = objThumb.index();
var objItem = g_arrItems[thumbIndex];
if(objItem.isLoaded == true && isForce === false)
return(false);
... | [
"function setItemThumbLoadedError(objThumb){\n\t\t\t\n\t\t\tobjThumb.children(\".ug-thumb-loader\").hide();\n\t\t\tobjThumb.children(\".ug-thumb-error\").show();\n\t\t\t\n\t\t\tvar objItem = t.getItemByThumb(objThumb);\n\t\t\t\n\t\t\tobjItem.isLoaded = true;\n\t\t\tobjItem.isThumbImageLoaded = false;\t\t\n\t\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handling the `scribejs, issue X,Y,Z` type directives. The method returns a set of strings to be added to the final (markdown) minutes. Two information items are returned 1. A standard markdown line is added listing the the issue URLs. 2. If this works with Jekyll, a comment is returned with the list of URLs in the form... | function issue_directives(config, directive, issue_references) {
// see if there is an issue repository to use:
const repo = config.issuerepo || config.ghrepo;
if (repo === undefined) {
return '';
}
else {
// Previous steps may add a '.' to the end of a line; this is removed here to ... | [
"static displayPartsToMarkdown(parts, urlTo) {\n const result = [];\n for (const part of parts) {\n switch (part.kind) {\n case \"text\":\n case \"code\":\n result.push(part.text);\n break;\n case \"inline-ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate data size of json object | function jsonObjSize(json) {
let bytes = 0;
function sizeOf(obj) {
if (obj !== null && obj !== undefined) {
switch (typeof obj) {
case 'number': {
bytes += 8;
break;
}
case 'string': {
bytes += obj.length;
break;
}
case 'boolean': {
bytes += 4;
break;
}
... | [
"function getJsonLength(jsonData) {\n var jsonLength = 0;\n for (var item in jsonData) {\n jsonLength++;\n }\n return jsonLength;\n}",
"function getLength(data) {\n\treturn Object.keys(data).length;\n}",
"function len( obj )\n {\n if ( undefined === obj.length && \"number\" !== typeof obj.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |