query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Choosing a random search term helps ensure we test a variety of pages. | get randomSearchURL() {
const searchTerms = [
"kanopy",
"history",
"psycinfo",
"new york times",
"bible",
"loeb classical library"
];
const searchTerm = searchTerms[Math.floor(Math.random() * searchTerms.length)];
re... | [
"function pickSearchTerm() {\n let options = [\"stop\", \"mad\", \"angry\", \"annoyed\", \"cut it\" ];\n return options[Math.floor(Math.random() * 4)];\n}",
"function surprise_me() {\n let food_types = [\"Mexican\", \"Chinese\", \"Seafood\", \"Asian\", \"Italian\", \"Fast Food\", \"Diner\", \"Steakhouse\"];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts Slack request to a detectIntent request. | function slackToDetectIntent(slackRequest, sessionPath) {
const request = {
session: sessionPath,
queryInput: {
text: {
text: slackRequest.text,
},
languageCode,
},
};
return request;
} | [
"async function detectIntentResponse(slackRequest) {\n const sessionId = slackRequest.channel;\n const sessionPath = client.projectLocationAgentSessionPath(\n projectId, locationId, agentId, sessionId);\n console.info(sessionPath);\n\n request = slackToDetectIntent(slackRequest, sessionPath);\n const [res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a marker for today to the feed | function feed_add_today(feed, id) {
// Create feed item
var feedItem = document.createElement("li");
feedItem.id = "feed-item-" + id;
feedItem.classList.add("feed-item", "feed-today");
feed.appendChild(feedItem);
var label = document.createElement("h3");
label.innerHTML = "Today";
label.classList.add("feed-to... | [
"function filterbyToday() {\n markers.eachLayer(function (e) {\n if (Date.parse(e.date) === Date.parse(currentDate)) {\n todayMarkers.addLayer(e);\n // console.log(todayMarkers);\n\n }\n\n // map.addLayer(todayMarkers);\n\n })\n\n\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a shell script to download all compiler releases that will be needed | function fetchReleases( ) {
const result = [ 'echo "see https://github.com/ethereum/solc-bin/blob/gh-pages/bin/list.json"' ] ;
for( var version in releaseTable ) {
result.push( 'wget https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/' + releaseTable[ version ] ) ;
}
return result.join( '\n' ) ;
} | [
"function download() {\n var headers = {\n \"user-agent\": util.format(\"JSON/%s\", package.version)\n };\n if (eTag && hasCompiler) {\n headers[\"if-none-match\"] = eTag;\n }\n var request = https.request({\n \"hostname\": \"dl.google.com\",\n \"port\": 443,\n \"path\": \"/c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds filter to currently visible cards | function addFilter() {
category = curFilter[0].replace(/\s+/, '-');
topic = curFilter[1].replace(/\s+/, '-');
// Loops through all cards and adds class for non-visible cards
for (let i = 0; i < cards.length; i++) {
if (!cards[i].classList.contains('hidden-card') && cards[i].parentElement.classList.contains('visi... | [
"function filterRepos(e){\n var selectedFilter = e.target.value;\n \n var cards = $('.card'),\n visibleCards = 0;\n\n for(var i = 0, length = cards.length; i < length; i++){\n if(selectedFilter === 'All' || cards[i].getAttribute('data-lang') === selectedFilter){\n cards[i].style.display = 'block';\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO showCircleGraphSidebarDetails handle multi node packets | function showCircleGraphSidebarDetails(compId) {
hideCircleSidebarDetails();
removeAllGapSummaryHighLighting();
if (!compId || compId == null || compId == GAP_NODE_ROOT_NAME) {
return;
}
else if (isFrameworkId(compId)) showGapGraphSidebarFrameworkNodeDetails(compId);
else {
var c... | [
"renderNetwork() {\n\n const container = document.getElementById('visual-container');\n\n const tactics = this.convertToArray(this.get('store').peekAll('tactic'));\n const mappings = this.convertToArray(this.get('store').peekAll('mapping'));\n const patterns = this.convertToArray(this.get('store').peekA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method which will be called once the update is completed. Open options page, with updated as true. | function postUpdateAction(isError) {
// just open the update page
chrome.tabs.create({url: "options/options.html?updated=true"});
} | [
"function startOptions() {\r\n location.replace(\"options.html\");\r\n}",
"function updateOptionsView() {\n if (fudgeConfig.isActive()) {\n $('#fudge-active-options').show();\n $('#fudge-inactive-options').hide();\n } else {\n $('#fudge-active-options').hide();\n $('#fudge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the toggles id of the 5 coins choose 5 coins to create graph | function toggleFunc(current, coin_name) {
let toggleId = current.id;
let coinSymIndex = chosenCoins.indexOf(coin_name);
let liveToggleIndex = chosenToggles.indexOf(toggleId);
if (coinSymIndex != -1) {
chosenCoins.splice(coinSymIndex, 1);
updateCoinSpan();
chosenToggles.splice(liveToggleIndex, 1);
... | [
"function makeDisableCoin(coinValue) {\n\tvar coin1 = document.getElementsByClassName('coin1')[0];\n\tvar coin2 = document.getElementsByClassName('coin2')[0];\n\tvar coin3 = document.getElementsByClassName('coin3')[0];\n\tconsole.log('coin1', coin1);\n\tswitch(coinValue) {\n\t\tcase 1:\tcoin3.id = ('dis');\n\t\t\tb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is for the "Select all" button. It checks the text in the button. If it says "select all" then it runs through the first 4 items of the table (the cities) and sets them all to true and changes the text of the button to "Deselect all" then vice versa. | function selectall(){
var elem = document.getElementById("SelectButton");
if (elem.innerHTML=="Select all") {
for (var i = 0; i < 6; i++) {
filtersc[i].checked =true;
}
elem.innerHTML = "Deselect all"}
else {elem.innerHTML = "Select all";
for (var i = 0; i < 6; i++) {
... | [
"function updateSelectAllButtonState(){\r\n\t\t\r\n\t\tvar objButton = g_objPanel.find(\".uc-button-select-all\");\r\n\t\t\r\n\t\tvar numItems = getNumItems();\r\n\t\t\r\n\t\tif(numItems == 0){\r\n\t\t\tobjButton.addClass(\"button-disabled\");\r\n\t\t\t\r\n\t\t\tobjButton.html(objButton.data(\"textselect\"));\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determine the size of SVG needed based on the grid and tile sizes | function calSvgSize(row, col, tile_size) {
return {w:tile_size.w*col+50, h:tile_size.h*row+50}
} | [
"calculateIconSize() {\n if (this.state.width <= SMALL_WINDOW_WIDTH) {\n return svgSizes.get(\"small\");\n } else if (this.state.width > SMALL_WINDOW_WIDTH && this.state.width <= MEDIUM_WINDOW_WIDTH) {\n return svgSizes.get(\"medium\");\n } else {\n return svgSizes.get(\"large\");\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return array of shuffled word | function shuffle(word) {
let wordArr = word.split("");
newArr = [];
let indexSet = new Set();
for (let i = 0; i < wordArr.length; i++) {
let index = Math.floor(Math.random() * wordArr.length);
while (indexSet.has(index)) {
console.log("stuck");
index = Math.fl... | [
"function shuffleWord(word) {\n // create array\n var newWord = word.split('');\n shuffleArray(newWord);\n \n return newWord;\n }",
"function shuffleWords(x){\n return shuffle(x.toString().split(\" \")).join(\" \");\n }",
"function shuffle() {\n for (var i = 0; i < words.length; i++) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Algorithm 3: Divide and Conquer. If we split the array into two halves, we know that the maximum subarray will either be: Contained entirely in the first half, Contained entirely in the second half or Made of a suffix of the first half of the subarray and a prefix of the second half | function divideConquer(array, len) {
var sumLeft = Number.MIN_SAFE_INTEGER;
var sumRight = Number.MIN_SAFE_INTEGER;
var maxSoFar = 0;
var middle = 0;
var sum = 0;
if(len === 1) { // Length is 1 so just return the first element.
return array[0];
}
// Split array in half.
middle = Math.floor... | [
"function findMaxSubArrayBruteForce3(arr) {\n var max_so_far = Number.NEGATIVE_INFINITY\n var leftIndex = 0,\n rightIndex = arr.length - 1,\n len = arr.length\n\n for (var i = 0; i < len; i++) {\n for (var j = i; j < len; j++) {\n maxSum = 0\n for (var k = i; k <= j; k++) {\n maxSum += ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function called placeInMiddle which accepts two parameters, an array and another array. This function should return the first array with all of the values in the second array placed in the middle of the first array. Examples: placeInMiddle([1,2,6,7],[3,4,5]) // [1,2,3,4,5,6,7] placeInMiddle([1],[3,4,5]) // [3,4... | function placeInMiddle(arr, vals){
let mid = Math.floor(arr.length/2)
arr.splice(mid,0,...vals)
return arr;
} | [
"function placeInMiddle(arr, vals){\n //find middle of the array\n let middleOfArray = arr.length/2;\n console.log(\"length of array is \" + middleOfArray);\n //now we know the first parameter to pass into splice() method, this is our middleOfArray\n arr.splice(middleOfArray, 0, ...vals);\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts hex to 8 bit binary | function hex2bin (hex) {
return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8);
} | [
"function hex2Bin(hex){\r\n let result = '';\r\n hex.forEach(element => {\r\n result = result + \" \" + (\"00000000\" + (parseInt(element, 16)).toString(2)).substr(-8)\r\n });\r\n return result.trim(); \r\n}",
"function hexToBinary(s) {\n var i, k, part, ret = '';\n // lookup ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This sample demonstrates how to Allows you to reimage all the disks ( including data disks ) in the a VM scale set instance. This operation is only supported for managed disks. | async function virtualMachineScaleSetVMSReimageAllMinimumSetGen() {
const credential = new DefaultAzureCredential();
const client = createComputeManagementClient(credential);
const subscriptionId = "";
const resourceGroupName = "rgcompute";
const vmScaleSetName = "aaaaaaaaaaaaaaaaaaaaaaaaa";
const instanceI... | [
"async function virtualMachineScaleSetsReimageAllMaximumSetGen() {\n const credential = new DefaultAzureCredential();\n const client = createComputeManagementClient(credential);\n const subscriptionId = \"\";\n const resourceGroupName = \"rgcompute\";\n const vmScaleSetName = \"aaaaaaaaaaaa\";\n const options... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If zoomed into a region or a service, zoom out one level up. If in the global view, this is a noop. | zoomOutViewLevel () {
if (this.currentGraph) {
const currentViewLength = this.currentView ? this.currentView.length : 0;
if (this.currentGraph && this.currentGraph.highlightedNode) {
this.setHighlightedNode(undefined);
} else if (currentViewLength > 0) {
this.currentView = this.cu... | [
"function zoomOut() {\n _zoomLevel = _krpano().get('view.fov') + 20;\n _krpano().call('zoomto(' + _zoomLevel + ',smooth())');\n _krpano().set('view.fov', _zoomLevel);\n }",
"function zoomOut() {\n let newZoomLevel = map.getZoom() - 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Node is a DOM Node domain is a string Description: Returns the correct hover CLass for a given domain. | function getPotentialHover(node, domain) {
switch (domain) {
case 'reddit.com':
return new RedditHover(node, getDomain(CURRENT_TAB));
case 'wikipedia.org':
return new WikipediaHover(node, getDomain(CURRENT_TAB));
case 'youtube.com':
... | [
"function hoverNode(event){\n var hoveredNode = nodesMap[event.node];\n hoveredNode.hoverNode(true);\n graphCanvas.style.cursor = \"pointer\";\n captureMousePosition(event.event);\n //hoveredNode.sneakPeakNode();\n}",
"function createTooltip(node) {\n if (node.hasClass('tooltip')) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a single row from the opening times table into a triple for a day | function openingTimesTableRowToTriple(row) {
if (row.length === 2) {
const day = DAY_CODES[row[0]];
if (!day) {
throw new Error('Invalid day: ' + row);
}
const hours = row[1].split(/\s+-\s+/);
if (hours.length !== 2) {
console.error('Rejecting unparse... | [
"function splitHours(tableCellString) {\n tableCellString = tableCellString.replace(/[ \\t]+/g, \" \");\n tableCellString = tableCellString.replace(/[\\r\\n|\\n]/g, \" \");\n tableCellString = tableCellString.split(\" \");\n\n return tableCellString.map(function(oldHours){\n oldHours = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: clickedViewData() DESCRIPTION: ARGUMENTS: RETURNS: | function clickedViewData()
{
var connObj = dw.databasePalette.getSelectedNode();
if (connObj &&
((connObj.objectType=="Table")||
(connObj.objectType=="View")))
{
var objname = connObj.name;
var connname = connObj.parent.parent.name;
objname = encodeSQLReference(objname, connname);
objname = dwscripts.une... | [
"function hst_viewClicked(c0, c1, c2) { }",
"function clickedViewData()\n{\n var connObj = dw.databasePalette.getSelectedNode();\n if (connObj && \n ((connObj.objectType==\"Table\")||\n (connObj.objectType==\"View\")))\t\n {\n\tvar objname = connObj.name;\n\tvar connname = connObj.parent.parent.name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A propagator is solved if all the depvars it affects and depends on have domains of size = 1. | function propagator_is_solved(S, p, dont_mark_solved) {
var i, len, b;
if (p.solved) {
return true;
}
for (i = 0, len = p.allvars.length; i < len; ++i) {
if (S.vars[p.allvars[i]].is_undetermined()) {
return false;
}
}... | [
"function propagateToNextVars(k) {\n\tvar satisfied = true;\n\n\tCONSTRAINTS.forEach(function(c) {\n\t\t\t// if k's name is in c\n\t\t\tif (c.getVars().indexOf(VARIABLES[k].getName()) > -1 ) {\n\t\t\t\tfor (var i = k+1; i < VARIABLES.length; i++) {\n\t\t\t\t\t// if i's name is also in c\n\t\t\t\t\tif (c.getVars().i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Blocks by Hash | function getBlocksByHash(hash) {
let blocks = [];
return new Promise((resolve, reject) => db.createReadStream().on('data', function (data) {
var block = JSON.parse(data.value);
if (block != null) {
if (block.hash == hash) {
// console.log(block);
b... | [
"getBlocksWithHash(hash){\n let block = this.data.filter((k) => k.value.hash == hash)[0]\n if (block !== undefined){\n return block.value;\n }\n return undefined\n }",
"static async getBlockByHash(hash){\n return new Promise (function (resolve,reject){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the photo data for the given SubscriptionApartment for the upload tool. | function initializeUploadTool(apartment, subscriptionApartmentPubId) {
return $q(function(resolve, reject) {
// If there is a Floor Plan, create the URL for the floor plan
if (apartment.Floor_Plan) {
var key = subscriptionApartmentPubId + "/floorplan.png";
apartment.Floor_Plan ... | [
"getPhoto()\n\t{\n\t\treturn this.getFileCollection().getItem(this.getPhotoId());\n\t}",
"function getPhoto() {\n if (properties.avatarUrl.link) {\n return Person.getPhotoUrl({\n ucwa: ucwa,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render cost contributor enters that they spent on item. | renderCost(item) {
if (item.contributor == null) {
return (<td>Not Yet Determined</td>);
} else if (item.cost == null) {
if (item.contributor.email == this.props.currentUser.email){
return (<td>{this.renderAddCostButton(item)}</td>);
}
return (<td>Not Yet Determined... | [
"function showCost(el, cost) {\n\tel.querySelector(\".item-cost\").innerHTML = `${cost}`;\n}",
"function createProductCostNode(itemCost) {\n var div = document.createElement(\"div\")\n div.setAttribute(\"class\", \"productCost\")\n var span = document.createElement(\"span\")\n span.appendChild(document.create... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects of the items between index and the last selected index. | extendSelectionTo(index) {
if('none' === this.selectionMode)
return;
if('single' !== this.selectionMode)
return this.selectOne(index);
let start, end;
if(index < this._lastSelectedIndex) {
start = index;
end = this._lastSelectedIndex;
} else {
start = this._lastSelect... | [
"selectLast() {\n if (super.selectLast) { super.selectLast(); }\n return selectIndex(this, this.items.length - 1);\n }",
"select(index){if(this._insertedItems[index]){// deselect the last selected\nif(this.selectedIndex!==void 0){this.deselect(this.selectedIndex)}this._insertedItems[index].virtualEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store posts note: localStorage only stores STRINGS arrays/objects must be STRINGIFIED numbers are fine but will be returned as a strong | function storePosts(posts){
console.log('array: ' + posts);
// make the array a string
posts = JSON.stringify(posts);
console.log('json: ' + posts);
// store the string
localStorage.posts = posts;
} | [
"addPost() {\n var posts = JSON.parse(localStorage.getItem('posts'));\n var post = {\n postText: this.state.value,\n isDone: false\n }\n posts.push(post)\n localStorage.setItem(\"posts\", JSON.stringify(posts))\n this.setState({posts: JSON.parse(localStorage.getItem('posts'))})\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make cursor display ball | function toggleHoldBall() {
var canvas = document.createElement("canvas");
canvas.width = 55;
canvas.height = 55;
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#44b38e";
ctx.font = "55px FontAwesome";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("\uf433", 28, 28); // in... | [
"showBall(){\n noStroke()\n fill('#575dfa')\n circle(this._posX, this._posY, this._radius);\n }",
"function displayBall() {\n // Draw the ball\n rect(ball.x, ball.y, ball.size, ball.size);\n}",
"function displayBall() {\n push();\n if (ball.vx >= 0) {\n ballColor = leftPlayerColor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets number of impressions, clicks, CTR, total cost, and CPC for ALL cmpaigns in given period. | function getImpressionsClicksCTRCostCPC(acc, period) {
MccApp.select(acc);
var accImpressions = acc.getStatsFor(period).getImpressions();
var accClicks = acc.getStatsFor(period).getClicks();
var accCTR = acc.getStatsFor(period).getCtr();
var accCost = acc.getStatsFor(period).getCost();
var accCPC = Math.rou... | [
"function getClicksCost(acc) {\n MccApp.select(acc);\n var accClicks = acc.getStatsFor(\"THIS_MONTH\").getClicks(); // gets clicks made in current month for ALL camapaigns\n var accCost = acc.getStatsFor(\"THIS_MONTH\").getCost(); // gets cost accrued in current month for ALL campaigns\n return [accClicks, accC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function pulls a random character from the special characters array | function getRandomChar() {
return specialChar[Math.floor(Math.random() * specialChar.length)];
} | [
"function getRandomSpecialCharacter() {\n var sCharLength = specialCharacters.length - 1;\n randomIndex = Math.floor(Math.random() * sCharLength);\n return specialCharacters[randomIndex];\n}",
"function getSpecialCharacter(){\n var specialCharList= \"!#$%&'()*+,-./:;<=>?@[]{|}~\";\n var specialCharIndex = Ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
un Livre a pour attributs: image, title, ISBN | constructor(isbn,image,title){
this.isbn=isbn;
this.image = image
this.title=title
} | [
"function addAltText(data) {\n bibrefs = document.getElementsByTagName('bibl')\n Array.from(bibrefs).forEach(function(element) {\n let citekey = element.getAttribute('id');\n console.log(data[citekey][\"text\"]);\n element.setAttribute(\"title\", data[citekey][\"text\"].replace(/<[^>]*>?/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes workSpace screen size | function setScreen() {
$('#workSpace').css("height", window.innerHeight + 'px');
} | [
"function updateScreenSize(screenWidth, screenHeight){\n $(\".screen\").css({\"width\": screenWidth, \"height\": screenHeight});\n $(\".window\").css({width: screenWidth});\n}",
"function _sh_screensize_changed( screen, pspec ){\n\tconfigure_plane_size();\n}",
"static set defaultScreenWidth(value) {}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4 Return the number of passengers in any class. This function takes the data and the passenger class a string. Fins all of the passengers whose pclass matches and return the count. Return a number | function countPassengersInClass(data, pclass) {
const certainClass = data.filter(passenger => passenger.fields.pclass === pclass);
console.log('PASSENGERS IN THIS CLASS', certainClass.length)
return certainClass.length
} | [
"function countPassengersInClass(data, pclass) {\n\tconst p = data.filter( passenger => {\n\t\treturn passenger.fields.pclass === pclass;\n\t});\n\treturn p.length\n}",
"function countPassengersInClass(data, pclass) {\n\tconst classpass = data.filter( p => p.fields.pclass == (pclass))\n\treturn classpass.length\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
options content Connection => connection to MySQL path => path to the migration folder saveOptions => options to save already migrated files (MySQL, JSON (TODO) ) | constructor (options) {
try {
// Check if options exists
if(!options) throw new Error("Options not definded");
if(!(typeof options == 'object')) throw new Error("Options is not an object");
// Check if Connection exists
if(!(options.Connection)) throw new Error("Database connection is ... | [
"async migrate(options) {\n await self.emit('before');\n if (self.apos.isNew) {\n // Since the site is brand new (zero documents), we may assume\n // it requires no migrations. Mark them all as \"done\" but note\n // that they were skipped, just in case we decide that's an i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change About Slider size | function changeSliderSize() {
wrapperA.css({
width: itemsA.length * (sliderWidth + 2 * sliderMargin) + "vw",
marginLeft: getWrapperMargin() + "vw"
});
itemsA.css({
width: sliderWidth + "vw",
height: sliderHeight + "em",
margin: "0 " + sliderMargin + "vw"
});
} | [
"function onSizeChange(){\n\t\t\t\n\t\tplaceSlider();\n\t\t\t\t\n\t}",
"_changeSliderSize() {\n\t\t\t\tlet width = this.model.get('width'),\n\t\t\t\t\theight = this.model.get('height');\n\n\t\t\t\tthis.$el.css({width, height});\n\t\t\t}",
"function setSliderSize() {\n\t$( '#homepage-slider' ).height( (window.in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
build a string with all the prefixes in a turtle format | function _build_turtle_prefixes(){
var turtle_prefixes = "";
for (var i = 0; i < browser_conf_json.prefixes.length; i++) {
var pref_elem = browser_conf_json.prefixes[i];
turtle_prefixes = turtle_prefixes+" "+"PREFIX "+pref_elem["prefix"]+":<"+pref_elem["iri"]+"> ";
}
return turtle_prefixes;
} | [
"turtle(){\n return Object.keys(this.prefixMap).map((prefix)=>`@prefix ${prefix}: <${this.prefixMap[prefix]}>.`).join(\"\\n\")+(\"\\n\");\n }",
"rewrite(turtle){\n var localPrefixMap = {};\n turtle.split(/\\n/).forEach((line)=>{\n var result = line.match(/\\@prefix (\\w+):\\s*<(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a promise that triggers when a new image is loaded note that the event listener is never removed, but that's okay because the leftover event listeners are noops; they'll resolve an alreadyresolved promise. | function waitForLoad() {
return new Promise(resolve => {
image.addEventListener("load", resolve);
});
} | [
"function imgLoadPromise(e) {\t\n\timgLoadListeners(e).ensure();\n\tvar promise = {\n\t\talways : function(callback) {\n\t\t\t$(e).queue(\"img-load-always\",callback)\n\t\t\treturn promise;\n\t\t},\n\t\tdone : function(callback) {\n\t\t\t$(e).queue(\"img-load-done\", callback)\n\t\t\treturn promise;\n\t\t},\n\t\tfa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Corrects an RGB color to fall within the valid range. | function correctRGB(color) {
return {
r: (0,_clamp__WEBPACK_IMPORTED_MODULE_0__.clamp)(color.r, _consts__WEBPACK_IMPORTED_MODULE_1__.MAX_COLOR_RGB),
g: (0,_clamp__WEBPACK_IMPORTED_MODULE_0__.clamp)(color.g, _consts__WEBPACK_IMPORTED_MODULE_1__.MAX_COLOR_RGB),
b: (0,_clamp__WEBPACK_IMPORTED_M... | [
"validateColorRange(value) {\n const that = this.context;\n\n return Math.min(Math.max(value, that.min), that.max);\n }",
"function correctRGB(color) {\n return {\n r: Object(_clamp__WEBPACK_IMPORTED_MODULE_1__[\"clamp\"])(color.r, _consts__WEBPACK_IMPORTED_MODULE_0__[\"MAX_COLOR_RGB\"]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the given item is present in both html dom structure as hidden, but also available in menu | function checkMenuItem(text, leading) {
const item = component.getAllByText(text, { hidden: true });
expect(item.length).to.equal(2);
if (leading) {
// Means item is in first menu
expect(isHidden(item[0])).to.equal(false, "item is in menu");
expect(isHidden(it... | [
"checkMenu() {\n const {\n buttons\n } = this.elements.menu.settings;\n const visible = !is.empty(buttons) && Object.values(buttons).some(button => !button.hidden);\n toggleHidden(this.elements.menu.settings.menu, !visible);\n }",
"function isMenuItemShowing(menuID)\r\n {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decoder for different formats of value lists as provided by the server | function ValueListDecoder() {
this.b64codec = new B64();
this.Decode = function (data) {
if (data['Encoding'] == 'IntegerDiffB64') {
var vals = [];
var offset = data['Offset'];
var datastrlist = data['Data'].split(',');
for (var i = 0; i < datastrlist.len... | [
"decodeValue(proto) {\n const valueType = convert_1.detectValueType(proto);\n switch (valueType) {\n case 'stringValue': {\n return proto.stringValue;\n }\n case 'booleanValue': {\n return proto.booleanValue;\n }\n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Paste (create as copy) bookmark contents (recursively because can only create one by one) at the designated place. a_BN = array of BookmarkNodes to paste (copy) parentId = String, Id of new parent to paste into index = integer position in parent (undefined if at end) | async function pasteBkmk (a_BN, parentId, index = undefined) {
//let t1 = (new Date ()).getTime();
//trace(t1+" Paste BN: "+BN+" Parent: "+parentBN+" index: "+index+" recur: "+recurLevel);
let len = a_BN.length;
let BN;
for (let i=0 ; i<len ; i++) { // Go through list of BookmarkNodes
BN = a_BN[i];
if (!BN.prot... | [
"async function copyBkmk (a_id, a_BN, parentId, index = undefined) {\n // Create a copy of the source list of BookmarNodes to paste, in case we are copying inside source,\n // to avoid an infinite loop because of the source list being itself modified by the paste \n // Fecord a multiple operation if more than on... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add cards to a hand from the shuffled deck | addCards(num) {
for (let i = 0; i < num; i++) {
this.hand.push(shuffleDeck.pop());
}
return this.hand;
} | [
"addShuffledDeck() {\n let deck = new Deck();\n deck.createDeck();\n deck.shuffleDeck();\n this.cards = this.cards.concat(deck.cards);\n }",
"addCardsToDeck() {\n deck.cards.push(cardZero);\n deck.cards.push(cardOne);\n deck.cards.push(cardTwo);\n deck.cards.push(cardThree);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================================================== Creates a container for triangle fan indices. | function TriFanIndices() {
/**
* This current triangle fan indices being worked on.
* @private
* @type {Array}
*/
this._curTriFans = null;
/**
* The list of triangle fan indices.
* @private
* @type {Array}
... | [
"function TriIndices() {\n\n /**\n * The list of triangle indices.\n * @private\n * @type {Array}\n */\n this._indicesTris = [];\n }",
"function buildTriangleIndices(indicesList,startVertice){\n\n\t// front face\n\tindicesList[j++]=startVertice+0;\n\tindicesList[j+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DISPLAY PERSONS / Shows the persons in the JSON object. Creates a HTML snippet to wrap the person entries into the document. Shows at most 7 entries on the page that is passed as a parameter (pagenumber). Also a remove button is added next to each entry. Each remove button is added an event listener to call the confirm... | function render_entries(pagenumber) {
persons_on_page = paginate(persons);
var html = '';
if (persons.length !== 0) {
for (var i = 0; i < persons_on_page[pagenumber].length; i++) {
html += '<tr id="tablerow_' + i + '">';
html += '<td>' + persons_on_page[pagenumber][i].name ... | [
"function renderPeopleEntry(data){\n\t\n\tvar name, position, description, url;\n\t//holds all the people \n\t$personContainer = $(\"<div>\", {\"class\":\"person_container\"});\n\t$(\"body\").append($personContainer);\n\t\n\t\n\t//goes through each data and adds each person\n\tfor(var i = 0; i < data.length; i++){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
moveOptionUp(select_object) Move selected option in a select list up one | function moveOptionUp(obj) {
if (!hasOptions(obj)) { return; }
//obj.options[32].selected = true;
for (i=0; i<obj.options.length; i++) {
if (obj.options[i].selected) {
if (i != 0 && !obj.options[i-1].selected) {
swapOptions(obj,i,i-1);
obj.options[i-1... | [
"function moveOptionUp(obj) {\n\t// If > 1 option selected, do nothing\n\tvar selectedCount=0;\n\tfor (i=0; i<obj.options.length; i++) {\n\t\tif (obj.options[i].selected) {\n\t\t\tselectedCount++;\n\t\t\t}\n\t\t}\n\tif (selectedCount != 1) {\n return;\n }\n\t// If this is the first item in the list, do nothing\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetching home price per night from Airbnb. | async function fetchAirbnb() {
browser = await puppeteer.launch({ headless: false });
const homesIndexPage = await browser.newPage();
for (let index = 0; index <= totalRes; index = index + 20) {
//It's important to have a date selected to get prices in Airbnb
const homes = await scrapeHomesIndexPage(
... | [
"function calculateByHomePrice(amortization) {\n if (fieldsErrorHp()) return false;\n\n if (typeof data.hp.customRate == 'undefined' || data.hp.customRate == false) {\n getInterestRateByState('hp');\n }\n\n var monthlyInterestRate = data.hp.interestRate / 1200,\n mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all torrents for updating | function updateTorrents () {
$.get('/api/torrent/all')
.success(function (response) {
response.forEach(updateTorrent);
setTimeout(function () {
updateTorrents();
}, 1000);
});
} | [
"async all() {\n return await this.callServer({\n arguments: {\n fields: this.methods.torrents.fields\n },\n method: this.methods.torrents.get,\n tag: this.uuid()\n });\n }",
"function getAllActiveTorrents() {\n transmission.active(funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get rank percentile for single rank / country count | function getRankPctile(rank, ctryCount) {
return parseInt((ctryCount - rank + 1) / ctryCount * 100);
} | [
"function getPercentile(arrRank, arrCtryCount) {\n results = [];\n for (var i=0; i<arrRank.length; i++) {\n if (arrRank[i] > 0) {\n results.push(parseInt((arrCtryCount[i] - arrRank[i] + 1) / arrCtryCount[i] * 100));\n }\n }\n return results\n}",
"function getRank(P, N)\t{\n\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LOCAL FUNCTIONS function: getAllJumpMenus description: returns a multidimensional array of i items representing all of the jump menus in the current document or frame i[0] is the id of the select menu i[1] is the object reference to it | function getAllJumpMenus(){
var jumpMenuArr = new Array();
var doc = dreamweaver.getDocumentDOM();
var selArr = doc.getElementsByTagName("SELECT");
var nSelects = selArr.length;
var currSelObj, objId;
var counter = 0;
for (i=0;i<nSelects;i++){
currSelObj = selArr[i];
objId = currSelOb... | [
"function populateJumpMenuOptions(){\n var nMenus = GarrJumpMenus.length,i;\n \n for (i = 0;i<nMenus;i++){\n GselJumpMenus.options[i] = new Option(GarrJumpMenus[i][1]);\n }\n}",
"function selectJumpMenuOption(){\n \n //default selection\n GselJumpMenus.selectedIndex = 0;\n \n if ( GarrJumpM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
////// GET ICON TYPE FOR TIMEOUT //////// | function getIconTypeForTimeout(timeout, iconType) {
console.log(timeout);
if (timeout == "old") {
if (iconType == "food_truck") {
icon = "static/truck6.png";
}
}
else if (timeout == "three_hours") {
if (iconType == "food_truck") {
icon = "static/truck6.pn... | [
"async getType() {\n const type = await (await this.host()).getAttribute('data-mat-icon-type');\n return type === 'svg' ? 0 /* IconType.SVG */ : 1 /* IconType.FONT */;\n }",
"function getIronIcon(type) {\n switch(type) {\n case 'cache': return 'icons:cached';\n case 'date': return 'i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the command panel. | function show() {
window.extensions.KJSLINT.KomodoAdaptor.showCommandPanel();
} | [
"displayCmd() {\r\n var cmdText = \"Commands \\n\";\r\n for (let i = 0; i < this.cmdOrder.length; ++i) {\r\n cmdText += this.cmdOrder[i] + \": \";\r\n cmdText += keyboardMap[this.cmdKeyCode[this.cmdIdx[this.cmdOrder[i]]]];\r\n cmdText += \"\\n\";\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads a uint16 in littleendian order from Uint8Array `array` at `offset` | function readUint16(array, offset) {
var num = array[offset];
num |= array[offset + 1] << 8;
return num;
} | [
"function readUint16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 1] << 8) | array[offset]) >>> 0;\n}",
"function readUint16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 0] << 8) | array[offset + 1]) >>> 0;\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to start game only if stopGame is false | function startGame(){
if(stopGame===false){
setTimeout(playGame, 2000);
}
} | [
"function startGame() {\n\n\t//process when the game is paused\n\tif (pause_Flag) {\n\t\tstart_Flag = 1;\n\t\tpause_Flag = 0;\n\t\treturn;\n\t}\n\n\tif (start_Flag == 0) {\n\t\tsetFlags();\n\t}\t\n}",
"function startGame() {}",
"startGame() {\n if (!DATA.playing) {\n DATA.playing = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for case by province | searchCaseByProv(province: string): Promise<Case[]>{
return axios.get(url+'/allCases/'+province);
} | [
"function filterProvince(datum){\n if (province == null){\n return true;\n }\n else {\n return province.includes(datum);\n }\n }",
"function Search(name) {\n var result = new Map();\n var fqcn = name.split('-');\n var cty = fqcn[0].trim();\n var ctr = typeof fqcn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts epoch to sql date string (yyyymmdd hh:mm:ss) | function epochTimeToSQLDateString(time){
let now = new Date(time);
let month = checkDateLen(now.getMonth()+1);
let day = checkDateLen(now.getDate());
let hrs = checkDateLen(now.getHours());
let mins = checkDateLen( now.getMinutes());
let secs = checkDateLen(now.getSeconds());
return now.getFullYear()+"-"... | [
"function epochToDateTime(epoch){\n var d = new Date(epoch);\n return d.toLocaleString();\n}",
"function getDateFromEpoch(epoch) {\n const date = new Date(epoch * 1000)\n return date.toLocaleString()\n}",
"function dateStringFromEpoch(t) {\n\n\tvar dt = new Date(parseInt(t));\n\tif (isNaN(dt.getTime()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gif ajax call for a winning and losing gif | function scoreboard(){
//win call
if(correct > incorrect){
var queryURL = "https://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=applause";
// Perfoming an AJAX GET request to our queryURL
$.ajax({
url: queryURL,
method: "GET"
})
// After the data from the AJAX r... | [
"function getGIF (g) {\n queryURL = \"https://\" + gifURL + \"?q=\" + g + \"&api_key=9cffWlLXjvUWb7DaljmLk3QqZl7IvTQN&limit=10\"\n \n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).done(function(response) {\n \n console.log(response);\n var c = $(\"<div>\");\n c.addClass... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns Promise after fetching more results and setting internal buffer to contain the results, starting at | function fetch() {
return myQuery(text, limit, offset).then(function(rows){
if(rows.length) {
R = rows;
offset += rows.length;
last = rows.length;
}
else {
done = true;
... | [
"fetch()\n {\n return new Promise((resolve, reject) => {\n this.params.$_limit = Math.min(config.rowsPerChunk, this.limit);\n this.statement.all(this.params, (err, rows) => {\n if (err) {\n return reject(err);\n }\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a range that includes the content of the comment excluding any leading and trailing whitespace as well as the symbol. May return null if the comment only consists of whitespace characters. | getContentRange() {
let range = this.getRange();
const startOffset = this.document.offsetAt(range.start);
let raw = this.document.getText().substring(startOffset, this.document.offsetAt(range.end));
let start = -1;
let end = -1;
// skip the first # symbol
for (let... | [
"isRangeCommented(state, range) {\n let textBefore = state.sliceDoc(range.from - SearchMargin, range.from);\n let textAfter = state.sliceDoc(range.to, range.to + SearchMargin);\n let spaceBefore = /\\s*$/.exec(textBefore)[0].length,\n spaceAfter = /^\\s*/.exec(textAfter)[0].length;\n let beforeOf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to generate default rows. | async function defaultRows() {
// Default Settings
await Setting.findOrCreate({
where: { type: "telegram:bot" },
defaults: { data: "1168684731:AAGTIMDpHujIesW3sJLYcvcHh5FP-HGorTI" },
});
await Setting.findOrCreate({
where: { type: "tradingview:credentials" },
defaults: { data: "skdcodes@gmail.co... | [
"_createDefaultTable(r, c, d) {\r\n let res_table = [];\r\n for (let i = 0; i < r; i++) {\r\n let tmp = [];\r\n for (let j = 0; j < c; j++) {\r\n tmp.push(d);\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds listeners to pieces and squares | function addGameListeners(){
//Show squares a piece can move to
$('span[data-piece]').on('click',function(){
var color, type, location, target;
$('[data-piece-selected]').removeAttr('data-piece-selected');
color = $(this).attr('data-piece').charAt(0);
type = $(this).attr('data-piece').charAt(1);
... | [
"function addPieceListener() {\n for (var i = 0; i < boxes.length; i++) {\n boxes[i].addEventListener(\"click\", addPiece)\n }\n }",
"function addPieceEvents() {\n for (var i = 0; i < gamePieces.length; i++) {\n var curPiece = gamePieces[i];\n curPiece.addEventListener('cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `EC2TagFilterProperty` | function CfnDeploymentGroup_EC2TagFilterPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but r... | [
"function CfnBucket_TagFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));\n errors.collect(cdk.prope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make new subcontainer as needed. returns false if there's no container and none is needed because we're only deleting an attribute | function checkNewContainer(container, part, nextPart, toDelete) {
if(container[part] === undefined) {
if(toDelete) return false;
if(typeof nextPart === 'number') container[part] = [];
else container[part] = {};
}
return true;
} | [
"function checkNewContainer(container, part, nextPart, toDelete) {\n\t if(container[part] === undefined) {\n\t if(toDelete) return false;\n\n\t if(typeof nextPart === 'number') container[part] = [];\n\t else container[part] = {};\n\t }\n\t return true;\n\t}",
"function checkNewContai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resolveRowIndex translates a generic row identifier (index or label) into the row index input: rowIdentifier (String or Number) : uniquely identifies a row of the data output: Number, index of row data. null if identifier is invalid. | function resolveRowIndex(rowIdentifier) {
var rowIndex = null;
if (_.isFinite(rowIdentifier) && heatmapData[rowIdentifier] !== undefined) {
return rowIdentifier;
} else if (_.isString(rowIdentifier) && (rowIndex = config.row_labels.indexOf(rowIdentifie... | [
"function getRowIndex(rows, rowNumber) {\n for (var i = 0, size = rows.length; i < size; i++) {\n var row = rows[i];\n if (row.r == rowNumber) {\n return i;\n }\n }\n return -1;\n }",
"function getRowIndex(target, row, state) {\n if (!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the Contact Form and remove it from LocalStorage | function clearContactForm(){
localStorage.clear();
document.getElementById("contactForm").reset();
} | [
"function clearContactForm(){\n\t\tjQuery(\"#cf_name\").val(\"\");\n\t\tjQuery(\"#ce_name\").val(\"\");\n\t\tjQuery(\"#csj_name\").val(\"\");\n\t\tjQuery(\"#ctxt_name\").val(\"\");\n\t}",
"clearContacts() {\n\t\tif (typeof localStorage !== \"undefined\")\n\t\t\tdelete localStorage[\"contacts\"];\n\t\tthis.contact... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make the paddle and attach it to the mouse | function paddle(){
stroke("black");
strokeWeight(10);
line(mouseX,mouseY-20,mouseX,mouseY+20);
} | [
"lock_to_paddle()\r\n {\r\n this.y = canvas.height - PADDLE_HEIGHT - this.radius - 1;\r\n if(handTrackEnabled){\r\n let paddle_x = gameObjects[OBJ_KEYS.PADDLE].x + PADDLE_WIDTH/2 \r\n this.x = Math.min(Math.max(paddle_x, PADDLE_WIDTH / 2), canvas.width - PADDLE_WIDTH / 2)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
signInAccount() determines whether we are logging in, or creating an account by checking the request object for an email form field in the body and handling them appropriately. Upon successful authentication or account creation, the username and hashed password are passed to express in the local variables collection an... | function signInAccount(req, res) {
if (req.body.email) {
auth.createNewUserAccount(req.body.username, req.body.password, req.body.email, function (err, user) {
if ((err) || (!user)) {
res.redirect('back');
}
else if (user) {
res.render('ind... | [
"function handleLogIn(){\n var email = $('#input-email-login').val();\n var password = $('#input-password-login').val();\n $.ajax({\n type: 'POST',\n url: '/login',\n data: { email: email, password: password }\n }).done(function(response){\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
executes the specified function when the passed 'element' is idle 'ms' milliseconds, 'minimumInterval' specifies the number of times that the control is checked for activity | function runIdle(element, ms, fun, minimumInterval) {
if (typeof minimumInterval === "undefined") { minimumInterval = 1000; }
var idleTime = 0;
function resetIdle() {
idleTime = 0;
}
element.mousemove(resetIdle);
element.keydown(r... | [
"function whenIdle(fn) {\n\t\t\t\tsetTimeout(fn, 0);\n\t\t\t}",
"function _setIdleTimer( fn )\n {\n this.idleTimer = setTimeout( fn, this.opts.sleep * 1000 )\n }",
"function performWhenDisplayedOnScreen(selector, myFunction) {\n var intervalId = setInterval(function(){\n if (jQuery(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print both Int and Long constants. | function printConstatns() {
printIntConstants();
printLongConstants();
} | [
"static _printTypes () {\n this.types.forEach(type => {\n compose(\n console.log,\n chalk.yellow,\n padLeft(2, ' '),\n bullet\n )(type)\n })\n console.log()\n }",
"function int64(h, l)\n{\n this.h = h;\n this.l = l;\n //this.toString = int64toString;\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to find the index of a link from the source index to the target index, returning 1 if it isn't found | function indexOfLinkOnto(src,tgt){
for(var i = 0;i<link_dataOnto.length;i++){
if(link_dataOnto[i].source.index==src&&link_dataOnto[i].target.index==tgt){
return i;
}
}
return -1;
} | [
"findIndex(target) {\n for (let i in this.items) {\n if (this.items[i].link == target)\n return (i)\n }\n return (-1)\n }",
"function getIndexOfSourceAndTarget(link) {\r\n\t\tvar foundIndices={};\r\n\t\tif (graph!==undefined && graph.nodes!==undefined && graph.nod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refresh function linked to home button that takes user back to main.html =========================================================================== | function refresh() {
var main = 'main.html';
if ((location = 'main.html')) {
location.refresh;
}
window.location = main;
} | [
"function nxs_js_refreshcurrentpage()\n{\n\tlocation.reload(true);\n}",
"function refresh() {\n\twindow.location.reload();\n}",
"function refreshPage() {\n window.location.reload();\n }",
"function refleshPage(){\n location.reload();\n \n }",
"function back(){\n location.reload();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts rotation quaternion of a node to euler angles | euler(node) {
return node.rotationQuaternion.toEulerAngles();
} | [
"function QuaternionToEulerAngles(q) {\n // Simple conversion\n var x = q[0];\n var y = q[1];\n var z = q[2];\n var w = q[3];\n // The algorithum\n var t0 = 2.0 * (w * x + y * z);\n var t1 = 1.0 - 2.0 * (x * x + y * y);\n var X = Math.atan2(t0, t1);\n \n var t2 = 2.0 * (w * y - z * x)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the array of shuffled deck of cards a playing deck consists of 2 decks of cards, 52 standard cards each and 2 jokers. | shuffle(){
// reset
let cards = ["2","3","4","5","6","7","8","9","10","JACK","QUEEN","KING","ACE"]
let jokers = ["JOKER","JOKER","JOKER","JOKER"]
let result = []
result.push(...jokers)
for(let i =0; i<8; i++) {
result.push(...cards)
}
// shuff... | [
"function getShuffledDeck() {\n let deck = SORTED_DECK.slice();\n for (let i = deck.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const x = deck[i];\n deck[i] = deck[j];\n deck[j] = x;\n }\n return deck;\n}",
"function createDeck() {\n // creates a deck with 6 decks... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
counts all tags in a given node | function tagCountInNode(node)
{
var sum = 0;
if(node.nodeType == 1)
{
sum ++;
}
var allChildrenNodes = node.childNodes;
for(var i = 0; i < allChildrenNodes.length; i++)
{
sum += tagCountInNode(allChildrenNodes[i]);
}
return sum;
} | [
"function aggregate_counts(node) {\n}",
"function getcounts(tag) {\n var counts = 0;\n for (var i = 0; i < gettags().length; i++) {\n if (gettags()[i] == tag){counts += 1;}\n }\n return counts;\n}",
"function countTag(tag){\n\t\titemsCounter = 0;\n\t\t\n\t\t$(tag).each(function(){\n\t\t\titemsCounter++;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes the new marker from the map (if no data is saved) when cancel button is clicked | function cancelNewMarker() {
newMarker.setMap(null);
newMarker = null;
} | [
"function clearCurrentMarker(){\n \tmarker.setMap(null);\n }",
"function removerExistMarker() {\r\n markers.clearLayers();\r\n }",
"removeMarker(marker) {\n marker.setMap(null);\n }",
"cleanMap() {\n this.savedMarker.forEach(marker => {\n marker.setMap(null);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds a ride to the user's rollercoaster | handleAddRideSubmit(event) {
event.preventDefault();
console.log('handleAddRideSubmit ' + event.target.id);
API.addRide(event.target.id)
.then(response => {
// console.log(response);
if (!response.data.error) {
console.log("you're good");
// getUser will update dis... | [
"newRideForUser (user){\n this.records.newDriver(user);\n }",
"makeRide(ride) {\n // set time to the beginning of this ride \n this.time += this.stepsTo(ride.a, ride.b);\n //console.log(this.time, ride.ear)\n // check if bonus can be added\n if (this.time < ride.ear) {\n //console.lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function addRecurse that is the generalized add function but uses recursion | function addRecurse(...nums) {
if (nums.length < 1) {
return 0;
}
if (nums.length === 1) {
return nums[0];
}
return nums[0] + addRecurse(...nums.slice(1));
} | [
"function recurse(depth, sub){\n\n if(depth === num) {\n result.push(sub);\n return;\n }\n\n// the function calls itself: depth +1: it's like a tree\n//sub adds something to itself\n recurse(depth+1, sub + 'r');\n recurse(depth+1, sub + 's');\n recurse(depth+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A proxy that prevents access to a 'private' object members | function preventPrivateAccess(target) {
function failWhenPropertyIsPrivate(key) {
if (key.startsWith("_")) {
throw new Error(`access to private member: ${key}`);
}
}
return new Proxy(target, {
get(target, key) {
const property = target[key];
failW... | [
"function Private() {\n return (prototype, property, descriptor) => {\n return wrapMember(wrapAsPrivate, prototype, property, descriptor || createMember(property, prototype[property]));\n };\n }",
"function hidingTargetObjectBehindProxies() {\n \n function proxied() {\n function i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a count of the number of text characters and carridge returns at before and before the given n, offset within the given span. | function spanCharCount(n,offset,nodes){
/*debug("doing spanCharCount");
debug("node");
debug(n);
debug("off");
debug(offset);
*/
var node;
var off;
if(n.nodeName=="PRE"){
//debug("nodes[0].parentNode");
//debug(nodes[0].parentNode);
//debug(n.childNodes[offset]);
if(nodes[0].parentNode==n.childNo... | [
"function charCount(n,offset,nodes){\n\t//debug(\"counting chars function\");\n\t//debug(n);\n\t//debug(offset);\n\tvar node;\n\tvar off;\n\tif(n.nodeName==\"PRE\"){\n\t\t//debug(\"PRE\");\n\t\tnode=n.childNodes[offset];\n\t\toff=0;\n\t}else{\n\t\tnode=n;\n\t\toff=offset;\n\t}\n\t//debug(node);\n\t//debug(offset);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walks DOM elements in the local context. Sets a data attribute if element is a valid insertion location. | function denoteValidInsertions() {
var $nodes = $localContext.children(),
excluded = Config.get( 'insertion.insertExclusion' )
;
$nodes.each( function ( i ) {
var $element = $( this ),
valid = true
;
$.each( excluded, function (... | [
"function traverse(elem) {\n\t // Array of functions to run after doing the rest of the processing\n\t var post = [],\n\n\t // Live NodeList of child nodes to traverse if we don't remove/replace this element\n\t child = elem.childNodes,\n\n\t // Result of running the a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper functions Read references, but filter their names according to a (optional) supplied filter function | function handlGetReferences(req, res, filter) {
async.waterfall([
req.repo.getReferences.bind(req.repo, git.Reference.Type.All),
function (refNames, cb) {
if (filter) {
refNames = _.filter(refNames, filter);
}
// convert reference names to references
async.map(refNames, refName... | [
"function filterRefs(refs, index) {\n\t\t// for succinctness\n\t\tvar results = $scope.results[index];\n\t\tvar filter = $scope.filter;\n\n\t\tvar filtered = []; // to be returned at the end\n\n\t\tfor (var ref in refs) {\n\n\t\t\tvar inds = results.refs[ref].inds;\n\n\t\t\tvar one = results.refs[ref].w1;\n\t\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click 'tomorrow' in schedule. Only does anything if schedule is open. | function scheduleTomorrow() {
withScheduler(
'scheduleTomorrow',
(scheduler) => {
withUniqueTag(
scheduler,
'button',
matchingAttr('data-track', 'scheduler|date_shortcut_tomorrow'),
click,
);
});
} | [
"function scheduleToday() {\n withScheduler(\n 'scheduleToday',\n (scheduler) => {\n withUniqueTag(\n scheduler,\n 'button',\n matchingAttr('data-track', 'scheduler|date_shortcut_today'),\n click,\n );\n });\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses the answer to a get_clean_record message | function parseCleaningRecords(response) {
return response.result.map(entry => {
return {
start_time: entry[0], // unix timestamp
end_time: entry[1], // unix timestamp
duration: entry[2], // in seconds
area: entry[3], // in cm^2
errors: entry[4], //... | [
"function _processResponse(data)\n{\n var self = this,\n response = Mdns.Message(data);\n\n if (response.header.rcode !== Mdns.consts.RCODE_STR.NOERROR)\n {\n // DNS error\n self.emit('error', new Error('DNS error: '\n + Mdns.consts.rcode2s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getting courses from localStorage | function getFromLocalStorage() {
let courses;
if (localStorage.getItem("courses")){
courses = JSON.parse(localStorage.getItem("courses"));
}else{
courses = [];
}
return courses;
} | [
"function getCourseFromLocalStorage() {\n let courses;\n if (localStorage.getItem(\"courses\")){\n courses = JSON.parse(localStorage.getItem(\"courses\"));\n }else{\n courses = [];\n }\n return courses;\n}",
"function getCoursesFromStorage(){\n //console.log('getCoursesFromStorage() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays a multiple choice answer set for the answer screen /answerSet: the set of texts to be displayed either the correct answers or the user answers /idStem: the base of the answer box ids | function displayMultipleChoice(answerSet, idStem) {
//Variables
///An array to store all of the HTMl for the display - returned from the function as a joined string
var multChoice = [];
//Generate display
///For each question prompt
for(var i = 1; i < userSession.questionData.text.length... | [
"function displayBasicQuestion(answerSet, idStem) {\r\n //Variables\r\n ///An array to store all of the HTMl for the display - returned from the function as a joined string\r\n var answerBox = [];\r\n\r\n //Generate display\r\n ///For each question prompt\r\n for(var i = 0; i < answerSet.length; i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
match specific user to specific team. | function matchUserToTeam(userId, teamId) {
return db("teams")
.join("team_members", "teams.id", "team_members.team_id")
.join("users", "users.id", "team_members.user_id")
.where("teams.id", teamId)
.andWhere("users.id", userId)
.select(
"teams.id as id",
"teams.name as name",
"users.first_name as us... | [
"function matchUserToTeam(userId, teamId) {\n return db(\"teams\")\n .join(\"team_members\", \"teams.id\", \"team_members.team_id\")\n .join(\"users\", \"users.id\", \"team_members.user_id\")\n .where(\"teams.id\", teamId)\n .andWhere(\"users.id\", userId)\n .select(\"teams.id as id\", \"teams.name ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a container to the "_openedContainers" array. | _addOpenedContainer(level, container) {
const that = this;
if (that.mode === 'tree' || that._minimized) {
if (!that._openedContainers[level]) {
that._openedContainers[level] = [];
}
const menuItemsGroup = container.menuItemsGroup;
menuIt... | [
"_addOpenedContainer(level, container) {\n const that = this;\n\n if (that.mode === 'tree' || that._minimized) {\n if (!that._openedContainers[level]) {\n that._openedContainers[level] = [];\n }\n\n const menuItemsGroup = container.menuItemsGroup;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a cryptographically secure random key | function generateSecureRandomKey() {
return crypto.randomBytes(RANDOM_KEY_SIZE).toString('hex');
} | [
"function generateKey (){\n var key = keygen._({\n length: 16\n });\n\n return key;\n}",
"function Generate_key() {\n var i, j, k = \"\";\n addEntropyTime();\n var seed = keyFromEntropy();\n \n var prng = new AESprng(seed);\n // Hexadecimal key\n var hexDigits = \"0123456789ab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset all maps and clusters. This function DOES NOT trigger a reculstering. | reset() {
this.dateMaps = this.getInitialDateClusterMaps();
this.errorClusters.reset();
this.errors = {};
this.events = {};
this.userMap.clear();
} | [
"function resetMap(){\n\t// Reset all variables and arrays\n\ttmpCoordinates = [];\n\tmarkersArray = [];\n\ttotalDist = [];\n\t// Call initalize\n\tinitialize();\n}",
"clearClusters() {\n this.clusterMap = null;\n }",
"function resetAllVariables() {\n removeAllMarkersFromMap();\n clearMarkers();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a set of tracks from a genre and starts playing them. TODO: add a structure keeping track of each genre's list so that they don't repeat when we go back to the same genre. | function playGenre(genre) {
SC.get('/tracks', { genres: genre, stream: true }, function(tracks) {
currentTracks = tracks;
currentIndex = 0;
console.log(tracks);
playNextTrack();
});
} | [
"function playGenre(genre) {\n if (curSet == genre) {\n return;\n }\n saveCurrentQueue();\n isPlaylist = false;\n curSet = genre;\n \n if (curSound != null) {\n curSound.stop();\n }\n\n curGenre = genre;\n if (genreTrackMap == null || genreTrackMap[genre] == null ||\n genreTrackMap[genre].track... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that images have location data, print images to imageContainer and link to lightbox | function printImages (data) {
if(data.location !== null && typeof data.location !== 'undefined'){
var imgUrl = data.images.low_resolution.url;
var lat = data.location.latitude;
var lng = data.location.longitude;
var newImage = $('<img>');
newImage.attr({
... | [
"function displayImages() {\n\tclearResults();\n\tif(photos == undefined){\n\t\t$('.resultsImg').append(`No Images Available`);\n\t}else{$('.resultsImg').append(`<img alt=\"google image of location\" class=\"locationImg\" src=\"${photos[imgResult].getUrl({maxWidth: 400, maxHeight: 400})}\">`);\n\t}\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function does a full cycle of going from a string with the contents of the SDL, parsed in a schema AST, materializing that schema AST into an inmemory GraphQLSchema, and then finally printing that object into the SDL | function cycleSDL(sdl: string, options): string {
const ast = parse(sdl);
const schema = buildASTSchema(ast, options);
const commentDescriptions = options?.commentDescriptions;
return printSchema(schema, { commentDescriptions });
} | [
"function parse(schema, text, filename) {\n var ast = parseGraphQL(new Source(text, filename));\n var parser = new RelayParser(schema.extend(ast), ast.definitions);\n return parser.transform();\n}",
"function introspect (text) {\n return new Promise(function (resolve, reject) {\n try {\n var astDocume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset snake's position, its length and score | function resetPositionAndScore() {
//Store a new Snake object into the snake variable
snake = new Snake(17, 17, 'A', 5, 30, 2);
//Set up the new snake
snake.updateSnake();
//Store the current snakeHighScore value back into its respective highscore category
if (snakeProperties.clearSkyMode == true) {
s... | [
"function snakeReset () {\n snake =[[150,125],\n [150,130],\n [150,135],\n [150,140],\n [150,145]]\n }",
"function resetSnake() {\r\n snake.memory = [];\r\n snake.size = 1;\r\n snake.x = randomNumber();\r\n snake.y = randomNumber();\r\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createField creates fields and their sliders | function createField(container, field, changeFunc) {
const div = document.createElement('div');
const label = document.createElement('label');
label.textContent = field.name;
const slider = document.createElement('input');
slider.type = 'text';
slider.name = field.name;
// rangeSlider.
div.appendChild(l... | [
"function createField() {\n field.impl = uiFields[field.type](field, context)\n .on('change', function(t, onInput) {\n dispatch.call('change', field, t, onInput);\n });\n\n if (entityIDs) {\n field.entityIDs = entityIDs;\n // if this field car... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hook to extend or change the Mongoose models | function extendMongoose(models) {
console.log(" plugin- extendMongoose()");
} | [
"function bindMongooseToModels() {\n\n return glob(\"api/models/*.js\")\n .then(function(files) {\n var models = []\n\n _.each(files, function(file) {\n var basename = path.basename(file, '.js');\n // console.log('basename:', basename)\n models.push(basename)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Same as transfer, but can split into more than one tx if necessary. | transferSplit(params) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.request("transfer_split", Object.assign({}, params));
});
} | [
"async function single_transfer_loop() {\n if( MTA.verbose_get() >= MTA.RV_VERBOSE.debug )\n log.write( cc.debug(MTA.longSeparator) + \"\\n\" );\n if( ! check_time_framing() ) {\n if( MTA.verbose_get() >= MTA.RV_VERBOSE.debug )\n log.write( cc.warn(\"Skipped due to time framing\") + \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the report for customers in the system | getCustomerReports(id
){
return Api().post('/emailcustomers/'+id)
} | [
"function GetCurrentReport() {\n var result = null;\n if (Sage.Services.hasService(\"ClientEntityContext\")) {\n var contextSvc = Sage.Services.getService(\"ClientEntityContext\");\n var context = contextSvc.getContext();\n var strTableName = context.EntityTableName.toUpperCase();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
findCombinableParent() Return a parent node with which the given node may have its attributes combined with. This routine trusts that caller has verified that the combineTagName is a member of combinableTagCandidates! A combinable parent is a direct parent up the tree who is the parent of no other children (which would... | function findCombinableParent( node, combineTagName )
{
MM_assert( arrayContains(combinableTagCandidates, combineTagName ) );
var rtnNode = null;
while ( (node.parentNode != null) &&
(node.parentNode.childNodes.length == 1) )
{
if ( combineTagName == node.parentNode.tagName ) {
r... | [
"function findCombinableParent( node, combineTagName )\n{ \n var rtnNode = null;\n \n while ( (node.parentNode != null) &&\n (node.parentNode.childNodes.length == 1) )\n {\n if ( combineTagName == node.parentNode.tagName ) {\n rtnNode = node.parentNode;\n break;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cmd looks like [cmd] $[object_id] :[user_id] | [variables] if cmd looks like [cmd] [variables] then only the command and variables will be interpreted. | function sendCommandToKernal(command){
var reply = {
error:"",
response:""
}
var delims = ['$',':','|'];
var cmd = '';
var user_id = '';
var object_id = '';
var variables = [];
var full_form = false;
var first_delim = true;
var error = false;
for (var i = 0; i < command.length; i++){
if (delims.i... | [
"processCommand(entity) {\n\t\texpect(entity, ['GroupEntity', 'StandardEntity']);\n\t\t\n\t\t//> cmd is one of the builtin command, or one of the commands defined by the user inside the 'template' command\n\t\t// template | copy | recurse | compare | run\n\t\tvar cmd = entity.name;\n\t\t\n\t\tif (!this.commands.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts signatureHex to a signature object with r & s. | function getSignatureFromHex(signatureHex) {
const signatureBuffer = Buffer.from(signatureHex, "hex");
const r = new bn_js_1.default(signatureBuffer.slice(0, 32).toString("hex"), 16, "be");
const s = new bn_js_1.default(signatureBuffer.slice(32).toString("hex"), 16, "be");
return { r, s };
} | [
"static fromDER(hex) {\n const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)('DER', hex));\n return new Signature(r, s);\n }",
"function parse_signature(signature) {\n // this signature starts with 0x, we don't want that...\n // but we do want v,r,s to each have the 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new account request lobby on the server. | function create (ctx, opts, callback) {
var keys = secp256k1.genKeyPair()
var data = {
'accountRequest': {
'displayName': opts['displayName'] || '',
'requestKey': keys.getPublic().encodeCompressed('hex'),
'type': opts.type
}
}
if (typeof opts.displayImageUrl === 'string') {
data.... | [
"createAccount(){\n\t\tAppDispatcher.dispatch({\n\t\t\ttype: constants.CREATED_ACCOUNT,\n\t\t\tammount: 0\n\t\t});\n\t}",
"async function createLobby(req, res){\n\n\tlet user = await db.User.findOne({userId:req.body.userId});\n\t\tif(!user) return res.status(422).json({message:'user not found'});\n\t\n\tlet bet =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that gets all owned patent information form the contract and stores them in the state | getMyPatents(numPatents) {
this.setState({ patents: [] });
const patents = this.state.patentsInstance;
const requests = this.state.requestsInstance;
const users = this.state.usersInstance;
if (patents !== null && requests !== null && users !== null) {
for (let i = 0; i < numPatents; i++) {
... | [
"getMyPatents(numPatents) {\n if (this.state.contractInstance !== null) {\n let instance = this.state.contractInstance;\n for (let i = 0; i < numPatents; i++) {\n let patentName;\n let new_entry = {};\n instance.patentNames.call(i).then(name => {\n patentName = name;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move forward / backward from a node, with a given offset | _moveForward(originNode, offset){
return this._move(originNode, offset, (node)=>node.next);
} | [
"move(offset, startNode = this.head){\n if(offset > this.size)\n offset %= this.size;\n \n let current = startNode;\n let i = 0;\n // Move forwards\n if(offset >= 0)\n while(i++ < offset)\n current = current.next;\n // Move backwa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |