Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
ANIMATIONRELATED OPERATIONS put keyvalue pair into BST
animatePut(key, val) { let animations = []; animations.push(new Animation("display", `Putting ${key}`, "")); this.root = this.animatePutHelper( this.root, key, val, this.rootX, this.rootY, this.rootDeltaX, this.rootDeltaY, animations ); animations.push(new Animation("display", `Put ${key}`, "")); return animations; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bst({ root, key }) {\n if(!root) {\n root = { key };\n }\n else if (key < root.key) {\n root.left = bst({ root: root.left, key });\n }\n else {\n root.right = bst({ root: root.right, key });\n }\n return root;\n}", "insert (key, value) {\n value = value || key;\n\n //leafs need to ...
[ "0.6494019", "0.64919895", "0.6320114", "0.6282188", "0.6202963", "0.6142242", "0.6137095", "0.6115002", "0.6074625", "0.6048915", "0.60057634", "0.5926925", "0.59215504", "0.59215504", "0.58945984", "0.58928645", "0.58810455", "0.58547956", "0.5854308", "0.58109164", "0.5759...
0.54045135
52
whether bst contains key
animateContains(key) { const [node, animations] = this.animateGet(key); // reuse the animateGet method while fixing the display values animations[0] = new Animation("display", `Contains ${key}?`, ""); const containsMsg = node === null ? "False" : "True"; animations[animations.length - 1] = new Animation( "display", containsMsg, "" ); return [node, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "contains(key) {\n let current = this.head;\n while(current.object != key) {\n current = current.next;\n if(current == null)\n return false;\n }\n return true;\n }", "contains(key)\n\t{\n\t\tkey = this.toString(key);\n\t\treturn super.has(key);\n...
[ "0.74577385", "0.7159847", "0.7082258", "0.7018241", "0.69806147", "0.6955544", "0.6885939", "0.6791973", "0.6772025", "0.67040795", "0.6695513", "0.66438067", "0.66404474", "0.6628923", "0.6625589", "0.6625589", "0.6625589", "0.6625589", "0.6625589", "0.6600251", "0.65985644...
0.0
-1
retrieve value associated with key from bst
animateGet(key) { const animations = []; animations.push(new Animation("display", `Getting ${key}`, "'")); const node = this.animateGetHelper(this.root, key, animations); // highlight last node in red if not found if (node === null) { animations[animations.length - 1].setClass("search-failed-node"); animations.push(new Animation("display", "Not Found", "'")); } // highlight last node in green if found else if (compareTo(key, node.key) === 0) { animations[animations.length - 1].setClass("found-node"); animations.push(new Animation("display", node.value, "'")); } return [node, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get(key) {\n const address = this._hash(key);\n if(this.data[address]){\n for (let i = 0; i < this.data[address].length; i++) {\n let currenctBucket = this.data[address][i];\n if (currenctBucket) {\n if (currenctBucket[0] === key) {\n ...
[ "0.69082135", "0.66037124", "0.6554713", "0.6547571", "0.6547571", "0.6547571", "0.6524139", "0.6487748", "0.6482123", "0.64602643", "0.6368417", "0.63241535", "0.62833166", "0.6265976", "0.6261236", "0.6259042", "0.62365997", "0.6220131", "0.6198753", "0.61806655", "0.609931...
0.0
-1
delete minimum node animate
animateDeleteMin() { const animations = []; animations.push(new Animation("display", "Deleting Min", "")); this.root = this.animateDeleteMinHelper(this.root, animations); this.positionReset(); // reset x,y positions of nodes animations[animations.length - 1].setClass("found-node"); animations.push(new Animation("display", "Deleted Min", "")); return animations; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteMin() {\r\n this.root = this.animateDeleteMinHelper(this.root);\r\n }", "animateDeleteMax() {\r\n const animations = [];\r\n animations.push(new Animation(\"display\", \"Deleting Max\", \"\"));\r\n\r\n this.root = this.animateDeleteMaxHelper(this.root, animations);\r\n this.positionReset();...
[ "0.8219588", "0.6764469", "0.6589784", "0.65468085", "0.65468085", "0.6514791", "0.6413174", "0.6265333", "0.6247256", "0.6247038", "0.61816996", "0.61467886", "0.6139714", "0.61021894", "0.6100401", "0.6087959", "0.60735303", "0.6065149", "0.6044144", "0.60392064", "0.599343...
0.7807901
1
delete maximum node animate
animateDeleteMax() { const animations = []; animations.push(new Animation("display", "Deleting Max", "")); this.root = this.animateDeleteMaxHelper(this.root, animations); this.positionReset(); // reset x,y positions of nodes animations[animations.length - 1].setClass("found-node"); animations.push(new Animation("display", "Deleted Max", "")); return animations; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteMin() {\r\n this.root = this.animateDeleteMinHelper(this.root);\r\n }", "animateDeleteMin() {\r\n const animations = [];\r\n animations.push(new Animation(\"display\", \"Deleting Min\", \"\"));\r\n\r\n this.root = this.animateDeleteMinHelper(this.root, animations);\r\n this.positionReset();...
[ "0.7379584", "0.72975993", "0.6662128", "0.65339935", "0.6525566", "0.651626", "0.651626", "0.63917893", "0.6388692", "0.62053037", "0.61227125", "0.6117489", "0.6116594", "0.60836446", "0.6061511", "0.6052558", "0.6017127", "0.6011314", "0.59932804", "0.5989712", "0.5985415"...
0.7588953
0
delete a specific key from bst
animateDelete(key) { const animations = []; animations.push(new Animation("display", `Deleting ${key}`)); this.root = this.animateDeleteHelper(this.root, key, animations); this.positionReset(); // reset x,y positions of nodes // highlight last node in green if found if (compareTo(animations[animations.length - 1].getItem(), key) === 0) { animations[animations.length - 1].setClass("found-node"); animations.push(new Animation("display", `Deleted ${key}`)); return [key, animations]; } // highlight last node in red if not found else { animations[animations.length - 1].setClass("search-failed-node"); animations.push(new Animation("display", "Not Found")); return [null, animations]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async delete(key) {}", "delete(key: K) {\n this.tree.remove([key, null]);\n }", "delete(key){\n const address = this._hash(key);\n if(this.data[address]){\n for (let i = 0; i < this.data[address].length; i++) {\n let currenctBucket = this.data[address][i];\n ...
[ "0.7587212", "0.7576173", "0.7471219", "0.7264688", "0.7240824", "0.70758283", "0.6920737", "0.6865355", "0.684363", "0.68303055", "0.6800355", "0.67972964", "0.6765296", "0.67506516", "0.67473835", "0.67216694", "0.6717055", "0.66764915", "0.66764915", "0.66764915", "0.66764...
0.0
-1
return key in bst with given rank
animateSelect(rank) { let animations = []; animations.push(new Animation("display", `Select ${rank}`, "")); const node = this.animateSelectHelper(this.root, rank, animations); // highlight last node in red if not found if (node === null) { animations[animations.length - 1].setClass("search-failed-node"); animations.push(new Animation("display", "Not Found", "")); } // highlight last node in green if found else animations[animations.length - 1].setClass("found-node"); animations.push(new Animation("display", node.value, "")); return [node, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findKthLargestValueInBst(tree, k) {\n let treeInfo = new TreeInfo(0, -1)\n reverseInOrderTraverse(tree, k, treeInfo)\n return treeInfo.currVisitedNodeValue\n }", "find (key) {\n key = toNumber(input);\n let node = this.root;\n while (node != null) {\n if (key < node.key) {\n ...
[ "0.5895939", "0.5836745", "0.5822547", "0.57418513", "0.5739508", "0.571266", "0.5675706", "0.5673694", "0.5623479", "0.56151193", "0.5561554", "0.5492664", "0.54798895", "0.541149", "0.5401308", "0.5395234", "0.5390893", "0.538417", "0.53783524", "0.5372408", "0.5369971", ...
0.0
-1
return number of keys in subtree < key
animateRank(key) { let animations = []; animations.push(new Animation("display", `Rank of ${key}`, "")); const rank = this.animateRankHelper(this.root, key, animations); if (animations[animations.length - 1].getItem() === key) animations[animations.length - 1].setClass("found-node"); else animations[animations.length - 1].setClass("search-failed-node"); animations.push(new Animation("display", rank, "")); return [rank, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getNumberOfKeys () {\n let res\n\n if (!Object.prototype.hasOwnProperty.call(this, 'key')) return 0\n\n res = 1\n if (this.left) res += this.left.getNumberOfKeys()\n if (this.right) res += this.right.getNumberOfKeys()\n\n return res\n }", "get_child_count(){\n return Object.keys(this.childr...
[ "0.7712641", "0.66334707", "0.6452036", "0.63177204", "0.6238651", "0.60802096", "0.60652745", "0.5975413", "0.5970096", "0.5970096", "0.5970096", "0.5970096", "0.5970096", "0.5940673", "0.59302676", "0.59011996", "0.588781", "0.5886737", "0.5863305", "0.58179635", "0.5798335...
0.0
-1
inorder traversal of nodes
animateInorderNodes() { let queue = []; let animations = []; animations.push(new Animation("display", "Traversing Inorder", "")); this.animateInorderNodesHelper(this.root, queue, animations); animations.push(new Animation("display", "Finished Travering", "")); return [queue, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inOrderTraversal(node) {}", "inorderTraversal() {\n\n }", "inorderTraversal(node = this.root) {\n if (node === null)\n return;\n\n this.inorderTraversal(node.left);\n console.log(node.data);\n this.inorderTraversal(node.right);\n }", "inorder(node) {\n ...
[ "0.8586327", "0.80949754", "0.78377247", "0.78191906", "0.78191906", "0.7784994", "0.7784994", "0.7784994", "0.7769381", "0.7545223", "0.74973994", "0.7490266", "0.7421076", "0.73980016", "0.7306658", "0.72934455", "0.72826487", "0.7265739", "0.72056234", "0.7176716", "0.7061...
0.0
-1
preorder traversal of nodes
animatePreorderNodes() { let queue = []; let animations = []; animations.push(new Animation("display", "Traversing Preorder", "")); this.aniamtePreorderNodesHelper(this.root, queue, animations); animations.push(new Animation("display", "Finished Traversing", "")); return [queue, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function preOrderTraversal(node) {}", "_preorder(node) {\n if (node !== null && node !== undefined) {\n this.currElem = node.getElement();\n this._preorder(node.getLeftChild());\n this._preorder(node.getRightChild());\n }\n }", "preorder(node) {\n if (node != null) {\n c...
[ "0.88136935", "0.81697696", "0.81652904", "0.8152653", "0.812996", "0.8125248", "0.80743426", "0.80690646", "0.8026129", "0.7895955", "0.77762496", "0.7703113", "0.7663644", "0.75896186", "0.7567731", "0.7550127", "0.7522614", "0.7482504", "0.74700505", "0.74630684", "0.74617...
0.0
-1
postorder traversal of nodes
animatePostorderNodes() { let queue = []; let animations = []; animations.push(new Animation("display", "Traversing Postorder", "")); this.animatePostorderNodesHelper(this.root, queue, animations); animations.push(new Animation("display", "Finished Traversing", "")); return [queue, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postOrderTraversal(node) {}", "postorder(node) {\n if (node != null) {\n this.postorder(node.left);\n this.postorder(node.right);\n console.log(node.data);\n }\n }", "postorder(node) {\n if (node !== null) {\n this.postorder(node.left...
[ "0.8691974", "0.79807144", "0.7973612", "0.7918904", "0.77977616", "0.7781324", "0.7632293", "0.7402599", "0.7381848", "0.7354399", "0.7346977", "0.7333587", "0.7315197", "0.71389705", "0.71344286", "0.7118694", "0.71151143", "0.7083866", "0.7041777", "0.701417", "0.69705826"...
0.0
-1
level order traversal of nodes
animateLevelorderNodes() { let queue = []; let nodeQueue = []; let animations = []; animations.push(new Animation("display", "Traversing Levelorder", "")); nodeQueue.push(this.root); while (nodeQueue.length !== 0) { const node = nodeQueue.shift(); if (node === null) continue; queue.push(node); // insert animations if (this.root && !node.isEqual(this.root)) animations.push(new Animation("line", node.key, "line-highlighted")); animations.push(new Animation("node", node.key, "found-node")); nodeQueue.push(node.left); nodeQueue.push(node.right); } animations.push(new Animation("display", "Finished Traversing", "")); return [queue, animations]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "levelOrderSearch(node) {\n if (node === null) {\n return;\n }\n\n let discoveredNodes = [];\n discoveredNodes.push(node);\n\n while(discoveredNodes.length > 0) {\n let currentNode = discoveredNodes[0];\n console.log(currentNode.data);\n\n ...
[ "0.7738875", "0.73244894", "0.7306826", "0.73028904", "0.72906595", "0.72680694", "0.70416194", "0.6918859", "0.6873484", "0.68360394", "0.68360394", "0.68203324", "0.6736197", "0.6723117", "0.6712994", "0.6697749", "0.6534343", "0.65244234", "0.6521104", "0.6489053", "0.6483...
0.6354307
39
makes a request for JSON, getting back an array of contributors and passes this data to cb, an anonymous callback function that is given
function getRepoContributors(repoOwner, repoName, cb) { var requestURL = 'https://'+ GITHUB_USER + ':' + GITHUB_TOKEN + '@api.github.com/repos/' + repoOwner + '/' + repoName + '/contributors'; console.log(requestURL); var options = { url: requestURL, headers: { 'User-Agent': 'GitHub Avatar Downloader - Student Project' } }; request.get(options, function(err, response) { if (err) { throw err } if (response.statusCode === 200) {; cb(response); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function xhrCallbackContributors(data) {\n //console.log('data from server', data);\n contributors = JSON.parse(data);\n console.log('parsed contributor data:', contributors);\n \n showContributorsInList(contributors);\n}", "fetchContributors() {\n return Util.fetchJSON(this.data.contributors_u...
[ "0.7660997", "0.73393077", "0.719259", "0.70867324", "0.708333", "0.70817816", "0.7047408", "0.7006869", "0.68267876", "0.6731167", "0.67047584", "0.6612997", "0.6612835", "0.65748113", "0.6507493", "0.6444939", "0.640652", "0.638246", "0.6349789", "0.63270503", "0.6324915", ...
0.6761881
9
fetches desired url and write the images url to a new file path
function downloadImageByURL (url ,filePath) { var content = request.get(url) content.pipe(fs.createWriteStream(filePath)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function downloadImage(url) {}", "function updateURL(imageNum,imageNum2,contributor1,contributor2,issued1,issued2,title1,title2,troveUrl1,troveUrl2){\n url1 = loadedImages[imageNum];\n url2 = loadedImages[imageNum2];\n Image_Path_1 = url1;\n Image_Path_2 = url2;\n contributor11 = contributor1;\n ...
[ "0.6802452", "0.63121134", "0.63020307", "0.62854433", "0.6244627", "0.6198315", "0.61598814", "0.6134651", "0.61144173", "0.6109636", "0.6097733", "0.60919195", "0.6091496", "0.6091364", "0.60882545", "0.60596526", "0.6031612", "0.6019611", "0.600994", "0.5981598", "0.597999...
0.62411606
5
! Single baseline \class Line
function Line(lineId, startx, y, finishx){ this.id = lineId; this.startx = startx; this.y = y; this.finishx = finishx; this.selected = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Line() {}", "function Line() {}", "function Line() {}", "function Line() {}", "function Line() {}", "function Line(){}", "function RendererTextLine() {\n\n /*\n * The width of the line in pixels.\n * @property width\n * @type number\n * @protected\n */\n this.width = 0;\n...
[ "0.7952938", "0.7952938", "0.7952938", "0.7952938", "0.7952938", "0.78384835", "0.6997238", "0.6926064", "0.68488264", "0.6817992", "0.668045", "0.666385", "0.65811104", "0.65633917", "0.6556548", "0.6538027", "0.652666", "0.652666", "0.652666", "0.6501308", "0.64601517", "...
0.6192433
46
! Container of all baselines \class Baseline
function Baseline(lines) { this.lines = lines; this.visible = false; this.clickMargin = 0.4; //in percent of the image height }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \n \n LineItem.initialize(this);\n }", "function LinesSequence(parent) {\n this.parent = parent;\n}", "function addBaselines(sketch, layer, fragments) {\n\n // First we make a new group to contain our baseline layers\n var container = layer.container.newGroup({\"name\" : \"B...
[ "0.61401486", "0.59537953", "0.5813507", "0.57587916", "0.5717775", "0.5717775", "0.5717775", "0.5717775", "0.5717775", "0.56673896", "0.56312335", "0.5539384", "0.5498428", "0.54636276", "0.54307616", "0.54307616", "0.54307616", "0.54307616", "0.5376955", "0.5366981", "0.534...
0.72711754
0
! Rectangle of a BoundingBox \class Rectangle
function Rectangle(rect, idCC, idLine){ this.rect = rect; this.idCC = idCC; this.idLine = idLine; this.visible = true; this.selected = false; this.labeled = false; this.hover = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BoundingBoxRect() { }", "function Rectangle(left,top,right,bottom){this.left=left;this.top=top;this.right=right;this.bottom=bottom;}", "function BoundingBox(x, y, width, height) { \n this.width = width;\n this.height = height;\n\n this.left = x;\n this.top = y;\n this.right = this.left ...
[ "0.8464728", "0.7720044", "0.76760346", "0.76466966", "0.7542002", "0.75321186", "0.75321186", "0.7531904", "0.75220364", "0.75114924", "0.75114924", "0.7498288", "0.74518615", "0.7394226", "0.73913777", "0.73857254", "0.7366572", "0.7364287", "0.7357801", "0.7348406", "0.734...
0.70361125
40
! Container of all BoundingBox \class BoundingBox
function BoundingBox(rects) { this.rects = rects; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BoundingBoxRect() { }", "GetBoundingBoxes()\n\t{\n\t\treturn Object.values(this.collection).map(function(component)\n\t\t{\n\t\t\treturn {\n\t\t\t\tcomponent: component,\n\t\t\t\tBB: component._getBoundingBox()\n\t\t\t};\n\t\t});\n\t}", "function BoundingBox() {\n this.x1 = Number.NaN;\...
[ "0.78263265", "0.7469249", "0.7451684", "0.74225336", "0.73739296", "0.73164916", "0.7308891", "0.7257851", "0.72357893", "0.72357893", "0.7172033", "0.7168233", "0.71567285", "0.7103066", "0.7103066", "0.7077606", "0.7004648", "0.692082", "0.6896966", "0.6867919", "0.6863677...
0.7913982
0
! principal canvas \class Canvas \param canvas canvas element \param image image draw on the canvas \param baseline list of baselines \param boundingBox list of boundingBox
function Canvas(canvas, image, baseline, boundingBox) { var myCanvas = this; this.canvas = canvas; this.width = canvas.width; this.height = canvas.height; this.ctx = canvas.getContext('2d'); this.image = image; this.baseline = baseline; this.boundingBox = boundingBox; this.dragging = false; this.scale = 1.0; this.panX = 0; this.panY = 0; this.selectedCC = []; this.dragoffx = 0; this.dragoffy = 0; this.image.img.onload = function(){ myCanvas.image.w = this.width; myCanvas.image.h = this.height; myCanvas.image.initialx = myCanvas.width/2 - this.width/2; myCanvas.image.initialy = myCanvas.height/2 - this.height/2; myCanvas.image.x = myCanvas.image.initialx; myCanvas.image.y = myCanvas.image.initialy; if(this.width > this.height) myCanvas.scale = myCanvas.width /this.width; else myCanvas.scale = myCanvas.height /this.height; myCanvas.draw(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init(src, boundingBox, baseline) {\n var image = new ProcessingImage(src);\n var imagePreview = new ProcessingImage(src);\n \n\n var listRect = new Array();\n for (var rect in boundingBox) {\n listRect.push(new Rectangle({x:boundingBox[rect].x, y:boundingBox[rect].y, w:boundingBox[re...
[ "0.66951317", "0.5971016", "0.59601617", "0.59585005", "0.5803974", "0.57195866", "0.564124", "0.5575592", "0.5516886", "0.54568934", "0.5340093", "0.5338683", "0.5283784", "0.52835274", "0.527635", "0.5232744", "0.5231368", "0.5202946", "0.51907265", "0.5175944", "0.5148292"...
0.72186077
0
! preview canvas \class PreviewCanvas \param canvas canvas element \param image image draw on the canvas
function PreviewCanvas(canvas, image) { this.canvas = canvas; this.width = canvas.width; this.height = canvas.height; this.ctx = canvas.getContext('2d'); this.image = image; this.visible = false; this.scaleX = 1; this.scaleY = 1; this.isBaseline = false; this.position_up_line = 0; this.position_down_line = 0; this.position_left_line = 0; this.position_right_line = 0; this.position_baseline = 0; this.idElementSelected = 0; var myPreviewCanvas = this; this.image.img.onload = function(){ myPreviewCanvas.draw(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw_on_canvas(canvas, image) {\n // Giving canvas the image dimension\n\n var ctx = canvas.getContext('2d');\n // Drawing\n ctx.drawImage(image, 0 ,0,canvas.width,canvas.height);\n }", "function drawImageCanvas() {\n // Emulate background-size: cover\n var width = image...
[ "0.7068751", "0.703547", "0.6917276", "0.65423286", "0.6540519", "0.6521173", "0.6430351", "0.6376947", "0.62819546", "0.61796707", "0.617064", "0.61630005", "0.6132825", "0.61168927", "0.6071252", "0.606842", "0.6022635", "0.59700596", "0.5935048", "0.5898193", "0.58706063",...
0.81001174
0
! List of character from labelised Component \class ListCharacter
function ListCharacter(){ this.list = new Map(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseCharList() {\n CST.addBranchNode(\"CharList\");\n if (match([\"T_char\"], false, false) || match([\"T_space\"], false, false)) {\n parseCharList();\n }\n else {\n }\n log(\"Character List\");\n CST.backtrack();\n}", "function addCharacterToList(charString) {\n // crea...
[ "0.7503867", "0.70428145", "0.6462923", "0.6369874", "0.6329092", "0.6191434", "0.61053944", "0.5982004", "0.5904742", "0.5833651", "0.5802779", "0.5763262", "0.57569045", "0.5744987", "0.57270724", "0.5718097", "0.56480795", "0.5628221", "0.5623102", "0.5618244", "0.55883265...
0.695069
2
! Init all element to usage \param src source of the image \param boundingBox list of boundingBox from the server \param baselines list of baselines from the server
function init(src, boundingBox, baseline) { var image = new ProcessingImage(src); var imagePreview = new ProcessingImage(src); var listRect = new Array(); for (var rect in boundingBox) { listRect.push(new Rectangle({x:boundingBox[rect].x, y:boundingBox[rect].y, w:boundingBox[rect].width, h: boundingBox[rect].height},boundingBox[rect].idCC, boundingBox[rect].idLine)); } var boundingBox = new BoundingBox(listRect); var listBaseline = new Array(); for (var line in baseline) { listBaseline.push(new Line(baseline[line].idLine, baseline[line].x_begin,baseline[line].y_baseline,baseline[line].x_end)); } var baseline = new Baseline(listBaseline); var previewCanvas = new PreviewCanvas(document.getElementById('small_canvas'), imagePreview); var normalCanvas = new Canvas(document.getElementById('canvas'), image, baseline, boundingBox); var listCharacter = new ListCharacter(); var controller = new Controller(normalCanvas, previewCanvas, listCharacter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Baseline(lines) {\n this.lines = lines;\n this.visible = false;\n this.clickMargin = 0.4; //in percent of the image height\n}", "function setImages(data){\r\n for(i=0;i<data.length; i++)\r\n {\r\n imgBlocks[i].src = data[i].URL; \r\n imgBlocks[i].name = data[i].name;\r\n ...
[ "0.578059", "0.5546543", "0.5403429", "0.5346193", "0.52966976", "0.52873456", "0.5264467", "0.52365804", "0.5184634", "0.5176011", "0.51637805", "0.51560503", "0.5112056", "0.5102133", "0.50975466", "0.50894904", "0.5087844", "0.5081945", "0.5068172", "0.50580996", "0.504176...
0.7491489
0
eslint noempty: 0 / eslint noparamreassign: 0 / eslint preferrestparams: 0
function splitNested(str) { return [str].join('.').replace(/\[/g, '.').replace(/\]/g, '').split('.'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addEmptyItemIfNeeded(initialItems: ?Object): Object {\n return _.isEmpty(initialItems) ? { '1': null } : initialItems;\n }", "_setParamIfEmpty(param){\r\n\t\t\r\n\t\tif(param == null) param = {};\r\n\t\t\r\n\t\tif(param['ajax_url'] == null) param['ajax_url'] = 'dummy';\r\n\t\t\r\n\t\treturn param;\r\n\t}", ...
[ "0.5616332", "0.55584323", "0.53030664", "0.5282773", "0.52214426", "0.5169118", "0.5055994", "0.5034779", "0.50234026", "0.5011705", "0.50060415", "0.498882", "0.49808842", "0.49668577", "0.49664873", "0.4960146", "0.49425292", "0.49409488", "0.4936963", "0.4906966", "0.4863...
0.0
-1
end of on click fav icon
function toggleFavorite(url, movieId, isFavored) { !isFavored ? favCount++ : favCount--; favCount > 9 ? $('#nav__fav-count').html('9+') : $('#nav__fav-count').html(favCount); $('.movie-' + movieId).toggleClass('fw-900'); if ($('.movie-' + movieId).closest('.favorite').length) { $('.movie-' + movieId).closest('.movie').remove(); }//end of if $.ajax({ url: url, method: 'POST', });//end of ajax call }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeFav(e) {\n if ($(e.target).is($(this))) {\n $(this).removeClass('favs-open');\n $favTrigger.attr('aria-expanded', false);\n $favWrapper.attr('aria-hidden', true); \n $favPanel.attr('aria-hidden', true); \n }\n }...
[ "0.7102287", "0.6714305", "0.6602222", "0.6367555", "0.6350983", "0.62708914", "0.6232233", "0.6224489", "0.6218182", "0.6196483", "0.6137929", "0.6106638", "0.6079774", "0.60511374", "0.6044465", "0.6037493", "0.59577394", "0.5939137", "0.5910749", "0.5891274", "0.58740234",...
0.0
-1
randomly selects a track
function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomIndex(){\n let last_index = audio_utility.index_curr_track;\n let current_index = getRandomIntInclusive(0, audio_utility.track_list_length-1);\n while(last_index == current_index){\n current_index = getRandomIntInclusive(0, audio_utility.track_list_length-1);\n }\n audio_utilit...
[ "0.6862653", "0.6634456", "0.66009253", "0.6591241", "0.64826614", "0.6460763", "0.6450181", "0.6431804", "0.6314623", "0.6257871", "0.6173092", "0.613817", "0.61357975", "0.6086945", "0.6075537", "0.6050641", "0.6042523", "0.6033984", "0.60284376", "0.60029864", "0.5989513",...
0.0
-1
reorganizes musicArray to prevent song repetitions
function preventRepeatingSong() { let currentVideo = player.getVideoUrl(); let currentVideoId = currentVideo.slice(currentVideo.indexOf("v="),currentVideo.length); currentVideoId = currentVideoId.slice(2, currentVideoId.length); musicArray.splice(musicArray.indexOf(currentVideoId), 1); musicArray.push(currentVideoId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function amplitude_shuffle_songs(){\n var amplitude_nodes = document.getElementById('amplitude-playlist').getElementsByTagName('audio');\n amplitude_shuffle_playlist_temp = new Array(amplitude_nodes.length);\n for (i=0; i<amplitude_nodes.length; i++) {\n amplitude_shuffle_playlist_temp[i] = amplitu...
[ "0.625816", "0.6160294", "0.6153754", "0.60650957", "0.6040407", "0.60079885", "0.5992116", "0.5948826", "0.59356004", "0.59153634", "0.58729434", "0.58645564", "0.5855034", "0.5844271", "0.58163667", "0.58055615", "0.5768132", "0.57142323", "0.570434", "0.5682144", "0.566885...
0.60283417
5
The API will call this function when the video player is ready.
function onPlayerReady(event) { event.target.playVideo(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function videoReady() { }", "function onPlayerReady(event) {\n Controller.load_video();\n }", "function videoReady() {\n console.log('Video is ready!!!');\n}", "function onPlayerReady(event) {\n event.target.loadVideo();\n }", "function onPlayerReady(event) {\n videosLoaded++;\n allV...
[ "0.8600132", "0.8431369", "0.81294066", "0.80556196", "0.7933902", "0.7930072", "0.79006296", "0.79006296", "0.79006296", "0.7893968", "0.7857887", "0.78502524", "0.7843109", "0.78053206", "0.7789895", "0.7766721", "0.7742206", "0.773466", "0.7699259", "0.76964366", "0.768277...
0.7571747
27
update the musicArray with the ids scriptInput and scriptButton and prevent duplicates
function updateMusicArray() { let addedVideo = scriptInput.value; let addedVideoId = addedVideo.slice(addedVideo.indexOf("v="),addedVideo.length); addedVideoId = addedVideoId.slice(2, addedVideoId.length); if (musicArray.includes(addedVideoId)) { alert("Video is already included in the track-list."); } else { musicArray.unshift(addedVideoId); document.getElementById("musicArrayText").innerText = musicArray; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function soundSetup(){\n updateState(false, false);\n varSong = [];\n varSongID = [];\n currentVarSongIndex = 0;\n varSongLength = 4;\n mainSong = new Howl({\n src: ['Songs/1_main.mp3'],\n loop:true\n });\n for(var x = 1; x<=varSongLength; x++){\n varSong[x-1] = new Howl({\n src: ['Songs/1_var'+x+'...
[ "0.60121244", "0.584303", "0.56773216", "0.56380814", "0.56331545", "0.561573", "0.5596808", "0.55637485", "0.5543055", "0.55359364", "0.55076516", "0.55037385", "0.5479161", "0.54761815", "0.54678607", "0.545355", "0.5438671", "0.5424687", "0.5396854", "0.5377546", "0.536396...
0.7030591
0
eg: Fri, 16 Aug 2019 10.31 AM
static momentToFormat1(momentObj) { let datetime = Moment(momentObj); return (datetime.format('ddd, DD MMM YYYY h:mm A')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processDate ( ) {\n let days = [ 'Monday', 'Tuesday', 'Wednesday',\n 'Thursday', 'Friday', 'Saturday', 'Sunday' ];\n let date = new Date ( this.data.release_date ).toDateString ( );\n let split = date.split ( ' ' );\n let fullday = days.filter ( x => x.indexOf ( split [ 0 ] )...
[ "0.62493837", "0.6209069", "0.6183403", "0.61342686", "0.6125143", "0.6122489", "0.61163497", "0.5976845", "0.5964593", "0.59612525", "0.5893081", "0.58859885", "0.5869159", "0.58680165", "0.5862874", "0.58521366", "0.58398193", "0.583723", "0.58352935", "0.58334786", "0.5830...
0.5768628
33
eg: 16 Aug 2019, Fri
static momentToFormat2(momentObj) { let datetime = Moment(momentObj); return (datetime.format('DD MMM YYYY, ddd')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processDate ( ) {\n let days = [ 'Monday', 'Tuesday', 'Wednesday',\n 'Thursday', 'Friday', 'Saturday', 'Sunday' ];\n let date = new Date ( this.data.release_date ).toDateString ( );\n let split = date.split ( ' ' );\n let fullday = days.filter ( x => x.indexOf ( split [ 0 ] )...
[ "0.67597306", "0.6539693", "0.6307408", "0.6257998", "0.6243028", "0.6188651", "0.617667", "0.61541283", "0.61515933", "0.6145621", "0.61447424", "0.6106126", "0.6094502", "0.6089331", "0.60717016", "0.6057794", "0.60168844", "0.60041237", "0.5996934", "0.5992879", "0.5971842...
0.0
-1
Loads the menu and displays it to the user.
function loadMenu() { // Load categories let categories = null; get("/api/authTable/getCategories", function (categoryData) { categories = JSON.parse(categoryData); for (var i = 0; i < categories.length; i++) { const c = categories[i]; $("#categories").append("<div class='category'>\n" + "<button id='category-" + c.categoryId + "-button' type='button' class='btn btn-block category-button' data-toggle='collapse' data-target='#category-" + c.categoryId + "'>" + c.name + "</button>\n" + "<div id='category-" + c.categoryId + "' class='collapse'>\n" + "<ul id='category-" + c.categoryId + "-list' class='menuitems list-group collapse'>\n" + "</ul>\n" + "</div>\n" + "</div>"); } // Load menu get("/api/authTable/getMenu", function (menuData) { menuItems = JSON.parse(menuData); for (let i = 0; i < menuItems.length; i++) { const menuItem = menuItems[i]; $("#category-" + menuItem.categoryId + "-list").append("<li id='menuitem-" + menuItem.id + "' class='menuitem list-group-item list-group-item-action' onclick='showItemModal(" + menuItem.id + ")' data-glutenfree='" + menuItem.is_gluten_free + "' data-vegetarian='" + menuItem.is_vegetarian + "' data-vegan='" + menuItem.is_vegan + "'>\n" + "<span class='bold'>" + menuItem.name + "</span> - £" + menuItem.price + "\n" + "<br>\n" + menuItem.description + "\n" + "<br>\n" + "</li>"); if (menuItem.is_gluten_free) { $("#menuitem-" + menuItem.id).append( "<img class='img1' src='../images/gluten-free.svg' alt='Gluten Free'>"); } if (menuItem.is_vegetarian) { $("#menuitem-" + menuItem.id).append( "<img class='img2' src='../images/vegetarian-mark.svg' alt='Vegetarian'>"); } if (menuItem.is_vegan) { $("#menuitem-" + menuItem.id).append( "<img class='img3' src='../images/vegan-mark.svg' alt='Vegan'>"); } } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadMenu(){\n\t\tpgame.state.start('menu');\n\t}", "function loadMenu() {\n // Works only with nav-links that have 'render' instead of 'component' below in return\n if (istrue) {\n // Do not show these buttons to unauthorise user\n document.getElementById(\"edit\").children[6].style.disp...
[ "0.8329624", "0.7425933", "0.7410055", "0.71553236", "0.69857335", "0.6864795", "0.68341106", "0.67985797", "0.6754066", "0.67217326", "0.67153203", "0.6648224", "0.66250205", "0.6605713", "0.660352", "0.65815604", "0.65397507", "0.6533818", "0.65158355", "0.65039533", "0.649...
0.0
-1
Checks whether a menu item meets the filter criteria and should be displayed to the user.
function meetsDietaryRequirements(mi) { gluteninput = document.getElementById("glutencheckbox"); vegetarianinput = document.getElementById("vegetariancheckbox"); veganinput = document.getElementById("vegancheckbox"); if (!gluteninput.checked || (gluteninput.checked === true & mi.dataset.glutenfree === "true")) { if (!vegetarianinput.checked || (vegetarianinput.checked === true & mi.dataset.vegetarian === "true")) { if (!veganinput.checked || (veganinput.checked === true & mi.dataset.vegan === "true")) { return true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchMenu(){\n let filter = document.getElementById(\"menu-search-bar\").value;\n filter = filter.trim().toLowerCase();\n for(item of menuItems){\n if(item.name.toLowerCase().indexOf(filter) >=0 || item.courseType.toLowerCase().indexOf(filter) >=0){\n document.getElementById(\"item-\" + i...
[ "0.6546594", "0.6094133", "0.6062806", "0.59995455", "0.5962066", "0.59302044", "0.5921651", "0.5871642", "0.5846553", "0.5836322", "0.58336216", "0.5733845", "0.5650693", "0.56337166", "0.56326663", "0.5616193", "0.5612642", "0.5598078", "0.55913156", "0.55601597", "0.554531...
0.0
-1
Filters the menu items based on the customers search and diet filters
function filtername() { var input, filter, displayMenuItems, gluteninput, vegetarianinput, veganinput; input = document.getElementById("mysearchbox"); filter = input.value.toUpperCase(); displayMenuItems = document.getElementsByClassName("menuitem"); //if there is no input on search bar, keep all menu items hidden. if (filter.length === 0) { const elementsToHide = document.getElementsByClassName("collapse show"); for (var i = 0; i < elementsToHide.length; i++) { elementsToHide[i].classList.remove("show"); } //else, when there is input, show the menu. } else { const elementsToShow = document.getElementsByClassName("collapse"); for (var i = 0; i < elementsToShow.length; i++) { elementsToShow[i].classList.add("show"); } } //goes through all childnodes of each menu item, and displays the items that meet the search and category criteria. for (var i = 0; i < displayMenuItems.length; i++) { const mi = displayMenuItems[i]; console.log(mi.dataset.glutenfree); for (var j = 0; j < mi.childNodes.length; j++) { const node = mi.childNodes[j]; if (node.className === "bold") { if(node.innerHTML.toUpperCase().indexOf(filter) > -1) { if (meetsDietaryRequirements(mi)) { mi.style.display = ""; } else { mi.style.display = "none"; } } else { mi.style.display = "none"; } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchMenu(){\n let filter = document.getElementById(\"menu-search-bar\").value;\n filter = filter.trim().toLowerCase();\n for(item of menuItems){\n if(item.name.toLowerCase().indexOf(filter) >=0 || item.courseType.toLowerCase().indexOf(filter) >=0){\n document.getElementById(\"item-\" + i...
[ "0.69359624", "0.67341053", "0.6620461", "0.64346", "0.64267033", "0.6417425", "0.63756186", "0.6363611", "0.63424784", "0.6288425", "0.6265222", "0.6261493", "0.61923075", "0.6182552", "0.61806554", "0.61764234", "0.6154403", "0.6142961", "0.61308897", "0.6130747", "0.611577...
0.6856638
1
Loads the current items in the customers order
function loadOrder() { const postData = {orderId: sessionStorage.getItem("orderId")}; post("/api/authTable/getOrderItems", JSON.stringify(postData), function (data) { const orderMenuItems = JSON.parse(data); for (let i = 0; i < orderMenuItems.length; i++) { const item = orderMenuItems[i]; addItemToBasket(item); } calculateTotal(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_loadCustomerOrders() {\n const customerId = this.customerId;\n\n this.customerRenderer.showLoadingOrders();\n $.get(this.router.generate('admin_customers_orders', {customerId})).then((response) => {\n this.customerRenderer.renderOrders(response.orders);\n }).catch((e) => {\n showErrorMessage...
[ "0.6690897", "0.6674371", "0.6672024", "0.64448595", "0.63485616", "0.61880577", "0.61743045", "0.60866195", "0.606847", "0.6049835", "0.6037822", "0.60345554", "0.59790266", "0.59779674", "0.5976755", "0.5972953", "0.594452", "0.59320724", "0.5925187", "0.5918101", "0.591177...
0.70957613
0
Adds an item to the customers basket.
function addItemToBasket(item) { const parent = $("#order"); // Add item basket.push(item); parent.append("<li id='ordermenuitem-" + item.id + "' class='list-group-item list-group-item-action'>\n" + " <span class='bold'>" + item.name + "</span>" + " <span class='span-right'>£" + item.price + "</span>\n" + " <br>\n" + " <span id='omi-instructions-" + item.id + "'><span id='omi-instructions-" + item.id + "-text'>" + item.instructions + "</span></span>\n" + " <span class='span-right'><i id='omi-edit-" + item.id + "' class='fa fa-edit fa-lg edit' onclick='showEditOrderMenuItem(" + item.id + ", \"" + item.instructions + "\");'></i><i class='fa fa-times fa-lg remove' onclick='confirmRemoveOrderMenuItem(" + item.id + ");'></i></span>\n" + "</li>"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addItem(item) {\n basket.push(item);\n return true;\n}", "function addItemToCart() {}", "function addItemToCart() {}", "function AddItem(item){\n console.log(\"Adding \" + item.Name + \" to the basket!\");\n basket.push(item);\n}", "function addItemToCart(user, item) {}", "function addItem(i...
[ "0.78531545", "0.75524104", "0.75524104", "0.75307167", "0.7469858", "0.70358354", "0.70262337", "0.7016932", "0.69937843", "0.697444", "0.69727904", "0.6948269", "0.6890161", "0.68432903", "0.67820865", "0.67208856", "0.67099977", "0.6706156", "0.6697594", "0.669391", "0.668...
0.702639
6
Calculates the total cost of all the items in the customers basket.
function calculateTotal() { // Remove old total order if it exists const parent = document.getElementById("order"); const totalPrice = document.getElementById("total-price"); if (totalPrice != null) { parent.removeChild(totalPrice); } // Calculate total let total = 0.0; for (let i = 0; i < basket.length; i++) { const item = basket[i]; total += parseFloat(item.price); } // Display it. $("#order").append("<li id='total-price' class='list-group-item list-group-item-info'>\n" + "<span class='bold'>Total:</span>" + "<span class='span-right'>£" + total.toFixed(2) + "</span>\n" + "</li>"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function total() {\n let totalCost = 0\n for (var i = 0; i < cart.length; i++) {\n for (var item in cart[i]) {\n totalCost += cart[i][item]\n }\n }\n return totalCost\n}", "function TotalCost()\n{\n\tvar totalcost = 0;\n\tfor (var i in Cart) {\n\ttotalcost += Cart[i].price;\n\t}\n\treturn totalc...
[ "0.73436016", "0.70795316", "0.6980859", "0.69061714", "0.6901665", "0.6887606", "0.6873818", "0.68311363", "0.6787308", "0.67554945", "0.67546827", "0.66837573", "0.66447794", "0.6642255", "0.6537481", "0.65290123", "0.6520859", "0.6513521", "0.6484745", "0.6463616", "0.6459...
0.5872359
81
Shows a confirmation dialog box to confirm the user wants to remove an item from their basket
function confirmRemoveOrderMenuItem(itemId) { bootbox.confirm("Are you sure you want to remove this item?", function (result) { if (result) { removeOrderMenuItem(itemId); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteItem() {\r\n if (!confirm(\"Are you sure you want to delete?\")){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n}", "onClickRemoveItem() {\n let itemName = this.props.foodItem.food_name;\n let food_id = this.props.foodItem.food_id;\n\n if (window.confirm(\"Are you sure y...
[ "0.72921664", "0.72399825", "0.70993197", "0.703807", "0.7005282", "0.6941291", "0.6918663", "0.6830213", "0.6817102", "0.6814808", "0.67819047", "0.677778", "0.6776285", "0.67742777", "0.67436516", "0.67349595", "0.6697379", "0.66814893", "0.6665107", "0.6653398", "0.6620517...
0.77474517
0
Removes a menu item from the customers order
function removeOrderMenuItem(itemId) { const dataToSend = JSON.stringify({orderMenuItemId: itemId}); post("/api/authTable/removeItemFromOrder", dataToSend, function (data) { if (data === "success") { const parent = document.getElementById("order"); const child = document.getElementById("ordermenuitem-" + itemId); parent.removeChild(child); // Remove it from the basket array for (let i = 0; i < basket.length; i++) { if (basket[i].id === itemId) { basket.splice(i, 1); } } // Recalculate the price calculateTotal(); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeItemFromMenu(event) {\n if(event.target.classList.contains('removelistitem')) {\n menu.removeItem(event.target.id);\n menu.saveToLocalStorage();\n renderMenuTable();\n }\n}", "removeDishFromMenu(item) {\n this.menu = this.menu.filter(element => element.id !== item.id);\n\n ...
[ "0.7153774", "0.7002828", "0.6926319", "0.67989844", "0.67798316", "0.6725754", "0.6680967", "0.6584663", "0.65753835", "0.6492408", "0.6491224", "0.6459137", "0.6432045", "0.6394014", "0.63868016", "0.6383855", "0.635395", "0.63530505", "0.63503224", "0.63330245", "0.6319392...
0.76243615
0
Adds an item to the customers order.
function addToOrder(itemId, instructions) { const dataToSend = JSON.stringify({ menuItemId: itemId, instructions: instructions, orderId: sessionStorage.getItem("orderId") }); post("/api/authTable/addItemToOrder", dataToSend, function (data) { if (data !== "failure") { const item = JSON.parse(data); addItemToBasket(item); calculateTotal(); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_addNewItem() {\n // Add new Item from Order's Items array:\n this.order.items = this.order.items.concat([this.item]);\n // Update current Order:\n this.orderService.setCurrentOrder(this.order);\n this._closeAddNewItem();\n }", "function addToOrder(item) {\n var table = get...
[ "0.7371496", "0.7093413", "0.6954116", "0.6954116", "0.69319373", "0.68065274", "0.6742936", "0.66140616", "0.6608702", "0.66012317", "0.65237325", "0.64737356", "0.6429142", "0.6424697", "0.6405801", "0.6383083", "0.63603973", "0.63356286", "0.63271755", "0.6282504", "0.6269...
0.70886534
2
Shows the product details and the add to order button to the user in a model.
function showItemModal(itemId) { for (let i = 0; i < menuItems.length; i++) { if (menuItems[i].id === itemId) { const item = menuItems[i]; const modal = document.getElementById("addToOrderModal"); modal.setAttribute("data-menuitemid", item.id); document.getElementById("name").innerText = item.name; document.getElementById("category").innerText = item.category; document.getElementById("description").innerText = item.description; document.getElementById("price").innerText = item.price; document.getElementById("calories").innerText = item.calories; document.getElementById("ingredients").innerText = item.ingredients; document.getElementById("picture").setAttribute("src", "../images/" + item.picture_src); // Remove any content info symbols that are already there const node = document.getElementById("content-info"); while (node.firstChild) { node.removeChild(node.firstChild); } if (item.is_gluten_free) { $("#content-info").append( "<img src='../images/gluten-free.svg' alt='Gluten Free'>"); } if (item.is_vegetarian) { $("#content-info").append( "<img src='../images/vegetarian-mark.svg' alt='Vegetarian'>"); } if (item.is_vegan) { $("#content-info").append( "<img src='../images/vegan-mark.svg' alt='Vegan'>"); } // Clear the extra instructions text input document.getElementById("instructions").value = ""; // Set the onclick for the add to order button document.getElementById("addToOrderButton").onclick = function () { addToOrder(document.getElementById("addToOrderModal").getAttribute( "data-menuitemid"), document.getElementById("instructions").value); document.getElementById('addToOrderModal').style.display = 'none'; }; modal.style.display = "block"; break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSelectProduct() {\n _$confirmModalText.text(JSON.stringify(this.model));\n _$confirmModal.modal();\n }", "function addProductToUI(product) {\n var row = $(\"<tr></tr>\");\n var colName = $(\"<td></td>\").text(product.localeData[0].title);\n var colDesc = $(\"<td></td>\").text(product.localeD...
[ "0.6579344", "0.6526556", "0.6366963", "0.629133", "0.6200135", "0.6157923", "0.6079493", "0.60674393", "0.6026862", "0.601563", "0.60132176", "0.60076416", "0.59636503", "0.59381855", "0.5932116", "0.590365", "0.58900684", "0.58897287", "0.5880766", "0.58518803", "0.58438003...
0.0
-1
Changes the instructions to a text field the user can edit.
function showEditOrderMenuItem(orderMenuItemId, instructions) { const span = $("#omi-instructions-" + orderMenuItemId); span.empty(); span.append("<input id='omi-instructions-input-" + orderMenuItemId + "' name='omi-instructions-input-" + orderMenuItemId + "' class='instructions-box' type='text' placeholder='Any extra instructions' value='" + instructions + "'>"); span.append("<i id='omi-confirm-" + orderMenuItemId + "' class='fa fa-check fa-lg confirm' onclick='confirmEditOrderMenuItem(" + orderMenuItemId + ")'></i>"); $("#omi-edit-" + orderMenuItemId).hide(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editRemarks() {\n\tdocument.getElementById('canFinalize').value = 'NO';\n}", "function setup_text_fields() {\n function field_modified(name) {\n return function() {\n SaveActions[name] = true;\n save_btn_tag.removeClass('disabled');\n };\n ...
[ "0.63066214", "0.6167441", "0.61134315", "0.60238266", "0.5946001", "0.58752173", "0.5867565", "0.58643425", "0.5852434", "0.58389056", "0.576848", "0.57407814", "0.57129556", "0.56919795", "0.5672621", "0.5668534", "0.5655739", "0.56312805", "0.55831385", "0.5565735", "0.556...
0.59081674
5
Changes the text box with the new instructions back to a normal text and sends the updated instructions to the server.
function confirmEditOrderMenuItem(orderMenuItemId) { const span = $("#omi-instructions-" + orderMenuItemId); const instructions = $("#omi-instructions-input-" + orderMenuItemId).val(); const data = JSON.stringify({ orderMenuItemId: orderMenuItemId, instructions: instructions }); post("/api/authTable/changeOrderInstructions", data, function (data) { if (data === "success") { $("#omi-confirm-" + orderMenuItemId).remove(); $("#omi-instructions-input-" + orderMenuItemId).remove(); $("#omi-edit-" + orderMenuItemId).show(); $("#omi-instructions-" + orderMenuItemId).append("<span id='omi-instructions-" + orderMenuItemId + "-text'>" + instructions + "</span>") } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateInstructions() {\n $(\".instructionPane\").html(instructionHTML);\n }", "function update_text()\n\t{\n\t\tmathjax_running = true;\n\t\tupdate_required = false;\n\n\t\t// Parse BBCode\n\t\t$('#' + buffer).html(BBCodeParser.parse(PageUtil.h(raw_text)));\n\n\t\t// Enqueue\n\t\tMathJax.Hu...
[ "0.6336976", "0.60367393", "0.6028624", "0.59917665", "0.5950955", "0.59491324", "0.58865803", "0.58449024", "0.5808645", "0.57959366", "0.57509583", "0.57492137", "0.57306916", "0.5702953", "0.5672825", "0.56556374", "0.56080747", "0.56002754", "0.55970335", "0.559451", "0.5...
0.0
-1
Confirms the order so the waiter can confirm and send it to the kitchen.
function confirmOrder() { const orderId = sessionStorage.getItem("orderId"); const dataToSend = JSON.stringify({ orderId: orderId, newOrderStatus: "READY_TO_CONFIRM" }); post("/api/authTable/changeOrderStatus", dataToSend, function (data) { if (data === "success") { window.location.replace("/customer/basket.html"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function confirmToOrder() {\n\n inquirer.prompt([\n\n {\n type: \"list\",\n name: \"confirm\",\n message: \"Would you like to place an order?\",\n choices: [\"Yes\", \"No\"]\n }\n\n]).then(function (answer) {\n\n if (answer.confirm === 'Yes'){\n orderItems();\n } else {\n console.log(\"Thank...
[ "0.6482058", "0.644253", "0.6401162", "0.63552016", "0.63115233", "0.62726295", "0.6217576", "0.6217576", "0.614981", "0.6124281", "0.6027192", "0.60023636", "0.5996436", "0.59600693", "0.5922821", "0.59218323", "0.59077895", "0.5895581", "0.5889904", "0.58837897", "0.5840525...
0.6507802
0
Sends a request to the waiter to let them know you need help.
function callWaiterToTable() { const dataToSend = JSON.stringify({newStatus: "NEEDS_HELP"}); post("/api/authTable/changeTableStatus", dataToSend, function (data) { if (data === "success") { bootbox.alert( "Your waiter has been called, and will be with you shortly."); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendRequest() {\n console.log('sending request to establish peer connection');\n var message = 'request';\n console.log('Check - '+vm.setId+' - '+vm.peerId);\n //dont request yourself!\n if (vm.peerId !== vm.setId) {\n signalingService.sendRequest(vm.setId, vm...
[ "0.61641407", "0.61181545", "0.580089", "0.5733144", "0.57205635", "0.5715712", "0.56806993", "0.5656867", "0.5598535", "0.5566023", "0.5547988", "0.55222565", "0.5463141", "0.546027", "0.5440587", "0.5425599", "0.54199404", "0.53965485", "0.5377738", "0.5361327", "0.53549397...
0.59353215
2
import data from store
function mapStateToProps(state) { return { projects:state.projects.project, toggle:state.projects } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static load (store) {\n if (!chrome.devtools) {\n _.each(['UserLevel', 'SwordLevel', 'Sword', 'Equip', 'Consumable', 'FieldSquare', \"Event\", \"EventLayer\", \"EventSquare\"], k => {\n store.commit('loadData', {\n key: k,\n loaded: true\n })\n })\n }...
[ "0.64615417", "0.635056", "0.60944736", "0.60677665", "0.6059737", "0.6059017", "0.6040525", "0.6040525", "0.6029584", "0.6003237", "0.584583", "0.58399284", "0.57970756", "0.571058", "0.5671939", "0.567001", "0.5653025", "0.5645026", "0.5613523", "0.55929375", "0.558126", ...
0.0
-1
Moves pipe to the left
update() { this.pos -= this.vel; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function swipedLeft(arg) {\n\tupdateImportance(arg.data, -1);\n}", "*directionHorizontalLeft() {\n yield this.sendEvent({ type: 0x03, code: 0x00, value: 0 });\n }", "function shiftLeft() {\n\tleft_video = current_video + 1;\n\tif (left_video >= vid_array.length) {\n\t\tleft_video = 1;\n\t}\n\tswitchT...
[ "0.6608104", "0.65019876", "0.64900446", "0.6465734", "0.6351823", "0.6343104", "0.6307015", "0.62297606", "0.6204889", "0.6200417", "0.6195992", "0.6180732", "0.61574847", "0.6110255", "0.6104469", "0.60988086", "0.6075636", "0.6070246", "0.6059934", "0.603657", "0.6029852",...
0.0
-1
Removes pipe if off screen
checkIfOnScreen(pipes) { if (this.pos < -this.pipeWidth) { pipes.splice(this, 1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){...
[ "0.60007405", "0.60007405", "0.60007405", "0.60007405", "0.5907717", "0.5823216", "0.58150893", "0.57799745", "0.57689726", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.5749785", "0.574978...
0.5841467
5
Resets pipes position to the right of screen
reset() { this.pos = width + this.pipeWidth; this.pipeHeight = random(height / 3, 2 * height / 3); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkIfOnScreen(pipes) {\n if (this.pos < -this.pipeWidth) {\n pipes.splice(this, 1);\n }\n }", "resetPos() {\n this.x = 2 * this.rightLeft;\n this.y = 4 * this.upDown + 54;\n }", "function resetScreen() {\n robot.moveMouse(rightScreen.x, rightScreen.y);\n robot.mouseClick();\n robot.keyT...
[ "0.6173469", "0.6103775", "0.5943016", "0.5942402", "0.5887538", "0.5866031", "0.5851446", "0.58292437", "0.58265144", "0.58246547", "0.57269925", "0.5721054", "0.57131195", "0.56995267", "0.5698791", "0.5681899", "0.56653696", "0.56651616", "0.5662634", "0.56585705", "0.5638...
0.64159757
0
finds all Cool program sources referenced in elements and returns them asynchonously via the completedCallback
function GetReferencedCoolSources(completedCallback) { // get all <script> elements of type "text/cool" and get the script's source as a string var coolProgramReferences = document.querySelectorAll('script[type="text/cool"]'); var coolPrograms = []; for (var i = 0; i < coolProgramReferences.length; i++) { var filename = coolProgramReferences[i].attributes['src'].value; // call a separate function here to avoid closure problem getCoolProgramText(i, filename); } function getCoolProgramText(index, filename) { makeAjaxRequest(filename, function (responseText) { coolPrograms[index] = ({ filename: filename, program: responseText }); // if all ajax calls have returned, execute the callback with the Cool source if (coolPrograms.length == coolProgramReferences.length) { completedCallback(coolPrograms.map(function (x) { return x.program; })); } }); } // generic function to make AJAX call function makeAjaxRequest(url, successCallback, errorCallback) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == XMLHttpRequest.DONE) { if (xmlhttp.status == 200) { successCallback(xmlhttp.responseText); } else { if (errorCallback) { errorCallback(); } } } }; xmlhttp.open('GET', url, true); xmlhttp.send(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findSourceResources(aSelectorFn) {\n result=[];\n //print(ttl + \"..findSourceResources() \" + \"from settings.svrURL: \" + settings.svrURL + \"/@resources\\n\" +\n // \"...using settings.intToken: \" + JSON.stringify(settings.intToken));\n var resourceNamesString = listenerUtil.restGet(\n...
[ "0.5651185", "0.55547816", "0.5308469", "0.5304417", "0.5291269", "0.5249632", "0.51789135", "0.5168949", "0.51379126", "0.51353234", "0.51309", "0.5128123", "0.5118744", "0.50984937", "0.506127", "0.5025736", "0.49993327", "0.4996772", "0.49889812", "0.4984963", "0.49796265"...
0.7245916
0
generic function to make AJAX call
function makeAjaxRequest(url, successCallback, errorCallback) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == XMLHttpRequest.DONE) { if (xmlhttp.status == 200) { successCallback(xmlhttp.responseText); } else { if (errorCallback) { errorCallback(); } } } }; xmlhttp.open('GET', url, true); xmlhttp.send(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doAJAXRequest(rtype,url,data,dataType){\n return $.ajax({\n type:rtype,\n url:url,\n data:data,\n //dataType:dataType//<-include later\n });\n }", "function ajax(query, functionName, method, payload) {\n var req ...
[ "0.7367697", "0.7197598", "0.71736264", "0.7151691", "0.7071032", "0.70672566", "0.7049878", "0.7023651", "0.7004157", "0.69736546", "0.695231", "0.69519967", "0.6913252", "0.6913252", "0.68934417", "0.68720675", "0.6870236", "0.68623143", "0.6851088", "0.6849855", "0.6835843...
0.0
-1
adds the implied classes (Object, IO, Integer, etc.) to our program node's class list
function addBuiltinObjects(programNode) { // Object class var objectClass = new CoolToJS.ClassNode('Object'); var abortMethodNode = new CoolToJS.MethodNode(); abortMethodNode.methodName = 'abort'; abortMethodNode.returnTypeName = 'Object'; abortMethodNode.parent = objectClass; objectClass.children.push(abortMethodNode); var typeNameMethodNode = new CoolToJS.MethodNode(); typeNameMethodNode.methodName = 'type_name'; typeNameMethodNode.returnTypeName = 'String'; typeNameMethodNode.parent = objectClass; objectClass.children.push(typeNameMethodNode); var copyMethodNode = new CoolToJS.MethodNode(); copyMethodNode.methodName = 'copy'; copyMethodNode.returnTypeName = 'SELF_TYPE'; copyMethodNode.parent = objectClass; objectClass.children.push(copyMethodNode); programNode.children.push(objectClass); // IO Class var ioClass = new CoolToJS.ClassNode('IO'); var outStringMethodNode = new CoolToJS.MethodNode(); outStringMethodNode.methodName = 'out_string'; outStringMethodNode.returnTypeName = 'SELF_TYPE'; outStringMethodNode.parameters.push({ parameterName: 'x', parameterTypeName: 'String' }); outStringMethodNode.parent = ioClass; ioClass.children.push(outStringMethodNode); var outIntMethodNode = new CoolToJS.MethodNode(); outIntMethodNode.methodName = 'out_int'; outIntMethodNode.returnTypeName = 'SELF_TYPE'; outIntMethodNode.parameters.push({ parameterName: 'x', parameterTypeName: 'Int' }); outIntMethodNode.parent = ioClass; ioClass.children.push(outIntMethodNode); var inStringMethodNode = new CoolToJS.MethodNode(); inStringMethodNode.methodName = 'in_string'; inStringMethodNode.returnTypeName = 'String'; inStringMethodNode.isAsync = true; inStringMethodNode.isInStringOrInInt = true; inStringMethodNode.parent = ioClass; ioClass.children.push(inStringMethodNode); var inIntMethodNode = new CoolToJS.MethodNode(); inIntMethodNode.methodName = 'in_int'; inIntMethodNode.returnTypeName = 'Int'; inIntMethodNode.isAsync = true; inIntMethodNode.isInStringOrInInt = true; inIntMethodNode.parent = ioClass; ioClass.children.push(inIntMethodNode); programNode.children.push(ioClass); // Int var intClass = new CoolToJS.ClassNode('Int'); programNode.children.push(intClass); // String var stringClass = new CoolToJS.ClassNode('String'); var lengthMethodNode = new CoolToJS.MethodNode(); lengthMethodNode.methodName = 'length'; lengthMethodNode.returnTypeName = 'Int'; lengthMethodNode.parent = stringClass; stringClass.children.push(lengthMethodNode); var concatMethodNode = new CoolToJS.MethodNode(); concatMethodNode.methodName = 'concat'; concatMethodNode.returnTypeName = 'String'; concatMethodNode.parameters.push({ parameterName: 's', parameterTypeName: 'String' }); concatMethodNode.parent = stringClass; stringClass.children.push(concatMethodNode); var substrMethodNode = new CoolToJS.MethodNode(); substrMethodNode.methodName = 'substr'; substrMethodNode.returnTypeName = 'String'; substrMethodNode.parameters.push({ parameterName: 'i', parameterTypeName: 'Int' }); substrMethodNode.parameters.push({ parameterName: 'l', parameterTypeName: 'Int' }); stringClass.parent = stringClass; stringClass.children.push(substrMethodNode); programNode.children.push(stringClass); // Bool var boolClass = new CoolToJS.ClassNode('Bool'); programNode.children.push(boolClass); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function classes(root) {\n\t\t\t\t\t\t var classes = [];\n\n\t\t\t\t\t\t function recurse(name, node) {\n\t\t\t\t\t\t if (node.children) node.children.forEach(function(child) { recurse(node.name, child); });\n\t\t\t\t\t\t else classes.push({packageName: name, className: node.name, value: node.size});\n\t\t...
[ "0.6078186", "0.59882", "0.59697807", "0.59568006", "0.59298676", "0.59283644", "0.5882288", "0.5857108", "0.5855861", "0.5852656", "0.58404225", "0.58293825", "0.5826724", "0.5822816", "0.5822047", "0.5822047", "0.5794311", "0.57835263", "0.5765428", "0.5725444", "0.5702823"...
0.62256926
0
Overide the initialize authenticator to make sure `__monkeypatchNode` run once.
init() { this.framework(framework); this.use(new SessionStrategy()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n ['post', 'get', 'put', 'patch', 'delete'].forEach((method) => {\n moduleUtils.patchModule(\n 'superagent',\n method,\n superagentWrapper\n );\n });\n }", "init() {\n // using shimmer directly cause can only be b...
[ "0.5943074", "0.5811683", "0.5780885", "0.5737202", "0.56183046", "0.5586573", "0.55326116", "0.549155", "0.5488245", "0.5471313", "0.5471313", "0.5471313", "0.5471313", "0.5471313", "0.5471313", "0.5414937", "0.53891635", "0.53858817", "0.5383071", "0.53767943", "0.5364781",...
0.0
-1
Last update: 2016/06/26 Everything between 'BEGIN' and 'END' was copied from the url above. fork from for support brower
function sM(a) { var b; if (null !== yr) b = yr; else { b = wr(String.fromCharCode(84)); var c = wr(String.fromCharCode(75)); b = [b(), b()]; b[1] = c(); b = (yr = window[b.join(c())] || "") || "" } var d = wr(String.fromCharCode(116)) , c = wr(String.fromCharCode(107)) , d = [d(), d()]; d[1] = c(); c = "&" + d.join("") + "="; d = b.split("."); b = Number(d[0]) || 0; for (var e = [], f = 0, g = 0; g < a.length; g++) { var l = a.charCodeAt(g); 128 > l ? e[f++] = l : (2048 > l ? e[f++] = l >> 6 | 192 : (55296 == (l & 64512) && g + 1 < a.length && 56320 == (a.charCodeAt(g + 1) & 64512) ? (l = 65536 + ((l & 1023) << 10) + (a.charCodeAt(++g) & 1023), e[f++] = l >> 18 | 240, e[f++] = l >> 12 & 63 | 128) : e[f++] = l >> 12 | 224, e[f++] = l >> 6 & 63 | 128), e[f++] = l & 63 | 128) } a = b; for (f = 0; f < e.length; f++) a += e[f], a = xr(a, "+-a^+6"); a = xr(a, "+-3^+b+-f"); a ^= Number(d[1]) || 0; 0 > a && (a = (a & 2147483647) + 2147483648); a %= 1E6; return c + (a.toString() + "." + (a ^ b)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get END() { return 6; }", "function adjustSpanBegin2(beginPosition) {\n var pos = beginPosition;\n while ((pos < sourceDoc.length) && (isNonEdgeCharacter(sourceDoc.charAt(pos)) || !isDelimiter(sourceDoc.charAt(pos - 1)))) {pos++}\n return pos;\n }", "function adjustSpanBegin(begi...
[ "0.6421277", "0.60679513", "0.5765159", "0.5595722", "0.558579", "0.55312395", "0.5516178", "0.54527944", "0.54402745", "0.54402745", "0.54402745", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0.54167163", "0...
0.0
-1
Build the script in Listing 31 in such a way that one variable would control the size of all the circles (meaning changing that variable should change the size of all the circles) and another one should control the radius difference for all the circles
function setup() { createCanvas(400, 400); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function set_bokeh_radius() {\n RADIUS_MIN_VAR = Math.min(bokeh_radiusMin.value, bokeh_radiusMax.value);\n RADIUS_MAX_VAR = Math.max(bokeh_radiusMin.value, bokeh_radiusMax.value);\n radiusMin = (RADIUS_MIN_VAR * Math.min(WIDTH, HEIGHT)) / 256;\n radiusMax = (RADIUS_MAX_VAR * Math.min(WIDTH, HEIGHT)) / 256;\n ...
[ "0.66542804", "0.66362405", "0.65755236", "0.6490662", "0.63981", "0.6365333", "0.6315636", "0.6312176", "0.630026", "0.62965107", "0.6291148", "0.6260898", "0.62564105", "0.62394935", "0.6214489", "0.62113225", "0.6194673", "0.61796325", "0.6149475", "0.6127785", "0.6125934"...
0.0
-1
The service is actually this function, which we call with the func that should be debounced and how long to wait in between calls
function debounce(func, wait, immediate) { var timeout; // Create a deferred object that will be resolved when we need to // actually call the func var deferred = $q.defer(); return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) { deferred.resolve(func.apply(context, args)); deferred = $q.defer(); } }; var callNow = immediate && !timeout; if (timeout) { $timeout.cancel(timeout); } timeout = $timeout(later, wait); if (callNow) { deferred.resolve(func.apply(context, args)); deferred = $q.defer(); } return deferred.promise; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function debouncer( func , timeout ) {\nvar timeoutID , timeout = timeout || 200;\nreturn function () {\nvar scope = this , args = arguments;\nclearTimeout( timeoutID );\ntimeoutID = setTimeout( function () {\n func.apply( scope , Array.prototype.slice.call( args ) );\n} , timeout );\n}\n}", "debounce(fn, quiet...
[ "0.7292353", "0.72527575", "0.71959347", "0.704033", "0.70142347", "0.6980934", "0.6979344", "0.6966226", "0.6938462", "0.69089085", "0.6895548", "0.6894507", "0.68416345", "0.6835207", "0.68262565", "0.6819591", "0.68153465", "0.6814475", "0.6814475", "0.6811435", "0.6811435...
0.0
-1
Util for finding an object by its 'id' property among an array
function findById(a, id) { for (var i = 0; i < a.length; i++) { if (a[i].id == id) return a[i]; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getById(array, id){\n let result = false\n array.forEach(object => {\n if(id === object.id){\n result = object\n }\n })\n return result\n }", "function findObById(id, arr) {\n return lodash.find(arr, function(obj) { return obj.id == id });\n }", "function findObj...
[ "0.81107444", "0.7984318", "0.79724485", "0.7954282", "0.77091575", "0.77081734", "0.75430924", "0.7506697", "0.7496117", "0.74841595", "0.7388143", "0.7360041", "0.7343788", "0.73369175", "0.7206437", "0.71979576", "0.71479046", "0.7137408", "0.7093528", "0.70909756", "0.703...
0.772842
4
Util for returning a random key from a collection that also isn't the current key
function newRandomKey(coll, key, currentKey) { var randKey; do { randKey = coll[Math.floor(coll.length * Math.random())][key]; } while (randKey == currentKey); return randKey; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomKey(collection) {\n let keys = Array.from(collection.keys());\n return keys[Math.floor(Math.random() * keys.length)];\n}", "function random_key(keys, exclude) {\n return keys[(keys.indexOf(exclude) + Math.floor(Math.random() * (keys.length - 1)) + 1) % keys.length];\n }", "_sele...
[ "0.8389413", "0.68432087", "0.6811147", "0.67932403", "0.6725988", "0.6545734", "0.6388025", "0.6319874", "0.6290437", "0.6268335", "0.6037222", "0.6012711", "0.5913117", "0.5913117", "0.5829245", "0.5797225", "0.57566464", "0.57423174", "0.5731292", "0.57159156", "0.57056063...
0.7995288
1
Merge browser pack, browserify, and CodePaths options with some default options to create full browserify options. Default options are: extensions: [".js", ".jsx"] entries: [opts.entryFile]
function createOptions(opts, paths, plugins) { var defaults = { debug: opts.debug, entries: opts.entries || [paths.entryFile], extensions: opts.extensions || [".js", ".jsx"], paths: paths.srcPaths, plugin: plugins || [], cache: opts.cache || {}, packageCache: opts.packageCache || {}, }; return Object.assign(defaults, opts); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function browserifyThoseApps(options, cb) {\n let entry = options.entry;\n let outfilePattern = options.outfilePattern;\n let dependencies = options.dependencies || [];\n let externals = options.externals || [];\n let watchFiles = options.hasOwnProperty('watchFiles') ? options.watchFiles : false;\n ...
[ "0.5962663", "0.59392846", "0.57876426", "0.5553486", "0.5461311", "0.5306602", "0.5277167", "0.5193653", "0.5187042", "0.51710844", "0.5149455", "0.5145855", "0.513054", "0.51038057", "0.5080869", "0.5077297", "0.5077297", "0.5062954", "0.50248617", "0.5017232", "0.500823", ...
0.638709
0
Setup a browserify/watchify rebundler given an initial stream and further stream transforms. This method does roughly the equivalent of bundler.pipe(...).pipe(...).pipe..., as well as adding a bundler.on('update', ...) listener which reruns the bundler piping process whenever bundle updates are detected. The major reason to use this method instead of hand rolling the pipe() calls is the detailed error handling this method adds to each pipe() step.
function setupRebundleListener(rebuildOnSrcChange, verbose, bundler, getSourceStreams, additionalStreamPipes, listeners) { listeners = listeners || {}; function rebundle(updateEvent) { var expectedTotal = 0; var expectDoneFiles = []; var doneFiles = []; var skippedFiles = []; var startTime = Date.now(); var startTimes = {}; var endTimes = {}; function startCb(file) { startTimes[file] = Date.now(); expectDoneFiles.push(file); if (verbose) { log("start building '" + file + "'..."); } if (listeners.startBundle) { tryCall(listeners.startBundle, file); } } function doneCb(srcName, file, type) { endTimes[file] = Date.now(); if (type === "compile") { doneFiles.push(file); if (listeners.finishBundle) { tryCall(listeners.finishBundle, file); } } else if (type === "skip") { skippedFiles.push(file); if (listeners.skipBundle) { tryCall(listeners.skipBundle, file); } } else { var errMsg = "invalid bundle completion type (expected: 'compile' or 'skip'): " + type; console.error(errMsg); if (listeners.error) { tryCall(listeners.error, srcName, file, errMsg); } return; } var totalDone = doneFiles.length + skippedFiles.length; if (totalDone >= expectedTotal) { var endTime = Date.now(); var bldMsg = doneFiles.length > 0 ? doneFiles.map(function (f) { return f + " (" + (endTimes[file] - startTimes[file]) + " ms)"; }).join(", ") : null; var skpMsg = skippedFiles.length > 0 ? "skipped: " + skippedFiles.join(", ") : null; var buildMsg = "done building (" + (endTime - startTime) + " ms): " + (bldMsg ? bldMsg + (skpMsg ? " | " + skpMsg : "") : (skpMsg ? skpMsg : "no bundles")); if (verbose) { log(buildMsg); } if (listeners.finishAll) { tryCall(listeners.finishAll, { buildMsg: buildMsg, totalTimeMillis: endTime - startTime, builtBundles: doneFiles.map(function (f) { return ({ fileName: f, timeMillis: (endTimes[f] - startTimes[f]) }); }), skippedBundles: skippedFiles.map(function (f) { return ({ fileName: f, timeMillis: (endTimes[f] - startTimes[f]) }); }), }); } } } function createErrorCb(srcName, dstFile) { return function (err) { console.error("error building '" + dstFile + "' at stream '" + srcName + "'", err); if (listeners.error) { tryCall(listeners.error, srcName, dstFile, err); } }; } function startStreams(bundleStreams) { expectedTotal = bundleStreams.length; bundleStreams.forEach(function (bundle) { var dstFilePath = bundle.dstFileName; var resStream = bundle.stream; if (resStream == null) { doneCb("initial-stream", dstFilePath, "skip"); return; } resStream.on("error", createErrorCb("initial-stream", dstFilePath)); for (var i = 0, size = additionalStreamPipes.length; i < size; i++) { var streamName = additionalStreamPipes[i][0]; var streamCreator = additionalStreamPipes[i][1]; resStream = streamCreator(resStream, bundle); resStream.on("error", createErrorCb(streamName, dstFilePath)); } resStream.on("end", function () { return doneCb(streamName, dstFilePath, "compile"); }); startCb(dstFilePath); }); } var bundles = getSourceStreams(bundler, updateEvent); bundler.pipeline.on("error", createErrorCb("initial-stream", "bundle")); if (isPromise(bundles.bundleStreams)) { bundles.bundleStreams.then(function (streams) { return startStreams(streams); }, createErrorCb("creating initial-stream", "multi-stream-base")); } else { startStreams(bundles.bundleStreams); } } if (rebuildOnSrcChange) { bundler.on("update", rebundle); } rebundle(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bundlePipe (onFinish) {\n var stream = b.bundle()\n .pipe(zlib.createGzip({level: zlib.Z_BEST_COMPRESSION}))\n .pipe(fs.createWriteStream(bundles_target + '/' + module + '.js'));\n if (typeof onFinish === 'function') {\n stream.on('finish', onFinish);\n ...
[ "0.65482754", "0.63993907", "0.61874443", "0.6103823", "0.57085663", "0.5681246", "0.56087965", "0.5597793", "0.55820274", "0.55474615", "0.5523728", "0.5503719", "0.5476412", "0.5429697", "0.5413252", "0.53887784", "0.5371574", "0.5366755", "0.53527385", "0.53102314", "0.529...
0.6311176
2
Add a dependency tracker to the provided 'bundler'
function addDependencyTracker(baseDir, bundler, filter) { var res = { bundler: bundler, allDeps: {} }; bundler.on("dep", function (evt) { if (filter != null && !filter(evt)) { return; } // relativize file absolute path to project directory var file = path.relative(baseDir, evt.file); // remove file extension file = file.substr(0, file.length - path.extname(file).length); // relative directory var fileDir = path.dirname(file); // resolve dependencies based on file directory relative to project directory var deps = Object.keys(evt.deps).map(function (d) { return path.join(fileDir, d); }); // save the dependencies res.allDeps[file] = deps; }); return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addDependsOn(serviceName) {\n this.dependsOn.push(serviceName);\n }", "registerDependency(dependency) {\n this.allDependencies.push(dependency)\n }", "addBundledDeps(...deps) {\n if (deps.length && !this.allowLibraryDependencies) {\n throw new Error(`cannot add bundled dependenc...
[ "0.6029545", "0.6025915", "0.5773088", "0.56944126", "0.5647646", "0.55890507", "0.54927444", "0.54927444", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", "0.54770714", ...
0.6626021
0
Check for circular dependencies in the 'allDeps' map
function detectCircularDependencies(entryFile, allDeps) { var paths = [entryFile]; var entryDeps = allDeps[entryFile]; if (entryDeps != null) { if (walkDeps(allDeps[entryFile], paths, allDeps)) { return paths; } } else { // helpful error for common function call mistake when using this with TsBrowserify or similar tool that mixes file paths containing extensions with require(...) paths without extensions throw new Error("No dependencies found for entry file '" + entryFile + "'"); } return []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkNodesForCircularDependencies(graph) {\n // for each node in the dependency graph, check for circular dependencies\n for (let nodeName in this.graph.nodes) {\n let dependencyPathTaken = []; // record of path when looking for cicular dependency; reset each time\n logger_1.def...
[ "0.6668544", "0.6586864", "0.65442044", "0.6536909", "0.64989215", "0.6491818", "0.6366252", "0.62900925", "0.6215448", "0.6205266", "0.59345293", "0.59084374", "0.5782645", "0.57522196", "0.57522196", "0.573824", "0.5731477", "0.5723653", "0.5717823", "0.5668789", "0.5668728...
0.71695656
0
recursively walk children, building a parent path as we go, return true when a circular path is encountered
function walkDeps(childs, path, tree) { for (var i = 0, size = childs.length; i < size; i++) { var cur = childs[i]; // check if the path contains the child (a circular dependency) if (path.indexOf(cur) > -1) { path.push(cur); return true; } // walk the children of this child var curChilds = tree[cur]; if (curChilds != null) { // push and pop the child before and after the sub-walk path.push(cur); // recursively walk children var res = walkDeps(curChilds, path, tree); if (res) return res; path.pop(); } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isParent(thing, relative) {\n var i;\n var temp;\n if (thing === relative) {\n return true;\n }\n if (!thing.children) {\n return false;\n }\n for (i = 0; i < thing.children.length; i++) {\n if (isParent(thing.children[i], relativ...
[ "0.65786517", "0.62632096", "0.6141144", "0.6136606", "0.6136606", "0.6067049", "0.6067049", "0.6067049", "0.6067049", "0.6067049", "0.6067049", "0.6026796", "0.59909034", "0.58907455", "0.57857996", "0.57372737", "0.5711421", "0.56910646", "0.5674979", "0.56487083", "0.56487...
0.71117604
0
Given a set of 'options' objects, create a shallow copy, lefttoright, of the nonnull objects, or return the nonnull object if only one nonnull parameter is provided
function combineOpts() { var opts = []; for (var _i = 0; _i < arguments.length; _i++) { opts[_i] = arguments[_i]; } var validOpts = []; for (var i = 0, size = opts.length; i < size; i++) { if (opts[i] != null) { validOpts.push(opts[i]); } } if (validOpts.length < 2) { return validOpts[0]; } else { validOpts.unshift({}); return Object.assign.apply(null, validOpts); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getOptions(options) {\n\n if(_.isNil(options)) {\n options = {};\n }\n\n if (_.isNil(options.items)) {\n options.items = 1;\n }\n\n if (_.isNil(options.delete)) {\n options.delete = false;\n }\n\n if (options.delete) {\n ...
[ "0.59673554", "0.54036415", "0.54001105", "0.5350201", "0.53455365", "0.53293675", "0.5322498", "0.53205764", "0.5262921", "0.5247444", "0.5230417", "0.5230417", "0.5199346", "0.519535", "0.51921254", "0.51783097", "0.5164866", "0.51594085", "0.5146098", "0.5140963", "0.51351...
0.5500048
1
based on the examples available at
function createGraph(data){ var numNodes = 50; var nodes = data.map(function(d, i) { return { radius: sqrtScale(d.millions), category: Math.floor(i/10), airport: d.airport, total: d.passengers_2017, city: d.city_served, millions: d.milllions } }); /* - initialize a force layout, passing in a reference to the nodes -forceManyBody() creates a “many-body” force that acts on all nodes, meaning this can be used to either attract all nodes to each other or repel all nodes from each other. - apply a positive strngth value to attract. - forceX() centers each category around the respective x coordinate specified in the var XCenter - forceY() centers each category around the same specified y coordinate (190) */ var simulation = d3.forceSimulation(nodes) .force('charge', d3.forceManyBody().strength(7)) .force('x', d3.forceX().x(function(d) { return xCenter[d.category]; //return xScale(d.category); })) .force('y', d3.forceY().y(function(d) { return 190; })) .force('collision', d3.forceCollide().radius(d=> d.radius)) .on('tick', ticked); /* With on("tick", …), we are specifying how to take those updated coordinates and map them on to the visual elements in the DOM. */ function ticked() { var u = select('#numbers svg > g') .selectAll('circle') .data(nodes); var u2= u.enter() .append('circle') .attr('r', d =>d.radius) .attr("class", "node") .style('fill', function(d) { return colorScale[d.category]; }) .append('title') .text(d=>{return d.airport+" | City served: "+ d.city +" | Number of Passengers: "+d.total}); //on every tick through time, take the new x/y values for each circle and update them in the DOM //d3 calculates these x/y values and appends them to the existing objects in our original nodes dataset u2.merge(u) .attr('cx', d => d.x) .attr('cy',d => d.y) u.exit().remove(); // console.log(nodes); /* var text = select('#numbers svg > g') .append("text") .attr("x", 5) .attr("y", 400) .text( "Passenger Numbers in 2017 including terminal passengers .") .attr("dy", "1em") .attr("fill", "#333"); */ var legend = select("#numbers svg").selectAll(".legend") .data(ranges) .enter().append("g") .attr("class", "legend") .attr("transform", (d, i)=> { return "translate(0," + (i+2) * 24 + ")"; }); legend.append("rect") .attr("x", rangesWidth - 68) .attr("width", 20) .attr("height", 20) .style("fill", (d,i)=>colorScale[i]); legend.append("text") .attr("x", rangesWidth - 74) .attr("y", 12) .attr("dy", ".35em") .style("text-anchor", "end") .text(d=>d); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "obtain(){}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "initialize() {...
[ "0.6249054", "0.61207354", "0.5688241", "0.5652461", "0.55740887", "0.5562143", "0.5559621", "0.5525219", "0.5525219", "0.5525219", "0.5525219", "0.5525219", "0.5525219", "0.5519751", "0.55109024", "0.54526246", "0.54324037", "0.5412216", "0.54038656", "0.5373169", "0.5373169...
0.0
-1
The addPhraseToDisplay method: Creates a list item element for each letter and space in the given phrase. Adds the list items to the UL in the 'phrase' div.
addPhraseToDisplay() { for (let i = 0; i < this.phrase.length; i++) { let listItem = document.createElement('li'); (/\s/g.test(this.phrase.charAt(i))) ? listItem.className = 'space' : listItem.classList.add('hide', 'letter', `${this.phrase.charAt(i)}`); //If the character is a space, it is given a different class name. listItem.innerHTML = `${this.phrase.charAt(i)}`; document.getElementById('phrase').children[0].appendChild(listItem); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addPhraseToDisplay() {\r\n const phraseDiv = document.querySelector(\"#phrase\");\r\n const ul = phraseDiv.querySelector(\"ul\");\r\n for (let i = 0; i < this.phrase.length; i++) {\r\n const li = document.createElement(\"li\");\r\n li.textContent = this.phrase[i];\r\n ...
[ "0.8781155", "0.85506594", "0.85143125", "0.8478631", "0.8404208", "0.8370243", "0.83626145", "0.8360786", "0.8346124", "0.8333358", "0.82848793", "0.82636285", "0.8241474", "0.8240428", "0.82289034", "0.8222986", "0.8217039", "0.8215389", "0.8209101", "0.81878376", "0.816475...
0.7979117
38
The checkLetter method: Accepts a letter as a parameter. If the active phrase includes the given letter, it returns true.
checkLetter(letter) { if (this.phrase.includes(letter)) { return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkLetter(letter) {\n if (this.phrase.includes(letter)) {\n return true;\n } else {\n return false;\n }\n }", "checkLetter(letter) {\r\n // return true/false if passed letter, matches letter in phrase\r\n return this.phrase.includes(letter) ? true : false;\r\...
[ "0.87091476", "0.86987036", "0.86860406", "0.8622862", "0.8615918", "0.85853875", "0.8554518", "0.85086244", "0.84589833", "0.8450262", "0.8450262", "0.84481806", "0.8430045", "0.8416407", "0.836383", "0.83588785", "0.83105826", "0.82785594", "0.82606035", "0.8249057", "0.821...
0.8268021
18
The showMatchedLetter method: Accepts a letter as a parameter. Removes the 'hide' class and adds the 'show' class to all the matching letters in the phrase.
showMatchedLetter(letter) { let letters = document.getElementsByClassName(letter); for (let i = 0; i < letters.length; i++) { if (letters[i].innerHTML === letter) { letters[i].classList.remove('hide'); letters[i].classList.add('show'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showMatchedLetter(letter) {\r\n const letters = Array.from(document.getElementsByClassName(letter));\r\n letters.forEach(match => {\r\n match.classList.remove('hide');\r\n match.classList.add('show');\r\n });\r\n }", "showMatchedLetter(letter) {\r\n\r\n // Get...
[ "0.8513973", "0.850368", "0.8430845", "0.8408163", "0.8275841", "0.8239807", "0.82377994", "0.8217139", "0.8179612", "0.8159915", "0.81547004", "0.812789", "0.80718374", "0.80426794", "0.8040258", "0.80238235", "0.8021834", "0.7997904", "0.79789376", "0.7977448", "0.79643834"...
0.7976782
20
todo generate a random place
set visit(visitor){ if(!this.visiting){ this.visiting = { current: this.clock.date, occupants: [] }; } this.visiting.occupants.push(visitor); // todo check trigger events }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomLocation() {\n\n}", "function randomPosition() {\n var random = Math.floor(Math.random() * 10);\n return random;\n}", "function randomLocation(){\n var max = 400;\n var min = 0;\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function randomOffset() {\n\t\t\tret...
[ "0.79621756", "0.73283", "0.73054934", "0.7095919", "0.70851237", "0.7065577", "0.70507455", "0.7016517", "0.7016194", "0.70055014", "0.69878066", "0.6960531", "0.6940205", "0.6929497", "0.6900161", "0.6872857", "0.6843588", "0.67999643", "0.67841136", "0.6773233", "0.6689517...
0.0
-1
Call update in loop
update (delta) { if (this.mixer) { this.mixer.update(delta) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async update() {}", "function update() {}", "function updateLoop(){\n\t\t\t\t\tvar time = this.update();\n\n\t\t\t\t\t// set timer for next update\n\t\t\t\t\tthis.updateTimer = setTimeout(updateLoop.bind(this), 1000 - time.getMilliseconds());\n\t\t\t\t}", "function runUpdate(){\n people.forEach(functi...
[ "0.8181664", "0.7915289", "0.76474386", "0.75155884", "0.748881", "0.748881", "0.748881", "0.748881", "0.748881", "0.748881", "0.748881", "0.748881", "0.748881", "0.7451391", "0.7385", "0.72858834", "0.7233399", "0.71712804", "0.710433", "0.7066083", "0.70589", "0.70589", ...
0.0
-1
from Django docs to get csrf token using jQuery
function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) === (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCSRFToken() {\r\n var csrfToken = $('#forgeryToken').val();\r\n return csrfToken;\r\n }", "function authToken() {\n return $('meta[name=\"csrf-token\"]').attr('content');\n}", "function ajaxCsrfToken() {\n\t$.ajaxSetup({\n\t headers: { 'X-CSRF-Token' : $('meta[name=_token]').att...
[ "0.79845357", "0.79074097", "0.7589329", "0.7508163", "0.7481506", "0.744485", "0.74270856", "0.7418959", "0.74079454", "0.74018127", "0.7293658", "0.7286877", "0.7210181", "0.7185028", "0.7154946", "0.70151967", "0.6964115", "0.69359493", "0.6709752", "0.65040374", "0.649025...
0.0
-1
Component Lifecycle Functions ComponentWillMount ComponentDidMount ! ComponentWillRecieveProps ComponentWillUpdate ComponentDidUpdate
componentDidMount() { // Materialize Component Initialization // $('#select').materialize-select(); // Ajax Calls To Grab Component Data $.ajax({ type: 'GET', url: '/boards', dataType: 'JSON' }).success( boards => { // once we have data back, we set state this.setState({ boards, loading: false }); // named same, so you dont need to put data after boards: }).fail( data => { // handle with alert or flash this.setState({ loading: false }); console.log(data); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() { this.props.events.on('update', this.forceUpdate); }", "componentDidMount() {\n this.componentDidUpdate();\n }", "componentDidMount(){\n this.componentDidUpdate();\n }", "componentDidMount(props) {\n\n }", "componentDidMount() {\n this.update(this.props)\n }", "com...
[ "0.7613408", "0.7522502", "0.7448238", "0.7443576", "0.7367286", "0.73608565", "0.7341249", "0.73318285", "0.7317524", "0.7292225", "0.724198", "0.7239525", "0.7238141", "0.7229315", "0.7229315", "0.7229315", "0.7229315", "0.7229315", "0.7229315", "0.7229315", "0.7229315", ...
0.0
-1
(Internal) converts a percentage (`0..1`) to a bar translateX percentage (`100%..0%`).
function toBarPerc(n) { return (-1 + n) * 100; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function barXFunc (d, i) { return (i * barwidth)+\"%\" ; }", "function xValFromPct(percent) {\n return percent * canvas.width / 100;\n}", "function toBarPerc(n) {\nreturn (-1 + n) * 100;\n}", "function pctFromXVal(xValue) {\n return xValue * 100 / canvas.width;\n}", "setPercentage(percentage) {\n ...
[ "0.6634575", "0.653026", "0.6516677", "0.6515595", "0.6494832", "0.64742875", "0.64114827", "0.6394538", "0.6394538", "0.6394538", "0.6394538", "0.6394538", "0.6394538", "0.6376479", "0.6370016", "0.6367201", "0.6324211", "0.6291986", "0.62890375", "0.6282405", "0.6278994", ...
0.6299756
51
(Internal) returns the correct CSS for changing the bar's position given an n percentage, and speed and ease from Settings
function barPositionCSS(n, speed, ease) { var barCSS; if (Settings.positionUsing === 'translate3d') { barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' }; } else if (Settings.positionUsing === 'translate') { barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' }; } else { barCSS = { 'margin-left': toBarPerc(n)+'%' }; } barCSS.transition = 'all '+speed+'ms '+ease; return barCSS; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function barPositionCSS(n, speed, ease) {\nvar barCSS;\nif (Settings.positionUsing === 'translate3d') {\nbarCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };\n} else if (Settings.positionUsing === 'translate') {\nbarCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };\n} else {\nbarCSS = { 'margin-left'...
[ "0.84420997", "0.84033936", "0.83595365", "0.8358633", "0.8358633", "0.8349349", "0.8310954", "0.8310954", "0.65682817", "0.6027478", "0.5938657", "0.59359753", "0.59084064", "0.5865465", "0.57943", "0.5786332", "0.57675296", "0.5726657", "0.5726514", "0.5720939", "0.5716786"...
0.83148575
38
(Internal) Determines if an element or space separated list of class names contains a class name.
function hasClass(element, name) { var list = typeof element == 'string' ? element : classList(element); return list.indexOf(' ' + name + ' ') >= 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasClass(element, name) {\n\t var list = typeof element == 'string' ? element : classList(element);\n\t return list.indexOf(' ' + name + ' ') >= 0;\n\t }", "function hasClass(element, name) {\n\t var list = typeof element == 'string' ? element : classList(element);\n\t return list.indexOf('...
[ "0.83630496", "0.83630496", "0.83630496", "0.83630496", "0.83361906", "0.83361906", "0.83361906", "0.81867284", "0.8118611", "0.8019984", "0.80107343", "0.79360753", "0.7923158", "0.7831756", "0.7820544", "0.7813132", "0.78125554", "0.7802387", "0.77726287", "0.77571684", "0....
0.83775866
30
(Internal) Adds a class to an element.
function addClass(element, name) { var oldList = classList(element), newList = oldList + name; if (hasClass(oldList, name)) return; // Trim the opening space. element.className = newList.substring(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addClass(element, classname) {\n\tvar classes = getClassList(element);\n\tif (indexOf(classname, classes) < 0) {\n\t\tclasses[classes.length] = classname;\n\t\tsetClassList(element,classes);\n\t}\n}", "function addClass (element, classname) {\n if (element.classList) {\n element.classList.add(cl...
[ "0.78299135", "0.7782592", "0.7721232", "0.7686917", "0.7636375", "0.760742", "0.760149", "0.7600813", "0.75741833", "0.75349927", "0.7521864", "0.7503874", "0.7490196", "0.74850684", "0.74850684", "0.74472296", "0.74158365", "0.7412106", "0.74026066", "0.7391322", "0.7379696...
0.0
-1
(Internal) Removes a class from an element.
function removeClass(element, name) { var oldList = classList(element), newList; if (!hasClass(element, name)) return; // Replace the class name. newList = oldList.replace(' ' + name + ' ', ' '); // Trim the opening and closing spaces. element.className = newList.substring(1, newList.length - 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeClass(element, classname) {\n\tvar classes = getClassList(element);\n\tvar index = indexOf(classname,classes);\n\tif (index >= 0) {\n\t\tclasses.splice(index,1);\n\t\tsetClassList(element, classes);\n\t}\n}", "function removeClass(_element, _class) {\n\t// variables\n\tvar classExists = false, // ...
[ "0.8250715", "0.81225693", "0.8054095", "0.8019471", "0.8018517", "0.8002591", "0.79266113", "0.79038703", "0.78412026", "0.7821953", "0.78212357", "0.77817875", "0.77571857", "0.7691068", "0.76683384", "0.7624005", "0.76120305", "0.7611323", "0.7599885", "0.7593325", "0.7560...
0.74823475
61
(Internal) Gets a space separated list of the class names on the element. The list is wrapped with a single space on each end to facilitate finding matches within the list.
function classList(element) { return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function classList(element) {\n\t return (' ' + (element.className || '') + ' ').replace(/\\s+/gi, ' ');\n\t }", "function classList(element) {\n\t return (' ' + (element.className || '') + ' ').replace(/\\s+/gi, ' ');\n\t }", "function classList(element) {\n\t return (' ' + (element.className || ''...
[ "0.8214511", "0.8214511", "0.8214511", "0.8214511", "0.81789786", "0.8097902", "0.80877435", "0.80877435", "0.79918617", "0.7832867", "0.7622634", "0.7500801", "0.7420251", "0.72718614", "0.70544827", "0.70544827", "0.70544827", "0.69790417", "0.69193625", "0.6815024", "0.681...
0.8207224
33
(Internal) Removes an element from the DOM.
function removeElement(element) { element && element.parentNode && element.parentNode.removeChild(element); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeElement() {\n this.el.parentNode.removeChild(this.el);\n }", "static deleteDomElement(element) {\n element.parentNode.removeChild(element);\n }", "function removeElement(elem){ if (elem) elem.parentNode.removeChild(elem) }", "function removeElement(elem){ if (elem) elem.parentNode.remove...
[ "0.77578187", "0.7495747", "0.7429648", "0.7429648", "0.7335784", "0.7306875", "0.7275354", "0.7228177", "0.71998936", "0.71019304", "0.70701003", "0.7066649", "0.70618546", "0.7054232", "0.7050688", "0.6950629", "0.6940447", "0.6923647", "0.6923647", "0.6923647", "0.6923647"...
0.6841415
55
Ecma International makes this code available under the terms and conditions set forth on (the "Use Terms"). Any redistribution of this code must retain the above copyright and this notice and otherwise comply with the Use Terms. / es5id: 15.2.3.54285 description: > Object.create one property in 'Properties' is a Date object that uses Object's [[Get]] method to access the 'set' property (8.10.5 step 8.a) includes: [runTestCase.js]
function testcase() { var dateObj = new Date(); var data = "data"; dateObj.set = function (value) { data = value; }; var newObj = Object.create({}, { prop: dateObj }); var hasProperty = newObj.hasOwnProperty("prop"); newObj.prop = "overrideData"; return hasProperty && data === "overrideData"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testcase() {\n function base() {}\n var b = new base();\n var prop = new Object();\n var d = Object.create(b);\n\n if (typeof d === 'object') {\n return true;\n }\n }", "static createProperty(e,t=defaultPropertyDeclaration){// Do not generate an accessor if the prototype already h...
[ "0.63572955", "0.62582314", "0.58445114", "0.58234966", "0.5691528", "0.5673719", "0.5670011", "0.55162007", "0.5464216", "0.54375297", "0.54375297", "0.54008764", "0.53765005", "0.53755003", "0.5353464", "0.5338823", "0.52940845", "0.52899784", "0.52817965", "0.52784115", "0...
0.7358187
0
Register a new folder to sync. All files are added to the database recursively.
static addNewFolder(username, syncPath) { const directory = path.resolve(process.env.PD_FOLDER_PATH, username, syncPath); const fileList = metaUtils.getFileList(directory); _.each(fileList, (file) => { Databases.fileMetaDataDb.insert(metaUtils.getFileMetadata(username, file)); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addFolder(path) {\r\n addCustomFolder(path);\r\n }", "function updateFolder(iid, type){\n if(currentFolder == \"root\") return;\n var folder = JSON.parse(localStorage.getItem(\"_Folders__\"+currentFolder));\n\n if(type == -1)\n folder.id.splice(folder.id.indexOf(iid),1);\n \n else \n folder.id.p...
[ "0.6373083", "0.62828857", "0.6152957", "0.6028344", "0.60235107", "0.5921698", "0.5913805", "0.5884406", "0.5847943", "0.5842436", "0.57973343", "0.57706654", "0.5747422", "0.5683525", "0.5660866", "0.5628417", "0.56211436", "0.55424845", "0.55224746", "0.55138564", "0.54962...
0.71834916
0
Add new single file to sync.
static addNewFile(username, fullPath) { const entry = metaUtils.getFileMetadata(username, fullPath); Databases.fileMetaDataDb.update({path: entry.path}, entry, {upsert: true}, (err, doc) => { if (err) { console.log("could not insert : " + err); } else { console.log('Inserted'); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addFile(fileentry)\n {\n fileentry.peer = \"\" // File is shared by us\n fileentry.name = fileentry.file.name\n\n db.files_put(fileentry, function(error, result)\n {\n if(error)\n console.error(error)\n\n // Notify that the file have been hashed\n else if(self.onhashed)...
[ "0.7210007", "0.68760765", "0.6780189", "0.6696433", "0.64591885", "0.645249", "0.6372322", "0.6353797", "0.6321917", "0.6291319", "0.628938", "0.6272218", "0.6258834", "0.6249308", "0.6246933", "0.6205831", "0.6072826", "0.6072212", "0.60287434", "0.60208046", "0.60112035", ...
0.6781218
2
Update the current checksum field of an existing entry.
static updateCurrentCheckSum(fullPath, checkSum) { const path = _.replace(fullPath, process.env.PD_FOLDER_PATH, ''); Databases.fileMetaDataDb.update({path: path}, {$set: {current_cs: checkSum}}, {}, (err, numReplaced) => { }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checksum() {\n const buf = this.buffer();\n if (buf.length !== 4340) {\n throw new Error('Can only checksum a save block');\n }\n\n // Exclude the existing checksum, then CRC the block\n const dbuf = new Buffer(4336);\n buf.copy(dbuf, 0, 4);\n this.set('checksum', ~crc.crc16ccitt(dbuf) & 0xFFFF)...
[ "0.627834", "0.50350267", "0.5029998", "0.5013496", "0.5000467", "0.49606872", "0.49074638", "0.48740715", "0.4869144", "0.4863068", "0.48421544", "0.47997972", "0.47446272", "0.47335356", "0.47234735", "0.47234735", "0.47167933", "0.47102267", "0.47031474", "0.47031474", "0....
0.6017338
1
Update the path field of existing entries when renamed.
static updateMetadataForRenaming(oldPath, newPath) { let regex = new RegExp(oldPath); Databases.fileMetaDataDb.find({path: {$regex: regex}}, (err, docs) => { _.each(docs, (doc) => { const newPath = (doc.path).replace(regex, newPath); doc.oldPath = doc.path; doc.path = newPath; Databases.fileMetaDataDb.update({path: doc.oldPath}, doc, {}, (err, numReplaced) => { }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "[_changePath] (newPath) {\n // have to de-list before changing paths\n this[_delistFromMeta]()\n const oldPath = this.path\n this.path = newPath\n const namePattern = /(?:^|\\/|\\\\)node_modules[\\\\/](@[^/\\\\]+[\\\\/][^\\\\/]+|[^\\\\/]+)$/\n const nameChange = newPath.match(namePattern)\n if...
[ "0.6614235", "0.64706343", "0.63814765", "0.61266446", "0.5995392", "0.588006", "0.5840417", "0.5823939", "0.5814879", "0.5780115", "0.5730894", "0.5703801", "0.57026887", "0.5669977", "0.56522644", "0.5647009", "0.5613914", "0.55653274", "0.5561866", "0.5547402", "0.5545699"...
0.6999919
0
Delete single file from meta data DB.
static deleteEntry(path) { Databases.fileMetaDataDb.remove({path: path}, (err, numDeleted) => { if (err) { console.log(err); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "delete(fileID) {\n return this.ready.then(db => {\n const transaction = db.transaction([STORE_NAME], 'readwrite');\n const request = transaction.objectStore(STORE_NAME).delete(this.key(fileID));\n return waitForRequest(request);\n });\n }", "function deleteFromMetaFile(index) {\n files_met...
[ "0.6989686", "0.68779194", "0.66720486", "0.66058576", "0.66056955", "0.6566303", "0.6542845", "0.6527612", "0.65160334", "0.64977455", "0.64340365", "0.64320177", "0.63788784", "0.63765717", "0.63665605", "0.6364746", "0.63518393", "0.63490963", "0.63369656", "0.6324851", "0...
0.7680326
0
as few characters as possible from str.
function balanceParens(str) { // Counts opens - closed. let opens = 0; // First pass: Remove extra close-parens let firstPass = []; for (let char of str) { if (char === '(') { opens += 1; firstPass.push('('); } else if (char === ')') { if (opens === 0) { // We have to remove this character } else { opens -= 1; firstPass.push(')'); } } else { firstPass.push(char); } } // Second pass: remove extra open-parens let output = []; for (let char of firstPass) { if (opens > 0 && char === '(') { // Remove this one opens -= 1; } else { output.push(char); } } return output.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function charactersLong(str){\n if( str.length <= 20){\n return str + str;\n } else {\n return str.slice(0,str.length/2);\n } \n }", "function constantLength ( str ) {\n return (str + \" \").slice(0,8);\n}", "function longString(str) {\n if (str.length...
[ "0.7018939", "0.6752478", "0.6597846", "0.65808046", "0.65570694", "0.6514993", "0.648797", "0.64469254", "0.64469254", "0.6436643", "0.6435429", "0.64293724", "0.63862336", "0.6374462", "0.63716567", "0.6343907", "0.6343608", "0.6245007", "0.6230537", "0.62231797", "0.621820...
0.0
-1
renderTable renders the filteredData to the tbody
function renderTable() { var tbody = d3.select("tbody"); tbody.html(""); // Iterate through each fileteredData and pend to table filteredData.forEach(sighting => { var tbl_col = Object.keys(sighting); // console.log(tbl_col); var row = tbody.append("tr"); tbl_col.forEach(s_info => { row.append("td").text(sighting[s_info]); // console.log(sighting); // console.log(tbl_col); // console.log(s_info); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get the current object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $t...
[ "0.83170396", "0.80801255", "0.7957967", "0.7643406", "0.75485605", "0.7458459", "0.74416643", "0.73731595", "0.7355464", "0.73297876", "0.7311626", "0.7288826", "0.7209703", "0.7167867", "0.7133188", "0.7004345", "0.6978698", "0.69197655", "0.68960696", "0.68590313", "0.6856...
0.6764458
24
fin de script JQ
function getXhr() { var xhr = null; if (window.XMLHttpRequest) // Firefox et autres xhr = new XMLHttpRequest(); else if (window.ActiveXObject) { // Internet Explorer try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } } else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); xhr = false; } return xhr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jQuerify() {\n if (typeof jQuery == 'undefined') {\n var s = document.createElement('script');\n s.setAttribute('src','http://code.jquery.com/jquery.js');\n document.getElementsByTagName('body')[0].appendChild(s);\n }\n}", "function loadJQ() {\r\n\t var script = document.createElement(\"scri...
[ "0.64212316", "0.58466357", "0.5794384", "0.57835746", "0.57125986", "0.5664857", "0.5664857", "0.5664857", "0.5630892", "0.5630892", "0.5629439", "0.55942005", "0.5593818", "0.5496358", "0.54603", "0.54603", "0.5456981", "0.5455841", "0.54310024", "0.5418636", "0.5403321", ...
0.0
-1
Validating did document by didDocSchema
async function validateDidDocSchema(req, didDoc) { let valid = await ajv.validate(didDocSchema, didDoc); if (!valid) { throw new intErrMsg(` Tracking number:'${Date.now()}' for request DID: '${req}'. DID document has invalid shcema. Detail info message: '${ajv.errors[0].message}'`); } return valid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateDocument(document) {\n if (!schemaValidator(document)) {\n return;\n }\n return document;\n}", "function DocumentValidation() {\n var bool = true;\n var Lo_Obj = [\"ddldocTypes\", \"ddldocType\", \"ddlcompany\", \"ddlpromotors\", \"hdnfilepath\"];\n var Ls_Msg = [\"Docum...
[ "0.71445495", "0.66139776", "0.64875436", "0.6483143", "0.6450123", "0.6427859", "0.61891735", "0.6131049", "0.61280674", "0.6118146", "0.6016436", "0.60131925", "0.5986326", "0.5928942", "0.5924764", "0.58907056", "0.58907056", "0.5878978", "0.5872864", "0.5872864", "0.58728...
0.72936916
0
This function calculates the vacant spots
function calculateV(){ let area = (dims.value)*(dims.value); let vacant = area*vacantRatio.value; return Math.floor(vacant); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function markOccupiedSpots() {\n \n\t\tif(!spotsInitialized || playersInitialized < 2) {\n \n\t\t\treturn null;\n \n } // end if statement\n\t\n\t\tfor(var i = 0; i<10; i++) {\n \n\t\t\tfindClosestSpot(myMarbles[i].x, myMarbles[i].y).isEmpty = false;\n\t\t\tfindClosestSpo...
[ "0.6546746", "0.5950092", "0.5878988", "0.5749731", "0.5660239", "0.56167346", "0.5608126", "0.5593348", "0.55027676", "0.54972225", "0.54894847", "0.546082", "0.54430366", "0.5355412", "0.534842", "0.53376466", "0.5327156", "0.5294996", "0.52926755", "0.52909184", "0.5278586...
0.5956367
1
This function calculates the spots that Population 1 takes up
function calculatePop1(){ let area = (dims.value)*(dims.value); area = area - calculateV(); let pop1 = area*popRatio.value; return Math.floor(pop1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function percentageOfWorld1(populations){\n return populations / 7900 * 100;\n }", "function calculatePop2(){\n let area = (dims.value)*(dims.value);\n let pop2 = area-(calculateV()+calculatePop1());\n return Math.floor(pop2);\n}", "function easySpot() {\n let randomNumber = Math.random();\n if (...
[ "0.6100598", "0.5917473", "0.58087283", "0.56898344", "0.5644776", "0.55656415", "0.5550244", "0.5521783", "0.5499635", "0.5464474", "0.5455299", "0.5452318", "0.54485893", "0.54313743", "0.54271334", "0.5425528", "0.54246885", "0.542121", "0.54153574", "0.54109335", "0.54057...
0.6461824
0
This function calculates the spots that Population 2 takes up
function calculatePop2(){ let area = (dims.value)*(dims.value); let pop2 = area-(calculateV()+calculatePop1()); return Math.floor(pop2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveHalfSpotting(stack1, stack2, who)\n{\n var spot = stack1.getSpotting();\n console.log(['spotting',spot]);\n stack2.ambush = false;\n for(var i=0; i<stack2.slots.length; i++)\n { var r = rnd(6);\n console.log([r,spot,stack2.slots[i].unit.camo,r+spot-stack2.slots[i].unit.camo]...
[ "0.6188649", "0.58718324", "0.5776655", "0.57472926", "0.5745746", "0.57187366", "0.56426907", "0.55958927", "0.54943436", "0.5474894", "0.5471708", "0.5380923", "0.53719765", "0.53561246", "0.53238344", "0.52860296", "0.5282473", "0.5272119", "0.52712524", "0.52661526", "0.5...
0.6639376
0
This function sets the colors into place on the grid
function setColors(){ let randNum; let randNum0; var thePlace; var vCount = 0; var pop1Count = 0; var pop2Count = 0; // finds random spots for population 1 while(pop1Count != calculatePop1()){ randNum = Math.floor(Math.random() * (dims.value)); randNum0 = Math.floor(Math.random() * (dims.value)); thePlace = table.children[0].children[randNum].children[randNum0]; if(thePlace.innerHTML != "1"){ thePlace.style.backgroundColor = popXcolor.value; thePlace.innerHTML = "1"; thePlace.style.color = popXcolor.value; thePlace.style.fontSize = '5px'; pop1Count++; } } // finds random spots for population 2 while(pop2Count != calculatePop2()){ randNum = Math.floor(Math.random() * (dims.value)); randNum0 = Math.floor(Math.random() * (dims.value)); thePlace = table.children[0].children[randNum].children[randNum0]; if(thePlace.innerHTML != "1" && thePlace.innerHTML != "2"){ thePlace.style.backgroundColor = popYcolor.value; thePlace.innerHTML = "2"; thePlace.style.color = popYcolor.value; thePlace.style.fontSize = '5px'; pop2Count++; } } // finds vacant spots & only sets them in spots that have not been filled // by population 2 while(vCount != calculateV()){ randNum = Math.floor(Math.random() * (dims.value)); randNum0 = Math.floor(Math.random() * (dims.value)); thePlace = table.children[0].children[randNum].children[randNum0]; if(thePlace.innerHTML != "1" && thePlace.innerHTML != "2" && thePlace.innerHTML != "0"){ thePlace.style.backgroundColor = "#FFFFFF"; thePlace.innerHTML = "0"; thePlace.style.color = "#FFFFFF"; thePlace.style.fontSize = '5px'; vCount++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fnSetCellColors(ctx, grid) {\n for (var x = 0; x <= (gridSize - 1); x++) {\n for (var y = 0; y <= (gridSize - 1); y++) {\n fnColorCells(ctx, grid, x, y);\n }\n }\n}", "populateGridColorArrays() {\n //for every column..\n for (let i = 0; i < this.colNum; i++) {\n\n ...
[ "0.7835942", "0.7699534", "0.7496164", "0.7225622", "0.7089933", "0.70365363", "0.7029064", "0.7012479", "0.69936824", "0.6963187", "0.6938045", "0.69317466", "0.6926818", "0.69044054", "0.6902957", "0.6897035", "0.68494576", "0.6848265", "0.6821114", "0.68049157", "0.6774159...
0.65653676
56
Function to find whether the spaces around the particular cell has the specified percentage of the same color surrounding it
function isCorrectPercentage(){ let x = table.children[0]; let theSpot; let leftD, leftM, leftU, upM, rightU, rightM, rightD, downM; for(let i=0; i<val; i++){ for(let j=0; j<val; j++){ let totalX = 0; let totalY = 0; theSpot = x.children[i].children[j]; if(i!=0 && j!=0){ leftD = x.children[i-1].children[j-1]; }if(i!=0){ leftM = x.children[i-1].children[j]; }if(i!=0 && j<val-1){ leftU = x.children[i-1].children[j+1]; }if(j<val-1){ upM = x.children[i].children[j+1]; }if(i<val-1 && j!=0){ rightU = x.children[i+1].children[j+1]; }if(i<val-1){ rightM = x.children[i+1].children[j]; }if(i<val-1 && j!=0){ rightD = x.children[i+1].children[j-1]; }if(i!=0){ downM = x.children[i].children[j-1]; } if(theSpot.innerHTML == "1"){ if(typeof(leftD) != "undefined"){ if(leftD.innerHTML == "1"){ totalX++; }}if(typeof(leftM) != "undefined"){ if(leftM.innerHTML == "1"){ totalX++; }}if(typeof(leftU) != "undefined"){ if(leftU.innerHTML == "1"){ totalX++; }}if(typeof(upM) != "undefined"){ if(upM.innerHTML == "1"){ totalX++; }}if(typeof(rightU) != "undefined"){ if(rightU.innerHTML == "1"){ totalX++; }}if(typeof(rightM) != "undefined"){ if(rightM.innerHTML == "1"){ totalX++; }}if(typeof(rightD) != "undefined"){ if(rightD.innerHTML == "1"){ totalX++; }}if(typeof(downM) != "undefined"){ if(downM.innerHTML == "1"){ totalX++; }} }if(theSpot.innerHTML == "2"){ if(typeof(leftD) != "undefined"){ if(leftD.innerHTML == "2"){ totalY++; }}if(typeof(leftM) != "undefined"){ if(leftM.innerHTML == "2"){ totalY++; }}if(typeof(leftU) != "undefined"){ if(leftU.innerHTML == "2"){ totalY++; }}if(typeof(upM) != "undefined"){ if(upM.innerHTML == "2"){ totalY++; }}if(typeof(rightU) != "undefined"){ if(rightU.innerHTML == "2"){ totalY++; }}if(typeof(rightM) != "undefined"){ if(rightM.innerHTML == "2"){ totalY++; }}if(typeof(rightD) != "undefined"){ if(rightD.innerHTML == "2"){ totalY++; }}if(typeof(downM) != "undefined"){ if(downM.innerHTML == "2"){ totalY++; }} } console.log(totalX); console.log(totalY); if(totalX<(threshold.value*8)){ theSpot.style.backgroundColor = "#ffffff"; theSpot.innerHTML = "0"; changeLocation(popXcolor.value); }if(totalY<(threshold.value*8)){ theSpot.style.backgroundColor = "#ffffff"; theSpot.innerHTML = "0"; changeLocation(popYcolor.value); } } } /** * This function changes the location of the population to a vacant spot * @param {*} color */ function changeLocation(color){ let x = table.children[0]; let theSpot; for (let i=0;i<val;i++){ for(let j=0;j<val;j++){ theSpot = x.children[i].children[j]; if(theSpot.innerHTML == "0"){ theSpot.style.backgroundColor = color; thePlace.style.color = "#FFFFFF"; break; } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testCells() //Checks if all cells which are part of solution are colored.\n{\n for(var k=0; k<solutions.length; k++)\n {\n if(solutions[k].style.backgroundColor == \"gray\")\n {\n continue;\n }\n else {\n return false;\n }\n }\n return true;\n}", "checkColor(checkColor,...
[ "0.6406898", "0.6222122", "0.61729646", "0.6170448", "0.6154012", "0.6141928", "0.61248255", "0.6078453", "0.6069174", "0.60585034", "0.6043805", "0.6043218", "0.6040962", "0.60309166", "0.60159826", "0.601457", "0.598948", "0.5909673", "0.59022063", "0.58996695", "0.5872446"...
0.6431092
0
Ensure that our bucket exists
async init() { this.debug(`creating ${this.bucket}`); await createS3Bucket(this.s3, this.bucket, this.region, this.acl, this.lifespan); this.debug(`creating ${this.bucket}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async createBucketIfNotExists() {\n const bucket = this.templates.create.Resources[this.getBucketId()].Properties;\n const foundBucket = await this.provider.getBucket(bucket.BucketName);\n if (foundBucket) {\n this.serverless.cli.log(`Bucket ${bucket.BucketName} already exists.`);\n } else {\n ...
[ "0.769745", "0.76768106", "0.73506474", "0.6886983", "0.6886604", "0.6732924", "0.6534127", "0.65127003", "0.62711924", "0.60038716", "0.5920388", "0.57440436", "0.57388884", "0.57125515", "0.56920826", "0.5639084", "0.563566", "0.55807775", "0.54767406", "0.54656553", "0.537...
0.66250736
6
StorageProvider.put() implementation for S3
async put(rawUrl, inputStream, headers, storageMetadata) { assert(rawUrl, 'must provide raw input url'); assert(inputStream, 'must provide an input stream'); assert(headers, 'must provide HTTP headers'); assert(storageMetadata, 'must provide storage provider metadata'); // We decode the key because the S3 library 'helpfully' // URL encodes this value let request = { Bucket: this.bucket, Key: rawUrl, Body: inputStream, ACL: 'public-read', Metadata: storageMetadata, }; _.forEach(HTTPHeaderToS3Prop, (s3Prop, httpHeader) => { if (_.includes(DisallowedHTTPHeaders, httpHeader)) { throw new Error(`The HTTP header ${httpHeader} is not allowed`); } else if (_.includes(MandatoryHTTPHeaders, httpHeader)) { assert(headers[httpHeader], `HTTP Header ${httpHeader} must be specified`); } request[s3Prop] = headers[httpHeader]; }); let options = { partSize: this.partSize, queueSize: this.queueSize, }; let upload = this.s3.upload(request, options); this.debug('starting S3 upload'); let result = await wrapSend(upload); this.debug('completed S3 upload'); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function putObject(keyName) {\n const putObjectParams = {\n Bucket: bucket,\n Key: keyName,\n Metadata: {\n importance: 'very',\n ranking: 'middling',\n },\n Body: 'putMe',\n };\n s3Client.putObject(putObjectParams, (err, data) => {\n if (err...
[ "0.70302635", "0.6815252", "0.678542", "0.6688935", "0.6538359", "0.6529229", "0.6478697", "0.64470714", "0.6446966", "0.6408725", "0.63049763", "0.6297888", "0.62355083", "0.6096644", "0.6081681", "0.60771817", "0.6054547", "0.60463", "0.5980599", "0.59610456", "0.5956412", ...
0.68142134
2
StorageProvider.purge() implementation for S3
async purge(rawUrl) { this.debug(`purging ${rawUrl} from ${this.bucket}`); await this.s3.deleteObject({ Bucket: this.bucket, Key: rawUrl, }).promise(); this.debug(`purged ${rawUrl} from ${this.bucket}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async deleteInS3(params) {\n s3.deleteObject(params, function (err, data) {\n if (data) {\n console.log(params.Key + \" deleted successfully.\");\n } else {\n console.log(\"Error: \" + err);\n }\n });\n }", "function deleteObject() {\n const deleteParams = {\n Bucket...
[ "0.6377153", "0.62866443", "0.62267315", "0.6086894", "0.60853064", "0.5967813", "0.587745", "0.5859899", "0.5733911", "0.5720513", "0.57098585", "0.5678051", "0.5659861", "0.5623436", "0.5611293", "0.55387133", "0.55332714", "0.553273", "0.5497136", "0.5485037", "0.54763067"...
0.7124481
0
Retreive the expiration time of object in S3 This is stored in the format: expirydate="Fri, 15 Jan 2016 00:00:00 GMT", ruleid="eucentral11day"
async expirationDate(response) { let header = response.headers['x-amz-expiration']; if (!header) { throw new Error(JSON.stringify(response.headers, null, 2)); } // This header is sent in such a silly format. Using cookie format or // sending the value without packing it in with a second value (rule-id) // would be way nicer. // The requirements for this to stop being valid are so obscure that I // would wager that the whole format of the header changes and this entire // function would need to be rewritten as oppsed to the string replacement // You'd need to have inside the expiry-date value or key an escaped quote // that's followed by a comma... header = cookie.parse(header.replace('",', '";')); return new Date(header['expiry-date']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getExpiresIn() {}", "function parse_expiration(expiration) {\n const output_expiration = {};\n if (expiration.Days && expiration.Days.length === 1) {\n output_expiration.days = parseInt(expiration.Days[0], 10);\n if (output_expiration.days < 1) {\n dbg.error('Minimum value for expi...
[ "0.6579945", "0.6299584", "0.6151921", "0.60957336", "0.60068625", "0.57834154", "0.57559884", "0.57160443", "0.5694977", "0.56815714", "0.56815714", "0.56752396", "0.5547356", "0.5544932", "0.5303032", "0.5300711", "0.52713865", "0.52538186", "0.52489215", "0.5246365", "0.52...
0.6835666
0
Create an S3 URL for an object stored in this S3 storage provider
worldAddress(rawUrl) { assert(rawUrl); let s3Domain; if (this.region === 'us-east-1') { s3Domain = 's3.amazonaws.com'; } else { s3Domain = `s3-${this.region}.amazonaws.com`; } let host = this.bucket + '.' + s3Domain; return url.format({ protocol: 'https:', host: host, pathname: encodeURIComponent(rawUrl), }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "* url (path) {\n return `https://${this.disk.bucket}.s3.amazonaws.com/${path}`\n }", "async function generateUrl(){\n let date = new Date();\n let id = parseInt(Math.random() * 10000000000);\n const imageName = `${id}${date.getTime()}.jpg`;\n\n const params = ({\n Bucket:buketName,\n ...
[ "0.714807", "0.67041886", "0.63533825", "0.6322735", "0.6225527", "0.62006474", "0.6193148", "0.6139079", "0.61067826", "0.6056675", "0.6053044", "0.602172", "0.60092586", "0.5986327", "0.59813935", "0.59729314", "0.59724915", "0.59661627", "0.59575886", "0.5949311", "0.58686...
0.62361306
4
Validate an S3 bucket
function validateS3BucketName(name, sslVhost = false) { // http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html // Bucket names must be at least 3 and no more than 63 characters long. if (name.length < 3 || name.length > 63) { return false; } // Bucket names must be a series of one or more labels. Adjacent labels are // separated by a single period (.). Bucket names can contain lowercase // letters, numbers, and hyphens. Each label must start and end with a // lowercase letter or a number. if (/\.\./.exec(name) || /^[^a-z0-9]/.exec(name) || /[^a-z0-9]$/.exec(name)) { return false; }; if (! /^[a-z0-9-\.]*$/.exec(name)) { return false; } //Bucket names must not be formatted as an IP address (e.g., 192.168.5.4) // https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html if (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.exec(name)) { return false; } // When using virtual hosted–style buckets with SSL, the SSL wild card // certificate only matches buckets that do not contain periods. To work // around this, use HTTP or write your own certificate verification logic. if (sslVhost) { if (/\./.exec(name)) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateBucket(name) {\n if (!validBucketRe.test(name)) {\n throw new Error(`invalid bucket name: ${name}`);\n }\n}", "function CfnStreamingDistribution_S3OriginPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const ...
[ "0.7035866", "0.68394333", "0.6689597", "0.6677605", "0.6658934", "0.6605327", "0.6548209", "0.6532611", "0.6503798", "0.6477707", "0.64578265", "0.6446875", "0.64413005", "0.64227134", "0.6396272", "0.638612", "0.6352736", "0.6345922", "0.634141", "0.6318501", "0.63066953", ...
0.7268729
0
Create an S3 Bucket in a specified region with the given name and ACL. All objects will expire after 'lifecycleDays' days have elapsed.
async function createS3Bucket(s3, name, region, acl, lifecycleDays = 1) { assert(s3); assert(name); assert(region); assert(acl); assert(typeof lifecycleDays === 'number'); if (!validateS3BucketName(name, true)) { throw new Error(`Bucket ${name} is not valid`); } let params = { Bucket: name, ACL: acl, }; if (region !== 'us-east-1') { params.CreateBucketConfiguration = { LocationConstraint: region, }; } try { debug(`Creating S3 Bucket ${name} in ${region}`); await s3.createBucket(params).promise(); debug(`Created S3 Bucket ${name} in ${region}`); } catch (err) { switch (err.code) { case 'BucketAlreadyExists': case 'BucketAlreadyOwnedByYou': break; default: throw err; } } params = { Bucket: name, LifecycleConfiguration: { Rules: [ { ID: region + '-' + lifecycleDays + '-day', Prefix: '', Status: 'Enabled', Expiration: { Days: lifecycleDays, }, }, ], }, }; debug(`Setting S3 lifecycle configuration for ${name} in ${region}`); await s3.putBucketLifecycleConfiguration(params).promise(); debug(`Set S3 lifecycle configuration for ${name} in ${region}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBucket(){\n // Create S3 service object\n s3 = new AWS.S3({apiVersion: '2006-03-01'});\n\n // Create the parameters for calling createBucket\n var bucketParams = {\n Bucket : process.argv[2],\n ACL : 'public-read'\n };\n\n // call S3 to create the bucket\n s3.createBuc...
[ "0.6601366", "0.6447514", "0.6321086", "0.6151867", "0.59054697", "0.5812531", "0.56383574", "0.55606496", "0.52550286", "0.5231392", "0.52298784", "0.5211462", "0.5177788", "0.5154573", "0.5074082", "0.5033663", "0.5000525", "0.49613637", "0.49590954", "0.49452496", "0.49071...
0.8114524
0