query stringlengths 9 34k | document stringlengths 8 5.39M | negatives sequencelengths 19 20 | metadata dict |
|---|---|---|---|
Function that shuffles cards based on css order | function shuffle(cards) {
cards.forEach(card => {
let randomize = Math.floor(Math.random() * 10);
card.style.order = randomize;
});
} | [
"function shuffle() {\n cards.forEach(card => {\n let randPos = Math.floor(Math.random() * 12);\n card.style.order = randPos;\n })\n}",
"function shuffleCards() {\n removeCards();\n const shuffleArray = cards.sort(() => Math.random() - 0.5);\n displayCards(shuffleArray);\n styleCards();\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sort the deliquents by percentLogged | function percentLoggedDesc(a,b) {
if (a.percentLogged < b.percentLogged) {
return -1;
} else if (a.percentLogged > b.percentLogged) {
return 1;
} else {
return 0;
}
} | [
"function sortChartData() {\n chartData.sort((element1, element2) => {\n return element2.percentUnique - element1.percentUnique;\n });\n }",
"function filterAndSort(langs) {\n return langs.filter(function(e) { return e.language })\n .sort(function(a,b) { return b.percent - a.percent })\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the debug window exists, then close it | function hideDebug() {
if (window.top.debugWindow && ! window.top.debugWindow.closed) {
window.top.debugWindow.close();
window.top.debugWindow = null;
}
} | [
"function closeHelpDesk() {\n window.close();\n}",
"function __zdbCloseWorkWindow(myWindowId){\n if(myWindowId == null) return false;\n application.activeWindow.close();\n application.activateWindow(myWindowId);\n return;\n}",
"function onClose() {\n\tdebug( 'Window closed. Dereferencing window obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that gets the number input | function getNumber() {
// store the input as an integer in num
num = parseInt(input.value());
} | [
"function getInputNumber(input){\n if(inputNum == undefined){\n inputNum = input;\n }else{\n inputNum = (inputNum * 10) + (input * 1);\n }\n calcDisplay.value = inputNum; \n }",
"function getInputNumber(id){\n const Amount = document.getElementById(id).v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$g by JoeSimmons. Supports ID, Class, and XPath (full with types) in one query Supports multiple id/class grabs in one query (split by spaces), and the ability to remove all nodes regardless of type See script page for syntax examples: | function $g(que, obj) {
if(!que || !(que=que.replace(/^\s+/,''))) return;
var obj=(obj?obj:({del:false,type:6,node:document})), r,
class_re=/^\.[A-Za-z0-9-_]/, id_re=/^\#[^\s]/, xp_re=/^\.?(\/\/|count|id)\(?[A-Za-z0-9\'\"]/;
if(!que || typeof que!='string' || que=='') return false;
else if(id_re.test(que)) {
var... | [
"function removeNodes (cssClass) {\n let selector = 'div.' + cssClass;\n let elements = document.querySelectorAll(selector);\n Array.prototype.forEach.call(elements, function (element) {\n document.body.removeChild(element);\n });\n}",
"function $g(que, O) {\r\nif(!que||typeof(que)!='string'||que==''||!(qu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch to the video to the right in the playlist from the current one. | function shiftRight() {
right_video = current_video - 1;
if(right_video < 1) {
right_video = vid_array.length-1;
}
switchToVideo(right_video);
} | [
"function shiftLeft() {\n\tleft_video = current_video + 1;\n\tif (left_video >= vid_array.length) {\n\t\tleft_video = 1;\n\t}\n\tswitchToVideo(left_video);\n}",
"function forwardButtonTrigger() {\n if (window.currentVideoSelectedForPlayback) {\n setCurrentlyPlaying(false)\n const currentNode = window.curre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find closest panel and scroll to it | function findClosestPanel() {
var differences = [],
lowestDiff = Infinity
if (lowestDiff !== 0) {
// work out closest element
for (var i = 0; i < sections.length; i++) {
var difference = window.scrollY - sections[i].offsetTop
if (difference < 0) {
// turn any ne... | [
"function panelScroll() {\n\t\"use strict\";\n\t$('.panel-group').one('shown.bs.collapse', function () {\n\t\tvar panelExpanded = $(this).find('.in');\n\t\t\n\t\t$('html, body').animate({\n\t\t\tscrollTop: panelExpanded.offset().top - 105\n\t\t}, 400);\n\t});\n}",
"function scrollSub(id){\n var topPos = document... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get date and time to start according to service window for current workrequest Calls WFR AbBldgOpsHelpDeskgetServiceWindowStartFromSLA Fills in date and time started | function getDateAndTimeStarted(){
var panel = View.panels.get('tool_form');
var wrId = panel.getFieldValue("wrtl.wr_id");
var result = {};
try {
result = Workflow.callMethod("AbBldgOpsHelpDesk-SLAService-getServiceWindowStartFromSLA", 'wr','wr_id',wrId);
}
catch (e) {
Workflow.handleError(e);
}
... | [
"function getDateAndTimeStarted(){\n var panel = View.getControl('', 'sched_wr_cf_cf_form');\n var wrId = panel.getFieldValue(\"wrcf.wr_id\");\n\n //kb:3024805\n\tvar result = {};\n\t//Retrieves service window start for SLA, next working day for this SLA after today ,file=\"ServiceLevelAgreementHandler\"\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the jsTree for the given selector | function updateTreeStructure(selector) {
$.getJSON(tree_url + '?dir=' + dir_url, function(data) {
if (data.html) {
/*
* Remove the existing tree, update the content and build the new tree.
* Need to do it this way, otherwise the tree doesn't open to the correct folder.
*/
$(select... | [
"updateTreeSelection_() {\n if (angular.isUndefined(this.tree_)) {\n return;\n }\n\n this.tree_['deselect_all']();\n this.tree_['select_node'](this.selectionName_);\n }",
"function updateJSTree( updateJSTreeAction ) {\n //alert(\"JSTreeAction : \" + updateJSTreeAction);\n\n var objClassVal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the image (get the buffer and offset) into a new zipLoaderInstance | function parseImageFromZip(doSkipJPG, offsetInReader) {
return new Promise(function(resolve){
var zipLoaderInstance2 = ZipLoader.unzip( MLJ.core.Scene._zipFileArrayBuffer, doSkipJPG, offsetInReader );
resolve(zipLoaderInstance2);
});
} | [
"zipParser(blob){\n var zip = O.esri.zip;\n var _this = this;\n /*O.esri.*/zip.createReader(new /*O.esri.*/zip.BlobReader(blob), function (zipReader) {\n zipReader.getEntries(function (entries) {\n _this.initMap(entries);\n //if(entries)alert(\"TPK downloaded and unzipped!\");\n zip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets if the provided structure is a JSDocableNodeStructure. | static isJSDocable(structure) {
switch (structure.kind) {
case StructureKind_1.StructureKind.Class:
case StructureKind_1.StructureKind.Constructor:
case StructureKind_1.StructureKind.ConstructorOverload:
case StructureKind_1.StructureKind.GetAccessor:
... | [
"static isJSDoc(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.JSDoc;\r\n }",
"static isJSDocableNode(node) {\r\n switch (node.getKind()) {\r\n case typescript_1.SyntaxKind.ClassDeclaration:\r\n case typescript_1.SyntaxKind.ClassExpression:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
do invoice transition on save activity | function saveActivityAndDoTransition() {
Y.doccirrus.jsonrpc.api.activity.read( { query: { _id: ko.unwrap( activities[0] ) } } )
.then(function( res ) {
var
data = res.data && res.data[0],
isCorrectTransi... | [
"function saveInvoiceNumber( itcb ) {\n // this step only applies to invoices\n if ( 'INVOICE' !== activity.actType && 'RECEIPT' !== activity.actType ) { return itcb( null ); }\n\n var\n setArgs = {\n 'conten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serialize the map of all resources in JSON | entitiesToJSON(){
let res = {
"id": this.id,
"resources": {}
};
(this.entitiesByID||{})::entries().forEach(([id,obj]) => res.resources[id] = (obj instanceof Resource) ? obj.toJSON(): obj);
return res;
} | [
"toJSON(depth = 0, initDepth = depth){\n\n /**\n * Converts a resource object into serializable JSON.\n * May fail to serialize recursive objects which are not instances of Resource\n * @param value - resource object\n * @param depth - depth of nested resources to output\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Byteswap an arbitrary buffer, flipping from one endian to the other, returning a new buffer with the resultant data | function byteswap64(buf) {
var swap = Buffer.alloc(buf.length);
for (var i = 0; i < buf.length; i++) {
swap[i] = buf[buf.length -1 - i];
}
return swap;
} | [
"function byteswap64(buf) {\n var swap = new Buffer(buf.length);\n for (var i = 0; i < buf.length; i++) {\n swap[i] = buf[buf.length -1 - i];\n }\n return swap;\n}",
"function to_little_endian(){\n\tbinary_input.reverse();\n\tbinary_key.reverse();\n}",
"function _swapEndian(val, length) {\n if (length <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that the selected values are allowed, IE we have resources named after it | function check_allowed() {
var material = $(select_div+" "+"#pd-material-type").find("option[selected]").attr("value");
var material_dict = get_material_dict(data, material);
var allowed = material_dict.allowed;
for(var i = 0; i < allowed.length; i++) {
var good = t... | [
"function validation_for_select_boxes(element){\n\tif(element.value != \"Default\")\n\t\treturn true;\n\telse{\n\t\talert(\"please select \"+ element.name);\n\t\treturn false;\n\t}\n}",
"function requireSelects ( form, requiredSelect ) {\n for ( var i = 0; i < requiredSelect.length; i++ ) {\n element = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if this relates to the active query being executed then immediately send the cancel, else the query can be removed from the queue and never submitted to the driver. | function cancel (notify, callback) {
const qid = notify.getQueryId()
if (workQueue.length() === 0) {
setImmediate(() => {
callback(new Error(`Error: [msnodesql] cannot cancel query (empty queue) id ${qid}`))
})
return
}
const first = workQueue.first((_idx, curr... | [
"function cancelQuery() {\n// console.log(\"Cancelling query, currentQuery: \" + qwQueryService.currentQueryRequest);\n if (qwQueryService.currentQueryRequest != null) {\n var queryInFly = mnPendingQueryKeeper.getQueryInFly(qwQueryService.currentQueryRequest);\n queryInFly && queryInFly.canc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns memory usage as a percentage of total memory available (0100) | function getMemUsage() {
var total = os.totalmem(),
usage = total - os.freemem(),
perc = usage / total * 100;
return {
usage : usage
, total : total
, percentage : perc
};
} | [
"function calcPhysicalMem()\n{\n\tvar os = require('os');\n\n\tvar totalm = (os.totalmem() / 1024 / 1024).toFixed(2);\n\tvar freem = (os.freemem() / 1024 / 1024).toFixed(2) ;\n\tvar usedm = (totalm - freem);\n\n\n\tmetrics[\"phys_mem_used\"].value = usedm;\n\tmetrics[\"phys_mem_free\"].value = freem;\n\tmetrics[\"p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates, or attempts to evaluate, a ForInStatement | function evaluateForInStatement({ node, environment, evaluate, logger, reporting, typescript, statementTraversalStack }) {
// Compute the 'of' part
const expressionResult = evaluate.expression(node.expression, environment, statementTraversalStack);
// Ensure that the initializer is a proper VariableDeclarat... | [
"function ForInStatement() {\n}",
"function evaluateForOfStatement({ node, environment, evaluate, logger, reporting, typescript, statementTraversalStack }) {\n // Compute the 'of' part\n const expressionResult = evaluate.expression(node.expression, environment, statementTraversalStack);\n // Ensure that ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
yesterday(thisDate) / /All my troubles seemed so far away. | function yesterday(thisDate) {
// adjustForLeapYears(thisDate);
if (thisDate[2]!=1) {
return [thisDate[0],thisDate[1],thisDate[2]-1];
} else if (thisDate[1]!=0) {
return [thisDate[0],thisDate[1]-1,monthLength[thisDate[1]-1]];
} else {
var tempYear = thisDate[0]-1;
adjustForLeapYears('yesterd... | [
"function getYesterday(){\n\treturn getDate(-1);\n}",
"getYesterday() {\n let yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n return this.format(yesterday);\n }",
"function dateForYesterday() {\n var date = new Date().toMidnight();\n date.setDate(date.getDate() - 1);\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 393