query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
callback function for Google Maps API calls. On success, then gets weather data based on returned Place location then builds Objects by calling Location constructor class | function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
var lat = results[0].geometry.location.lat();
var lng = results[0].geometry.location.lng()
var openWeatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon=... | [
"function getLocations(place, callback) {\n var request = new XMLHttpRequest();\n var baseUrl = 'https://api.foursquare.com/v2/venues/explore';\n var clientId = 'YAFHOBF2NGR5UJJS4NLNWXCNZBGEMQUBCFA00SFRZLIRM5JO';\n var clientSecret = 'CX2WYTMBELLDEAVQJB3BFFPDWL315NPQK1GYJKL1JZRPBBZX';\n var queryParams = [];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check the availbility of download attribute | function isDownloadAttrAvailable(){
var a = document.createElement('a');
if (typeof a.download != "undefined"){
return true;
}
return false;
} | [
"isClientDownloading() {\n return this._file.downloading;\n /*\n if (this._state == CLIENT_DOWNLOADING){\n return true;\n }else{\n return false;\n }\n */\n }",
"function handleDownload(results) {\r\n if (results === 'downloaded') {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lex a char list | function lexCharList() {
if(errorB) {
errorB = errorB;
}
else if(matchWhite()) {
if(!matchNewLine() && !matchTab()) {
totalTokens = totalTokens + 1;
putMessage("Found space: \t" + lexString.charAt(0));
tokens[tokenIndex] = {type: "space", value: lexString.charAt(0), line: lineCount};
lexStri... | [
"function parseCharList() {\n // See if a character is possible. If it is try to parse it,\n // if not return true, since this production can go to epsilon.\n \n // This is ugly, probably bad practice, but it works.\n \n // true is passed into parseCharacter and parseSpace... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function finds the sum of the nth term in a geometric sequence series. It will return null if the sequence is not a valid geometric sequence | function getGeoSeqSeries(sequence, n) {
if (isGeoSeq(sequence)) {
let a = sequence[0];
let r = findGeoSeqConstant(sequence);
return (Math.pow(r, n) - 1) * a / (r - 1);
}
return null;
} | [
"function get_geometric_series_sum(numbers) {\n var nums = create_array_with_repeated_items(\"\", numbers.length);\n\n if (numbers.length == 3 && numbers[2] >= 0 && numbers[2] <= 30) {\n var sum = 0;\n var a = numbers[0];\n var r = numbers[1];\n var n = Math.floor(numbers[2]);\n\n for (var i = 0; i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return an action for a clip optionally using a custom root target object (this method allocates a lot of dynamic memory in case a previously unknown clip/root combination is specified) | clipAction( clip, optionalRoot, blendMode ) {
const root = optionalRoot || this._root,
rootUuid = root.uuid;
let clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;
const clipUuid = clipObject !== null ? clipObject.uuid : clip;
const actionsForClip = this._actionsByClip... | [
"clipAction(clip, optionalRoot, blendMode) {\n const root = optionalRoot || this._root, rootUuid = root.uuid;\n let clipObject = typeof clip === \"string\" ? AnimationClip.findByName(root, clip) : clip;\n const clipUuid = clipObject !== null ? clipObject.uuid : clip;\n const actionsForCl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render page title based on path | renderPageTitle(){
switch (this.props.history.location.pathname){
case '/categories':
return ''
case '/shopping-cart':
return 'Shopping Cart'
case '/products':
return this.props.selectedCategory.name
case '/product-detail':
return this.props.selectedProduct.na... | [
"function setPageTitle(path){\n var title = getTitle(path);\n\n if (title){\n $('title').text(title);\n } else {\n $('title').text(window.location.origin.split('/')[3]);\n }\n\n }",
"function pageTitle() {\n if (url === \"/about\") {\n return \"ABOUT ME... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save talent to db | function saveTalent(talent, username) {
return $http.post('/talent/save', {
username: username,
name: talent.name,
classId: talent.classId,
talents: talent.talents,
glyphs: talent.glyphs,
preview: talent.preview,
spec: talent.spec,
description: talent.description
... | [
"async postTalent(talent) {\n return await db.execQuery(_query_strings.QUERY_STRINGS.INSERT_TALENT, [talent.first_name, talent.last_name]);\n }",
"function addSavedTalent(talent) {\n savedTalents.push(talent);\n }",
"function handleSaveToDB_quiz(agent) {\n //agent.add('Welcome to quiz intent!');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the focused key. | setFocusedKey(key, childFocusStrategy) {
this.state.setFocusedKey(key, childFocusStrategy);
} | [
"focus() {\n this._textfield.focus();\n this._focused = true;\n }",
"_setFocusedOption(option) {\n this._keyManager.updateActiveItem(option);\n }",
"set(key, group) {\r\n if (key) {\r\n this.focus.set(group || GLOBAL_GROUP, key);\r\n }\r\n }",
"async setF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================================================= Function name: checkSpecialRules return: true = pass; false = fail ======================================================= | function checkSpecialRules(strStudent, std, tch, rules, msgObj)
{
// Check for failure to parse
if (!std || !std.rootNode || !tch || !tch.rootNode)
return false;
// x * 1 or x + 0 is not allowed:
if (std.rootNode.checkForOnes())
return exitWithMsg(msgObj, message.getMsg().ones);
... | [
"function checkThis(sAllowedSyntax)\r\n{\r\nexpect = CHECK_PASSED;\r\nactual = CHECK_PASSED;\r\n\r\ntry\r\n{\r\neval(sAllowedSyntax);\r\n}\r\ncatch(e2)\r\n{\r\nactual = CHECK_FAILED;\r\n}\r\n\r\nstatusitems[UBound] = status;\r\nexpectedvalues[UBound] = expect;\r\nactualvalues[UBound] = actual;\r\nUBound++;\r\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to classify harmonic functions of each chord Not currently used | buildHarmonicFunctions(chords, key) {
let ton = []
let sub = []
let dom = []
if (key.split("").includes("m")) {
for (let i = 0; i < chords.length; i++) {
if (i === 0 || i === 2) {
ton.push(chords[i])
} else if (i === 3 || ... | [
"function analyzeChord()\r\n{\r\n aOpts = []; //\treset scale options\r\n var s = 'Scale Options for ' + $$('roots').value + \" \" + $$('tonalities').value + ':<br/>';\r\n\r\n for (var i in aScales) //\tloop through all known scales\r\n {\r\n var aMatched = [];\r\n for (var j in aSteps) //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the html of a container. Should support both raw text and a single DOM Element. | function setHTML(container, content) {
if (container) {
// Clear out everything in the container
while (container.firstChild) {
container.removeChild(container.firstChild);
}
if (content) {
if (typeof content === 'string') {
container.innerHTML... | [
"setInnerHTML(html) {\r\n if (this.childNodes) {\r\n let _doc = parseMarkup(html, {\r\n ownerDocument: this.getOwnerDocument()\r\n });\r\n this.empty();\r\n // ATTENTION: important to copy the childNodes array first\r\n // as appendChild removes from parent\r\n _doc.childNode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the segment area is being scrolled, hide tooltip. | function onScroll (event) {
setTooltip({
...tooltip,
visible: false
})
} | [
"function hideTooltipOnMouseLeave() {\n\t\t\tresetTracker();\n\t\t\tchartPosition = null; // also reset the chart position, used in #149 fix\n\t\t}",
"function hide() {\n if (tooltip) {\n tooltip.parentNode.removeChild(tooltip);\n tooltip = null;\n }\n }",
"function hideToolti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set MQTT Messages to TextArea | function displayMessageConsole(text) {
document.getElementById("mqttLog").value = document.getElementById("mqttLog").value + getFromattedTime().toString() + ": " + text + "\n";
document.getElementById('mqttLog').scrollTop = document.getElementById('mqttLog').scrollHeight;
} | [
"function sendTextarea(text) {\n io.sockets.emit('textArea', text);\n }",
"function addMessage (msg) {\n textArea.value += msg + \"\\n\";\n textArea.scrollTop = textArea.scrollHeight;\n}",
"function updateChatArea(sText) {\n var sCurrentText = $(\"#chatArea\").val() + \"\\n\" + sText;\n $(\"#cha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ LAIR PAGE TOP LINKS | function LairPageTopLinks() {
// Select the top links and reformat (if there's a pipe, then it's your own pages; otherwise, someone else's; standardize it regardless)
forceSelect('#super-container div', function(sel) {
var links = $(sel[0]);
if (links.html().indexOf('|') == -1)
... | [
"function topLinks(linkOpts) {\n const { baseUrl, type, pag } = linkOpts;\n const obj = {\n self: urlConcat(baseUrl, inflection.pluralize(type)),\n };\n // Build pagination if available\n if (!lodash.isNil(pag)) {\n // Support Bookshelf's built-in paging parameters\n if (!lodash.isNil(pag.rowCount)) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Once user presses submit, get input and change page | function submitClicked () {
retrieveInput();
changePage();
} | [
"function submitClicked () {\n retrieveInput();\n // changePage();\n}",
"function getUserInput(){\n var userinput = document.getElementById(\"inputfield\").value;\n getPage(userinput);\n return false; \n}",
"function listenSubmitButton() {\n $('form').submit(function(e) {\n //get the value fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get's last span class="codeline" might not need this | function getLastSpanClassLine() {
var span = $('.code-line:last');
} | [
"static findLastLine(){\n const lastLineElements = document.querySelectorAll('.writable-line')\n const lastLine = lastLineElements[lastLineElements.length - 1];\n return lastLine;\n }",
"get lastLine(){\n return this.linePane.lastChild;\n }",
"function get_lastText(n)\n{\n\tvar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method adds the point contained in the event e to the current list of curves | function addPoint(e)
{
// touchend events don't have a point associated with them
if (e instanceof TouchEvent && e.touches.length < 1)
{
return
}
var pt = {
x: e.x || e.clientX || e.touches[0].clientX,
y: e.y || e.clientY || e.touches[0].clientY
}
// the coordinates above are based on the web ... | [
"function addPoint(newPoint)\r\n {\r\n if (curves.length > 0)\r\n {\r\n curves[currentCurveId].points.push(newPoint)\r\n resize()\r\n return\r\n }\r\n curves.push({\r\n points : [newPoint],\r\n startT : 0,\r\n endT : 1\r\n })\r\n resize()\r\n }",
"function drawSta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transforms lon/lat coordinates according to this map's projection. | function transform_to_map(lon, lat) {
return new OpenLayers.LonLat(lon, lat).transform(lonlat_projection, map_projection)
} | [
"function projection(lon, lat, s) {\n return {x: Math.round(lon2x(lon) * s), y: Math.round(lat2y(lat) * s)};\n }",
"function projectLatLng(latitude, longitude){\n return merc.forward([longitude, latitude]);\n}",
"function proj(zone, in_lon, in_lat) {\n var centeralMeridian = -((30 - zone) * 6 + 3) * d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that redraws the instrument contours based on the pointing time the slidervals come from the timeslider ui | function aladin_sliderRedrawContours(
aladin,
input_contour_list,
set_contour_list,
slidervals
) {
mint = slidervals.mint
maxt = slidervals.maxt
for (i = 0; i < input_contour_list.length; i++) {
var toshow = false
var tocolor = ''
var iter = 0
for (j = ... | [
"function drawTimeSlide() {\n let bgCtx = sliderBGCanvas.getContext(\"2d\");\n let handleCtx = sliderHandleCanvas.getContext(\"2d\");\n\n sliderBGCanvas.width = timeSlider.clientWidth*window.devicePixelRatio;\n sliderBGCanvas.height = timeSlider.clientHeight*window.devicePixelRatio;\n\n sliderHandleC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get specific employee from transactions based on acc_id assigned to it | fetchEmployeeFromTransaction(params) {
return Api().get('/employeetransactions/' + params)
} | [
"function getEmployee( itcb ) {\n // skip if no idenity for this user (should not happen)\n if ( !foundIdentity || !foundIdentity.specifiedBy ) { return itcb( null ); }\n\n Y.doccirrus.mongodb.runDb( {\n 'user': args.user,\n 'model'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iterates through all the file names in the array, passes the file name w the index number of the name in the list, to the loadBuffer method which is responsible for loading the sounds as binary data, using XMLHTTpRequest once loadBuffer has successfully loaded the sounds, the callback function, 'finishedLoading' is cal... | function finishedLoading(bufferList) {
Audio.init(bufferList); //passes in the buffer list array and gets stored in the Audio object and used when we call the Audio.play method.
let canvas = document.getElementById("canvas");
//get a new view from the View.js file (the constructor that manages the canvas o... | [
"function load_recording(idx){\n\tconsole.log(\"LOADING INDEX \" + idx);\n\trecording = master.Recordings[idx];\n\t//audio.src = path + \"data/\" + recording.audio;\n\twd.getFile(\"data/\" + recording.audio, function(athing){\n\t\tconsole.log(\"1...\");\n\t\tconsole.log(athing);\n\t}, function(entry){\n\t\tconsole.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END apps_script_data_studio_get_auth_type_none] [START apps_script_data_studio_auth_reset_oauth2] | function resetAuth() {
getOAuthService().reset();
} | [
"function resetAuth() {\n getOAuthService().reset()\n}",
"function resetAuth() {\n var service = getOAuthService();\n service.reset();\n}",
"function resetOAuth() {\n getOAuthService().reset();\n}",
"function enableNoAuth(){\n _authType = null;\n }",
"function clearOAuthToken() {\n oauth_token = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if have a string like www, then delete this section of the string | function omn_deleteWWW(url){
var subString="";
var posicion= url.indexOf("www", 0);//search sub-string www in start of the string
if(posicion==0){//if found, then delete the sub-string www
subString= url.substring(4);
url= subString;
}
return url;
} | [
"function removeWWW(url){\n\tvar startIndex;\n\tvar endIndex = url.length + 1;\n\tif(url.indexOf(\"wwww.\") >= 0){\n\t\tstartIndex = url.indexOf(\"www.\") + 4;\n\t\treturn url.substring(startIndex, endIndex); \n\t}\n\telse{\n\t\treturn url\n\t}\n}",
"function omn_deleteHttp(url){\n var subString=\"\";\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get one point up from `pos` | getUp(pos){
const x = pos[0];
const y = pos[1]-1;
return [x,y];
} | [
"getDown(pos){\n const x = pos[0];\n const y = pos[1]+1;\n return [x,y];\n }",
"function up(){\n\t\t\tvar above=maps[(playerobj.y/30)-1][((playerobj.x)/30)];//gets the position of playerobj in maps array-1y to get the above value\n\t\t\tif(above=='0'){upB=true;}//if its a 0 you can move up\n\t\t\telse i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Picked from return an array of the indices of ns that comprise the longest increasing subsequence within ns | function longestPositiveIncreasingSubsequence(ns, newStart) {
var seq = [],
is = [],
l = -1,
pre = new Array(ns.length);
for (var i = newStart, len = ns.length; i < len; i++) {
var n = ns[i];
if (n < 0) continue;
var j = findGreatestIndexLEQ(seq, n);
i... | [
"function longestSubsequence(ns, updatedStart) {\n let seq = [],\n is = [],\n l = -1,\n i,\n len,\n pre = new Int32Array(ns.length);\n\n for (i = updatedStart, len = ns.length; i < len; i++) {\n let n = ns[i];\n\n if (n < 0)\n continue;\n\n le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method for introducing errros in the body of certian blocks | async function introduceErrorsInBlockBody(problemBlocks=[1,5,6,7]) {
for (var i = 0; i < problemBlocks.length; i++) {
let block = await blockchain.getBlock(problemBlocks[i]);
block.body = 'isygl hdjksgh fhgjkldfhg';
await helperfile.addLevelDBData(problemBlocks[i], JSON.stringify(block));
... | [
"async induceErrorInBlock(blockHeight) {\n // get block object\n let block = '';\n await this.getBlock(blockHeight)\n .then((value) => {\n block = JSON.parse(value);\n }).catch((err) => {\n console.log(\"Block not found to induce error. Error: \" + err);\n });\n if(b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Define a function named sumArgs that takes in three parameters, if they are numbers then add them together. Otherwise return false. | function sumArgs(a,b,c){
if(typeof a === "number" && typeof b === "number" && typeof c ==="number"){
return a+b+c;
}
else
return false;
} | [
"function sumArgs(num1,num2,num3) {\n\n if (isNaN(parseInt(num1)) && isNaN(parseInt(num2)) && isNaN(parseInt(num3))){\n return NaN;\n } else if(typeof num1 == \"string\" || typeof num2 == \"string\" || typeof num3 == \"string\"){\n return false;\n } else if (typeof num1 == \"boolean\" || type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches all the massages from box. Then gets header and body from the messages. | function fetchMessages(err, box){
if (err) throw err;
messagesCount = box.messages.total;
// fetch messages
var f = imap.seq.fetch('1:' + messagesCount, {
bodies: ['TEXT','HEADER.FIELDS (FROM TO SUBJECT DATE)'],
struct: true
});
// processing me... | [
"function loadAllMessages () {\n\t\tvar path = '/api/message/';\n\t\tvar promise = makeApiCall(path).then((response)=>{\n\t\t\t\treturn response.json();\n\t\t\t}, () => {\n\t\t})\n\t\tpromise.then((response) => {\n\t\t\tcreateMessageCardUI(response);\n\t\t})\n\t}",
"function get_inbox_content(mailbox) { \n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
alert('hi'); Firstly, you must be able to get input from the user. The following HTML was taken from the jquery_lab folder. Line 19 is used to create an input box for the user. Line 20 creates a button so that the input can be added to the list. To set up functionality of the button, we start at liine 40. Firstly, we u... | function addToList(list, newThing) {
// var input = document.getElementById('my-input').value;
var newListItem = newThing;
$('#fav-list').append('<li>' + newListItem + '</li>');
// var newList = list.innerHTML + newListItem;
// in line 20, the 'list' in list.innerHTML refers to list in line 14, which is
/... | [
"function addToTheList(thingToAdd) {\n myList.push(thingToAdd.value); // This statement uses the push() array method to add the current value of the input field to the myList array. The push() array method adds value to the end of an array.\n var newListItem = document.createElement(\"li\"); // The createElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the output directory developed according to the input tex path and 'latex.outDir' config. If undefined is passed in, the default root file is used. If there is not root file, './' is output. The return path always uses `/` even on Windows | getOutDir(texPath) {
if (texPath === undefined) {
texPath = this.rootFile;
}
// rootFile is also undefined
if (texPath === undefined) {
return './';
}
const configuration = vscode.workspace.getConfiguration('latex-workshop');
const... | [
"function getRootDirectory () {\r\n if (argv.sync) return env.SYNC_ROOT\r\n if (argv.path) return argv.path\r\n return join(env.SRC_ROOT, strategy.basename)\r\n }",
"function getOutputDir(cfg) {\n return joinPath(cfg.outputDir, cfg.project);\n}",
"_getOuputDirPath() {\n let OUTPUT_DIR = __dirn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the current time is past the morning, afternoon, or night. index 0 = morning, 1 = afternoon, 2 = night. | function isPastTime(index) {
if (moment().dayOfYear() !== parseInt($stateParams.day)) return false;
if (index === 0 && moment().hour() > 11) return true;
if (index === 1 && moment().hour() > 18) return true;
return false;
} | [
"function IsNightTime(){\n\tvar current_time = new Date();\n\tif ((current_time > times.sunset) || (current_time < times.sunrise)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t};\n}",
"function isNighttime() {\n var hr = (new Date()).getHours();\n return (hr >= 21 || hr < 7... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives format to the sheet based on the model | formatSheet(sheet) {
// Get the number of unusable columns and delete them
const { fields } = this.model;
const numMaxCols = sheet.getMaxColumns();
const fieldsLength = fields.length;
const numUnusableCols = numMaxCols - fieldsLength;
sheet.deleteColumns(fieldsLength, numUnusableCols);
// ... | [
"function formatCells( data, sheet, titles )\n{\n\n sheet.setRowHeight( 1, 40 ); // Set the title row's height\n sheet.setColumnWidth( 1, 273 ); // Set the oject name's column width\n sheet.setColumnWidth( 2, 110 ); // Set the URL column's width\n sheet.setFrozenColumns( 2 ); // Freeze name and link\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: regex on propName and use a corresponding faker function if match | function getNumber(propName, prop) {
// TODO: regex on propName and use a corresponding faker function if match
return faker.random.number();
} | [
"cssProperty() {\n const prop = _.sample(Object.keys(DEVELOPMENT.CSS_PROPERTIES));\n let val = DEVELOPMENT.CSS_PROPERTIES[prop];\n if (_.isArray(val)) {\n val = _.sample(val);\n } else if (val === 'color') {\n val = this.text.hexColor();\n } else if (val === 'size') {\n val = `${_.rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the current environment | function set(requested) {
if (!validate(requested)) {
utils.log('Error setting current environment: ' + requested);
} else {
utils.log('Setting current environment: ' + requested);
current = requested;
}
} | [
"function setCurrentEnvironment() {\n var envKey;\n\n if (argv.prod) {\n envKey = 'prod';\n } else if (argv.qc) {\n envKey = 'qc';\n } else if (argv.uat) {\n envKey = 'uat';\n } else {\n envKey = 'dev';\n }\n\n settings.currentEnv = settings.environments[envKey];\n}",
"function setEnvironment(e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
API test for 'DeleteSession', Delete a session | function Test_DeleteSession(session_id) {
return __awaiter(this, void 0, void 0, function () {
var in_rpc_delete_session, out_rpc_delete_session;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log("Begin: Test_DeleteSessio... | [
"delete_session(session_id) {\n return this.engine\n .delete(CryptoboxCRUDStore.STORES.SESSIONS, session_id)\n .then((primary_key) => primary_key);\n }",
"deleteSession() {\n delete sessions[this.id];\n }",
"async delete() {\n\t\tawait this.logger.deleteSession(this.name);\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_ESAbstract.OrdinaryToPrimitive / global Get, IsCallable, Call, Type 7.1.1.1. OrdinaryToPrimitive ( O, hint ) | function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars
// 1. Assert: Type(O) is Object.
// 2. Assert: Type(hint) is String and its value is either "string" or "number".
// 3. If hint is "string", then
if (hint === 'string') {
// a. Let methodNames be « "toString", "valueOf" ».
var m... | [
"function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars\n\t// 1. Assert: Type(O) is Object.\n\t// 2. Assert: Type(hint) is String and its value is either \"string\" or \"number\".\n\t// 3. If hint is \"string\", then\n\tif (hint === 'string') {\n\t\t// a. Let methodNames be « \"toString\", \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
20. blog share slide | function blogShareSlide() {
if ($('.share-box.has-slide').length) {
$('.share-box.has-slide button').on('click', function() {
$(this).parent().find('.share-slide').toggleClass('share-hide share-show');
});
};
} | [
"function shareSlide(share_data) {\n var activeSlide = getActiveSlide();\n \n if (share_data.service == \"Facebook\") {\n if ($(activeSlide).hasClass('section-first')) {\n // Share whole section page\n return {\n url: $(activeSlide).parent('section').find('a.sect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a random string of letter groups. These may fool the untrained observer into thinking that these are UUIDs | function randomString(groupCount, groupLen) {
let o = [];
for (let i = 0; i < groupCount; ++i) {
let group = [];
for (let j = 0; j < groupLen; ++j) {
group.push(Math.round(Math.random() * 32).toString(32));
}
o.push(group.join(''));
}
return o.join('-');
} | [
"function generate_letters() {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n for ( var i = 0; i < 2; i++ ) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injects BetterElement into module.exports if it exists. | function bEinject() {
try {
if (module && module.exports) {
module.exports = {
Attribute,
Element,
builtins: {
doRandom,
doClock
}
};
}
} catch (err) {}
} | [
"function customElement_upgrade(definition, element) {\n // TODO: Implement in HTML DOM\n}",
"function injectableElement(a){return function(b,c){var d=pkg.dependencies.react;if(!semver.satisfies(c,d))throw new Error(\"Unsupported React version: '\"+c+\"'. Supported range: '\"+d+\"'.\");// ensure the react impo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function displays axes titles | function displayAxisTitles (options) {
var xTitle = $("<h3></h3").attr( {"id": "xtitle",
"class": "axistitle"});
xTitle.text(options.xaxistitle);
var yTitle = $("<h3></h3").attr( {"id": "ytitle",
"class": "axistitle"});
yTitle.text(options... | [
"function drawAxesTitles(){\n //Draw x axis title label\n ctx.fillText(xAxisTitle, xPos + graphWidth/2 , yPos + graphHeight + fontSize*3);\n ctx.save();\n \n //Draw y axis title label\n ctx.translate(xPos - fontSize*3, yPos + graphHeight/2);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load Imprest Documents View | function LoadImprestDocumentsView(DocumentNo) {
$.ajax({
url: AJAXUrls.GetPortalDocumentLinks,
type: "GET",
dataType: "json",
data: { DocumentNo: DocumentNo },
cache: false,
success: function (imprestUploadedDocuments) {
var rows = "";
$.each(imprestUploadedDocuments, function (i, imprestUploadedDocu... | [
"function loadView(viewObj) {\n var path = _loadedDocument.getViewablePath(viewObj);\n console.log(\"Loading view URN: \" + path);\n \n // TEST: trying out loading only specific objects instead of the whole model. Almost works, but needs\n // a little bit of polish.\n //var idArray =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pairfantasyland/bimap :: Pair a c ~> (a > b, c > d) > Pair b d . . `bimap (f) (g) (Pair (x) (y))` is equivalent to `Pair (f (x)) (g (y))`. . . ```javascript . > S.bimap (S.toUpper) (Math.sqrt) (Pair ('abc') (256)) . Pair ('ABC') (16) . ``` | function Pair$prototype$bimap(f, g) {
return Pair (f (this.fst)) (g (this.snd));
} | [
"bimap(f, g) {\n\t\t// Bifunctor f => f a c ~> (a -> b, c -> d) -> f b d\n\t\treturn AJS_BI.of(f(this.first), g(this.second))\n\t}",
"function bimap(f, g, bifunctor) {\n return Bifunctor.methods.bimap (bifunctor) (f, g);\n }",
"function bimap(f, g, bifunctor) {\n return Bifunctor.methods.bimap(bifunctor)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decode a TRSDOS diskette, or return undefined if this does not look like such a diskette. | function decodeTrsdos(disk) {
// Decode Granule Allocation Table sector.
const gatSector = disk.readSector(17, FloppyDisk_1.Side.FRONT, 1);
if (gatSector === undefined || gatSector.deleted) {
return undefined;
}
const gatInfo = decodeGatInfo(gatSector.data);
if (gatInfo === undefined) {
... | [
"function decodeTrsdos(disk) {\n // Decode Granule Allocation Table sector.\n const gatSector = disk.readSector(17, Side.FRONT, 1);\n if (gatSector === undefined || gatSector.deleted) {\n return undefined;\n }\n const gatInfo = decodeGatInfo(gatSector.data);\n if (gatInfo === undefined) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Node Pair(Payload) to Node | function addMsgNodePair(nodeObj, key, value){
var pair = {};
pair[key] = value;
nodeObj.np.push(pair);
} | [
"function addMsgNodePairObj(nodeObj, newPair){\n\tnodeObj.np.push(newPair);\n}",
"function addPayloadPair(key, value) {\n payloadPairs[key] = value;\n }",
"function addPayloadPair(key, value) {\n payloadPairs[key] = value;\n }",
"function addPayloadPair(key, value) {\n\t\tpayloadPairs[ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the data necessary from the form response to populate the teams scores from judges. This function handles a single row | function getScoresRow(responseSheet, r) {
var returnObject = {
teamName:false,
judge:false,
generalPoints:false,
specificPoints:false,
possibleGeneralPoints:false,
possibleSpecificPoints:false,
grade:false,
comment:"",
row:r
};
returnObject.judge = responseSheet.getRan... | [
"function doGet(e) {\n \n // Name the game\n var game_id = Date.now();\n if(typeof e.parameter.name === 'undefined') {\n var name = 'Team Trivia';\n } else {\n var name = e.parameter.name + \"'s Trivia\";\n }\n \n\n // Create a new form... \n // Make an initial list of teams here (you CAN change... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method returns field labels for all fields of this model | getFieldLabels() {
return {
"company": t("Организация"),
"date": t("Дата создания"),
"period": t("Период отчета"),
"type": t("Тип отчета"),
"email": t("Адрес email")
}
} | [
"getFieldLabels() {\n return {\n \"name\":t(\"Name\"),\n \"price\":t(\"Price\"),\n \"count\":t(\"Count\"),\n \"discount\":t(\"Discount\"),\n \"unit\":t(\"Unit\"),\n \"category\":t(\"Category\"),\n \"purchase\":t(\"Purchase\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method Donut Parameters radius, stacks, slices Calculate vertices to create a tyre | function Donut(radius, stacks, slices){
var stackAngle = 180 / stacks;
var degree = 360.0 / slices;
var currentRadius;
var vertices = [];
var allStackVertices = [];
for (var j = 1; j < stacks; j++){
var y;
var angle = stackAngle * j;
currentRadius = Math.sin(degreeToRadian(angle)) * radi... | [
"constructor({ numberOfSlices = 20, radius = 1.0, height = 1.0 }) {\n super();\n /* Points 0, 1, 2, ..., N-1 are on the base circle */\n for (let k = 0; k < numberOfSlices; k++) {\n const angle = (k / numberOfSlices) * 2 * Math.PI;\n const xVal = radius * Math.cos(angle);\n const yVal = radi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the key id from a moov box for mp4 streams. | function Box$getKeyId(moovBox) {
var sampleEntryBox = moovBox.getDescendant('trak/mdia/minf/stbl/stsd/' + Box$CODEC_ENCA + '|' + Box$CODEC_ENCV);
var sinfBox = sampleEntryBox.children.filter(function (box) {
return box.type == 'sinf' && box.firstChildByType['schm'].schemeType == 'cenc';
})[0];
r... | [
"function getBoxId(box)\r\n{\r\n\tvar anchor;\r\n\tvar href;\r\n\tvar params;\r\n\tvar found;\r\n\r\n\ttry\r\n\t{\r\n\t\tif (box.parentNode.parentNode.tagName.toLowerCase() == \"a\") // Link to video is in parent^2 node (most probable)\r\n\t\t{\r\n\t\t\tanchor = box.parentNode.parentNode;\r\n\t\t}\r\n\t\telse if (b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is for generating the lower right part of the image. | function generateLowerRight(x,y){
var x = floor(random(ppg.width/2));
var y = floor(random(ppg.height/2));
var maxX=width/2;
var maxY=height/2;
for (i=0; i<=21;i++){
x+=1;
y+=1;
maxX=maxX+x;
maxY=maxY+y;
let pixelN = ppg.get((width/2)+x , (height/2)+y);
fill(pixelN);
no... | [
"function drive_right() {\n\tcurrent_loc = (prev_loc + img_width);\n\tif (current_loc > 0) {\n\t\tcurrent_loc = (num_imgs * img_width * -1);\n\t}\n\tchange_bg_x(current_loc);\n\tprev_loc = current_loc;\n\tshould_change = false;\n}",
"function rightLowerLeg() {\n\n instanceMatrix = mult(modelViewMatrix, transla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge two lists of files. The second list wins file name conflicts: if the second list has a file whose name matches a file in the first list, prefer the second file. In this comparison, we ignore the prefix "Plain" on the base filename, as we want PlainFoo to overwrite Foo. | function mergeFiles(files1, files2) {
const moduleNames2 = files2.map((file) => baseModuleName(file));
const filesIn1NotIn2 = files1.filter((file) => {
const moduleName1 = baseModuleName(file);
return !moduleNames2.includes(moduleName1);
});
return [...filesIn1NotIn2, ...files2];
} | [
"function combineFileEntries(first, second) {\n if (debug) console.log(\"Combining\", chalk.yellow(second), \"into\", chalk.yellow(first));\n\n files.set(first, files.get(first) + files.get(second)); // Concatenate the files.\n files.delete(second); // Forget about this file.\n\n let replacementCount = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate and store the horizontal and vertical ratio between the original and the drawn image. | function calculateRatios() {
const drawnImage = $("#drawnImage");
horizontalRatio = originalImageWidth / drawnImage.width();
verticalRatio = originalImageHeight / drawnImage.height();
} | [
"function getOriginalImgRatio() {\n imgRatio = $(this).height() / $(this).width();\n return winRatio;\n }",
"setRatio() {\n\t\tthis.yRatio = 1;\n\t\tthis.xRatio = 1;\n\t\tthis.ratio = this.image.naturalWidth / this.image.naturalHeight; // ratio de l'image\n\t\tthis.scale = 0; // echel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
timer store to make it 'easier' to call/track/cancel timeouts | timer(key, cb, timing) {
// always clear dupes
if (timers[key]) {
clearTimeout(timers[key]);
delete timers[key];
}
if (!cb) {
return null;
}
if (timing) {
timers[key] = setTimeout(cb, timing);
}
return timers[key];
} | [
"function getTimer() {\n return timer;\n}",
"function new_timer() {\n return {\n date: new Date(),\n task: \"\",\n start_time: {\n s: 0,\n m: 0,\n h: 0,\n },\n duration: {\n s: 0,\n m: 0,\n h: 0,\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detecting map change Some notes: Relying on MapName only works if you are certain players are going to play different maps When TimeLimit=0, clock goes up When TimeLimit>0, clock goes down after match start GameTime is always 0 during warmup Best effort to detect map change Some edge cases can always skip through, if m... | function tryDetectMapChange(dataNew, dataOld) {
// MapName
if ( dataNew.MapName != dataOld.MapName )
return true;
// When clock goes up, we can rely on GameTime
if ( dataNew.TimeLimit == 0 && dataNew.GameTime == 0 && (dataOld.GameTime > 0 || dataOld.anyScore > 0) )
return true;
// If any score is not 0, the... | [
"function handleMapChange() {\n if(typeof timeoutID === \"number\") {\n window.clearTimeout(timeoutID);\n delete timeoutID;\n }\n\n timeoutID = window.setTimeout(function() {\n var newMapBound = map.getBounds();\n // Only update when map bound change\n if (mapBound === null || !newMapBound.equals(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
> Resolve recursive definition of omega an B using bisection method | function numericallySolveOmegaAndB({
zeta,
k,
y0 = 1,
v0 = 0,
} = {}) {
//> See [Underdamping on Wikipedia](https://en.wikipedia.org/wiki/Damping#Under-damping_.280_.E2.89.A4_.CE.B6_.3C_1.29).
// B and omega are recursively defined in solution. Know omega in terms of B, will numerically
// s... | [
"function errorfn(B, omega) {\n const omega_d = omega * Math.sqrt(1 - (zeta * zeta));\n return B - (((zeta * omega * y0) + v0) / omega_d);\n }",
"function betaIncomplete(a /*float*/, b /*float*/, x /*float*/)\n{\n var bt;\n if (x == 0.0 || x == 1.0){ \n bt = 0.0;\n }else{ // Facto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides or shows the time indicator when the time indicator interval preference changes to 0 or changes from 0 to greater than 0. Also updates its position if needed. | enableTimeIndicator() {
const hideIndicator = this.mTimeIndicatorInterval == 0;
this.nowIndicator.hidden = hideIndicator;
const todayColumn = this.findColumnForDate(this.today());
if (todayColumn) {
todayColumn.column.timeIndicatorBox.hidden = hideIndicator;
}
// Update the... | [
"enableTimeIndicator() {\n const hideIndicator = this.mTimeIndicatorInterval == 0;\n setBooleanAttribute(this.timeBarTimeIndicator, \"hidden\", hideIndicator);\n\n const todayColumn = this.findColumnForDate(this.today());\n if (todayColumn) {\n setBooleanAttribute(todayColumn.column.timeI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This task wraps javascript_compressed.js into a UMD module. | function packageJavascript() {
return packageGenerator('javascript_compressed.js', 'javascript.js', 'Blockly.JavaScript');
} | [
"function transformUMDModule(node){var _a=collectAsynchronousDependencies(node,/*includeNonAmdDependencies*/false),aliasedModuleNames=_a.aliasedModuleNames,unaliasedModuleNames=_a.unaliasedModuleNames,importAliasNames=_a.importAliasNames;var moduleName=ts.tryGetModuleNameFromFile(node,host,compilerOptions);var umdH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle subscription form submission | function subscriptionFormHandler( event ) {
'use strict';
// Prevent default form submission
event.preventDefault();
// Cache form for later use
var $form = $( '.subscription-form' ),
$submit = $form.find( '[type="submit"]' );
$submit.prop( 'disabled', true ).data( 'original-text', $... | [
"function subscriptionFormHandler(event) {\n\n 'use strict';\n\n // Prevent default form submission\n event.preventDefault();\n\n // Cache form for later use\n var $form = $('.subscription-form'),\n $submit = $form.find('[type=\"submit\"]');\n\n $submit.attr('disabled', 'disabled')\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name : hBoxForTextBox Author : Kony Solutions Purpose : Below function will return the Hbox which contains label and textbox to enter the your Name | function hBoxForTextBox(){
random = random+1;
var hboxbasicConf1 = {id:"hBoxForTextBxx"+random,isVisible:true,position: constants.BOX_POSITION_AS_NORMAL,orientation:constants.BOX_LAYOUT_HORIZONTAL,skin:"hBoxTransparentUnrounded"};
var hboxlayoutConf1 = {containerWeight:50,percent:true,vExpand: false,hExpand: true... | [
"function hBoxForName(text){\n\trandom = random+1;\n\tvar hboxbasicConf1 = {id:\"hBoxForName\"+random,isVisible:true,orientation:constants.BOX_LAYOUT_HORIZONTAL,skin:\"hBoxTransparentUnrounded\"};\n\tvar hboxlayoutConf1 = {containerWeight:50,percent:true};\n\tvar prodHbox1 = new kony.ui.Box(hboxbasicConf1, hboxlayo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
places a piece on an empty square, either x or o depending whose turn it is | placePiece(sprite, pointer)
{
playSound("placeMyPiece");
//if we are waiting for the opponent, do nothing on click
if(game.waiting)
return
if(game.multiplayer && game.checkForDoubleClick())
return
//the indexes in the 2D big array corresponding to the ... | [
"function newO(){\n var x = 0\n\n col = 2*Math.floor(Math.random()*9)\n x = col/2;\n \n // Ensure the piece can be added to the board\n if( !(myTetris.checkSquareEmpty(x, 19) & myTetris.checkSquareEmpty(x+1, 19) & \n myTetris.checkSquareEmpty(x, 18) & myTetris.checkSquareEmpty(x+1, 18))){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read normal expression SHould return RPN list | function readExpression(){
expr=[];
//var rpn=[],stack=[];
//rpn parse tokens as they are read?
if(readExpression2())
return rpnFromExpr(expr);
return false;
} | [
"function evalRPN(rpn) {\n const stack = [];\n\n // For each token in the RPN expression...\n for (let i = 0; i < rpn.length; i++) {\n const token = rpn[i];\n\n // If the token is an operator...\n if (/[+\\-/*^<>=]/.test(token)) {\n // Operate on the stack and push the result back on to the stack\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decodes an ArrayBuffer into a string A Uint8Array is created from the ArrayBuffer The Uint8Array's header is read, providing the length of the tree's encoding. The tree is then decoded from the Unit8Array Finally, the message is decoded using the tree and the rest of the Uint8Array | function decodeBuffer(arrBuff) {
let u8arr = new Uint8Array(arrBuff);
function byteToStr(byte) {
let str = byte.toString(2);
while (str.length < 8) {
str = "0" + str;
}
return str;
}
let headerLength = 4;
let treeBytes = "";
for (var i = 0; i < headerLength; i++) {
treeBytes += b... | [
"function decodeTree(u8arr) {\n\t\tlet utf8decoder = new TextDecoder();\n\t\tlet str = utf8decoder.decode(u8arr);\n\t\t//console.log(str);\n\t\treturn collapseTree(JSON.parse(str));\n\t}",
"arrayBufferToString(buffer) {\n const MAXLEN = 102400;\n\n let uArr = new Uint8Array(buffer);\n let ret = \"\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: dwscripts.getServerBehaviorsByFileName DESCRIPTION: Returns all of the ServerBehavior objects which have the given Server Behavior name. This function makes it easy to retrieve all of the ServerBehavior objects created by a given Server Behvaior. ARGUMENTS: sbFileName string the Server Behavior file name to l... | function dwscripts_getServerBehaviorsByFileName(sbFileName)
{
var retVal = new Array();
var allSBObjs = dw.serverBehaviorInspector.getServerBehaviors();
for (var i=0; i < allSBObjs.length; i++)
{
if (allSBObjs[i].getServerBehaviorFileName &&
(allSBObjs[i].getServerBehaviorFileName().indexOf(sbFileNam... | [
"function findServerBehaviors()\n{\n _ParamName.findServerBehaviors();\n _Default.findServerBehaviors();\n if (_ParamType) _ParamType.findServerBehaviors();\n\n sbArray = dwscripts.findSBs();\n\n return sbArray;\n}",
"function findServerBehaviors()\r\n{\r\n _KT_CheckDupKey.findServerBehaviors();\r\n _user_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create IOTEE Message Node | function createMsgNode(nodeId, nodeTimestamp){
var nodeObj = {
'nh' : {
"nhi":nodeId,
"nht":nodeTimestamp
},
'np': []
};
return nodeObj;
} | [
"function createMsg(entityId, entityType, entityVersion){\n\tvar msgObj = {\n\t\t'msgroot' : {\n\t\t\t'entity':{\n\t\t\t\t'eh':{\n\t\t\t\t\t\"ehi\":entityId,\n\t\t\t\t\t\"eht\":entityType,\n\t\t\t\t\t\"ehv\":entityVersion,\n\t\t\t\t},\n\t\t\t\t'ep': []\n\t\t\t},\n\t\t\t'nodes': []\n\t\t}\n\t};\n\n\treturn msgObj;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add marker manager for specified zoom level | function addmmangerforzoom(zoomlevel) {
try {
nocache_urladdon = "&nocache=" + new Date().getTime();
geturl = baseurl + "&t=markerdata&unit=" + currtrackerunit + "&date=" + currdate + "&zoomlevel=" + zoomlevel + nocache_urladdon;
var loader = new net.ContentLoader(geturl, function() {
eval("var ... | [
"function markerszoomlevel(zoomlevel) {\r\n\r\n\t//Show markers only for specified filter level\r\n\tmapstraction.removeAllFilters();\r\n\tmapstraction.addFilter(\"zoomlevel\", \"le\", zoomlevel);\r\n\tmapstraction.addFilter(\"zoomlevel\", \"ge\", zoomlevel);\r\n\tmapstraction.doFilter();\r\n\r\n}",
"function set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
region CCCheckoutPayment return which payment method is selected on the page | function GetPaymentType() {
paymentMethod = $("[name='paymentMethod']:checked").val();
return paymentMethod;
} | [
"function getPaymentMethodId() {\n const index = document.getElementById('payment').selectedIndex;\n return paymentOptions[index];\n}",
"function GetPaymentMethod()\n\t{\n\tvar cmbPaymentMethod = document.getElementById(\"idPAYMENTMETHOD\");\n\tif (cmbPaymentMethod)\t\t\t\t\t\t\t\t// if we have an element w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Window_GFList The command window list all the GFs you own. | function Window_GFList() {
this.initialize.apply(this, arguments);
} | [
"function Window_GFCommand() {\n this.initialize.apply(this, arguments);\n}",
"function Window_MenuGF() {\n this.initialize.apply(this, arguments);\n}",
"function getListGarnish() {\n GarnishService.getList($rootScope.userLogin.token).success(function (res) {\n $scope.list_garnish = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the open brace token from a given node. | function getOpenBrace(node) {
// guaranteed for enums
// This is the only change made here from the base rule
return sourceCode.getFirstToken(node, {
filter: token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator && token.value === '{',
});
} | [
"function token() {\n\t\treturn tokens[i++] || eofToken;\n\t}",
"function paren(node) {\n if (node.currentText) {\n var match = node.currentText.match(/^[\\s\\u00a0]*([\\(\\)\\[\\]{}])[\\s\\u00a0]*$/);\n return match && match[1];\n }\n }",
"function getElementTag(node) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the highest Score and the Winning Worm | function getMaxScore()
{
maxScore = 0;
for(var i = 0; i < worms.length; i++)
{
if(players[i] && worms[i].score > maxScore)
{
maxScore = worms[i].score;
winningWorm = i;
}
}
} | [
"bestScoreOverall() {\n let bestScore = this.total(0);\n for (let handIndex = 0; handIndex < this.hands.length; handIndex++) {\n const total = this.total(handIndex);\n if (total <= BlackJack_1.BlackJack.WIN_NUMBER && total > bestScore) {\n bestScore = total;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Object that can be used to configure the sanity checks granularly. | function GranularSanityChecks() {} | [
"_validateConfig() {\n if (!Array.isArray(this.options.configGroups)) {\n throw new Error('options.configGroups is not an array');\n } else if (!this.options.configGroups.length) {\n throw new Error('options.configGroups must have at least one config object');\n }\n // checking fields which MU... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Synchronously merges multiple schemas, typeDefinitions and/or resolvers into a single schema. | function mergeSchemas(config) {
const extractedTypeDefs = (0, utils_1.asArray)(config.typeDefs || []);
const extractedResolvers = (0, utils_1.asArray)(config.resolvers || []);
const extractedSchemaExtensions = (0, utils_1.asArray)(config.schemaExtensions || []);
const schemas = config.schemas || [];
... | [
"async function mergeSchemasAsync(config) {\n const [typeDefs, resolvers, extensions] = await Promise.all([\n mergeTypes(config),\n Promise.all(config.schemas.map(async (schema) => getResolversFromSchema(schema))).then(extractedResolvers => mergeResolvers([...extractedResolvers, ...ensureResolvers(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exemplo de Request Body | exRequestBody(request, response) {
const params = request.body;
console.log(params);
return response.json({
titulo: "Exemplo Request Body",
parametros: params
});
} | [
"function bodyRequest(body){\n\t/* Process Request Modified from CS 290 Lecture \n\t http://eecs.oregonstate.edu/ecampus-video/CS290/core-content/hello-node/express-forms.html */\n\tvar qParams = [];\n\tfor (var p in body){ /* Loop through request body */\n\t\tqParams.push({'name':p,'value':body[p]})\n\t}\n\tret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves inventory from Algolia with the applied facets defined in boatFilter boatFilter: Create this object like this: var bf = MarineMax.BoatFilter(); | function getInventoryWithRefinements(boatFilter) {
_nationalFacets = null;
_boatFilter = boatFilter;
verifyCallback();
handleRadius();
var paramDealerId = boatFilter.dealerId;
//initialize paramDealerId to -1 so the first call gets made for NEW makes
paramDealer... | [
"searchBoats(event) { \n this.boatTypeId = event.detail.boatTypeId;\n\n // propagate the boat type id selection to the results component\n const resultsComponent = this.template.querySelector(\n 'c-boat-search-results' );\n if( resultsComponent ) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onProgress rounds float n to a percentage % 10 | function onProgress(n) {
// round by one digit (0.1234 -> 0.1) and display
const f = Math.round(n * 10) / 10;
if (last !== f) {
console.log(f * 100 + "%"); // e.g. renders 10%
}
last = f;
} | [
"getProgressPercent() {\n const progressPercent = this.state.pastStepCount / this.state.stepGoal;\n return Math.floor(progressPercent * 100);\n }",
"function onLoadProgress(pct) {\n}",
"function onProgress() {\n //console.log(getProgress()+\"%\"); //For debugging\n}",
"function progressBarUpdate(arg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to compare two lines, based on x and y coordinates only | function compareLines(line1, line2){
if ((line1.x1 == line2.x1) && (line1.y1 == line2.y1) && (line1.x2 == line2.x2) && (line1.y2 == line2.y2)){
return true;
}
else{
return false;
}
} | [
"if (\n !l1.p1.isOnLine(l2, precision)\n && !l1.p2.isOnLine(l2, precision)\n && !l2.p1.isOnLine(l1, precision)\n && !l2.p2.isOnLine(l1, precision)\n ) {\n const line11 = new Line(l1.p1, l2.p1);\n const line12 = new Line(l1.p1, l2.p2);\n const line21 = new Line(l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright (C) 2017 CERN. Zenodo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Zenodo is distributed in the hope that it will be useful, but... | function invenioDynamicSelectController($scope, $controller) {
$controller('dynamicSelectController', {$scope: $scope});
// If it is ui-select inside an array...
if ($scope.modelArray) {
$scope.$watchCollection('modelArray', function(newValue) {
// If this is not the initial setting of the element...
... | [
"function goUpdateSelectEditMenuItems()\n{\n goUpdateCommand('cmd_cut');\n goUpdateCommand('cmd_copy');\n goUpdateCommand('cmd_delete');\n goUpdateCommand('cmd_selectAll');\n}",
"function change_pullDownList(selectedIdx, childListObj, childListArray ) {\n // Empty the child list\n for (i = childListObj.opti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `CustomResponseBodyProperty` | function CfnWebACL_CustomResponseBodyPropertyValidator(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 rece... | [
"function CfnRuleGroup_CustomResponseBodyPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a Parser instance from an LL(1) parsing table, which was built for built for a specific grammar by `ParserGenerator`. | constructor(grammar, parsingTable) {
this._grammar = grammar;
this._table = parsingTable;
// Parsing stack.
this._stack = [];
// Stores production numbers used at parsing.
this._productionNumbers = [];
} | [
"constructor({grammar}) {\n this._grammar = grammar;\n this._setsGenerator = new SetsGenerator({grammar});\n\n debug.time('Building LL parsing table');\n\n this._tableTokens = grammar\n .getTerminals()\n .concat(grammar.getTokens(), GrammarSymbol.get(EOF));\n\n this._table = this._build();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor with expanded state stored in it. This expanded state is used to open en close the details of the people | constructor(props) {
super(props);
this.state = {
expanded: false,
}
this.open = this.open.bind(this);
this.close = this.close.bind(this);
} | [
"open() {\n this.expanded = true;\n }",
"isExpanded() { return this.getState() === State.OPEN; }",
"expandParty(){\n const expanded = this.state.expanded;\n this.setState({expanded:!expanded});\n }",
"constructor(props) {\n super(props)\n this.state = {\n expandedTicket... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
la idea es leer archivo db json y establecer propiedades : data del dia persistente como es json imediatemente lo va a transformar a un objeto literal de js : asi con la desestructuracion : estamos haciendo Lectura del mismo . la idea si la fecha es de hoy recargo el servidor sino ... es decir los tickets de un dia , a... | init() {
const { hoy, tickets, ultimo, ultimos4 }/* data */ = require('../db/data.json');
// console.log(data);
// console.log(this.hoy);
if ( hoy === this.hoy ) {
this.tickets = tickets;
this.ultimo = ultimo;
this.ultimos4 = ultimos4;
} else... | [
"guardarArchivo() {\n // * Preparamos el objeto\n let jsonData = {\n ultimo: this.ultimo,\n hoy: this.hoy,\n tickets: this.tickets,\n ultimos4: this.ultimos4\n };\n\n // * Para poderlo guardar en BD hay que convertir en string con stringify\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the breadcrumb trail to show the current sequence and percentage. | updateBreadcrumbs(sequence, value, percentage) {
var that = this;
var b = this.opt.breadcrumbs;
//console.log(that);
// Data join; key function combines name and depth (= position in sequence).
var trail = d3.select("#trail")
.selectAll("g")
.data(sequence... | [
"function updateBreadcrumbs(nodeArray, percentageString) {\n var anc_arr=nodeArray;\n //console.log(anc_arr);\n // Data join; key function combines name and depth (= position in sequence).\n var trail = document.getElementById(\"sequence\");\n \n \n var text=\"\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for firefox (chrome doesn't seem to get it just yet): add an opensearch header element, so the browser will notice that it's available, and inform the user in the quick search bar | function addSearchBar() {
var h = document.getElementsByTagName('head')[0]
var sl = document.createElement('link')
sl.setAttribute("rel", "search")
sl.setAttribute("type", "application/opensearchdescription+xml")
sl.setAttribute("href", URL_BASE + "/api/websearch.lua?" + gxdomain)
sl.setAttribut... | [
"function installSearchEngine(e) {\n if (window.external && (\"AddSearchProvider\" in window.external)) {\n // Firefox 2 and IE 7, OpenSearch\n window.external.AddSearchProvider('http://www.yourhtmlsource.com/htmlsource-search.xml')\n } else {\n // No search engine support (IE 6, Opera, etc).\n alert(\"Sorr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get invoice header details 1.0.1 splitting out patient details 1.0.6 extract credit note number | function getInvoiceHeaderDetails()
{
try
{
invoiceNo = splitOutValue(invoiceSplit[4]);
invoiceDate = splitOutValue(invoiceSplit[5]);
jdeid = splitOutValue(invoiceSplit[3]);
patientDetails = splitOutValue(invoiceSplit[12]);
interCompanyTag = splitOutValue(invoiceSplit[18]);
creditN... | [
"function getInvoiceHeaderDetails()\r\n{\r\n\r\n\t//msg details\r\n\tif(invoiceElement.indexOf('<MsgID>') != -1)\r\n\t{\r\n\t\tmsgID = splitOutValue(invoiceElement, 'MsgID');\r\n\t}\r\n\r\n\tif(invoiceElement.indexOf('<MsgSenderLicenseName>') != -1)\r\n\t{\r\n\t\tmsgSender = splitOutValue(invoiceElement, 'MsgSender... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the registered class by id | function _getClassById(classId) {
return _idToClass[classId];
} | [
"function getClassById(id) {\n return classes.find(cls => cls.id == id)\n}",
"function getClassById (id){\n function getClass (class1){\n return class1.id == id;\n }\n\n return classes.find(getClass);\n\n}",
"function _getClassById(classId) {\n return _idToClass[classId];\n}",
"function _g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the new minimap's background image and allocates it at the scaled specified position. | function setMinimapBackgroundImage(img, x, y) {
this.bgImage = img;
this.bgImageXCoord = eval(x);
this.bgImageYCoord = eval(y);
} | [
"scaleBackground() {\n const scaleX = this.environment.viewWidth / this._backgroundSprite.width;\n const scaleY = this.environment.viewHeight / this._backgroundSprite.height;\n const scale = Math.max(scaleX, scaleY);\n this._backgroundSprite.width *= scale;\n this._backgroundSprite.height *= scale;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compiles the given GraphQL text using the standard set of transforms (as defined in RelayCompiler) and returns a mapping of definition name to its full runtime representation. | function generateAndCompile(text, schema, moduleMap) {
var _moduleMap;
return generate(text, schema || RelayTestSchema, IRTransforms, (_moduleMap = moduleMap) !== null && _moduleMap !== void 0 ? _moduleMap : null);
} | [
"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"
]
]
}
} |
Ensure that chrome extension resets unique userid | function resetUserId(oldUserId) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == XMLHttpRequest.DONE) {
var userId = xhr.responseText;
if (validateId(userId)) {
chrome.storage.local.set(
{ userId: userId, oldUserId: oldUse... | [
"function resetUserId(oldUserId) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState == XMLHttpRequest.DONE) {\n var userId = xhr.responseText;\n if(validateId(userId)) {\n chrome.storage.local.set({'userId': userId, 'oldUserId': oldUser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a dot to the current stroke and draws it | function addDot(colour, x, y) {
var segment = {
type: 'dot',
x: x,
y: y,
colour: colour,
time: (new Date()).getTime()
};
draw(segment);
currentStroke.push(segment);
} | [
"drawDot()\n {\n this.ctx.fillStyle = this.colour;\n this.ctx.beginPath();\n this.ctx.arc(this.x, this.y, this.r, 0 * Math.PI, 2 * Math.PI);\n this.ctx.fill();\n }",
"function _addDot() {\n // Create dot model\n var strokeWidth = 1;\n var dotRadius = _getRandomDotRadius(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link transform allows addition of stream transformers onto a link. The default transform applied is the heartbeat stream, but you can add others, like encryption or compression. The output is a linkstream. | function LinkTransform(opts, readStream, writeStream, timeout) {
if (!(this instanceof LinkTransform)) { return new LinkTransform(opts, readStream, writeStream, timeout); }
this._opts = opts;
this._readStream = readStream;
this._writeStream = writeStream;
// Create the protocol wrapper streams
... | [
"function pushStreamTransform(transform){\n if (typeof transform != 'function') return\n transforms.push(function(module, callback){\n var stream = transform(module.full)\n var src = ''\n stream.on('data', function(buf){\n src += ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end function setLineDefaultAllSelected / NAME: handleLineChartLineDeletionWarning DESCRIPTION: function called ARGUMENTS TAKEN: none ARGUMENTS RETURNED: none CALLED FROM: CALLS: | function handleLineChartLineDeletionWarning(button) {
var btn = button.id;
d3.selectAll(
".alert.alert-danger.alert-dismissible.lineChart.lineDeletion"
).classed("aleph-hide", true);
if (btn == "ok") {
d3.selectAll(".scenarioNumber-" + aleph.lineToDelete).remove();
d3.select("#aleph-Line-... | [
"function resetSelectedLine() {\n gMeme.selectedLineIdx = 0\n}",
"function removeSelectedPlotline( ) {\n\n\ttry {\n\t\ttimewheel[currentNav].removeYearPlotline( 'Selected Pieces per Date' );\n\t}\n\tcatch( e ) { /*Do nothing*/ }\n\ttry {\n\t\ttimewheel[currentNav].removeDayPlotline( 'Selected Pieces per Date' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the data on size. The sparql would be able to filter this as well, but it created some unknown issues with the st_may_intersect method. This method is used to check if a street might be close enough to a point. So I had to do it manually in Node.js. | filter (data) {
const results = data.results;
let bindings = results.bindings;
// Check if the values are correct.
bindings = bindings.filter(function (d) {
if (d != undefined && d.size != undefined && d.size.value != undefined) {
retu... | [
"function filterSize() {\n if (size === 'All') {\n return items;\n } else {\n return items.filter((candle) => candle.size === size);\n }\n }",
"function filterMarkers(province, type, cursize_from, cursize_to) {\n console.log(\"filterMarkers\");\n clearMarkers();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes the first sentence in the business summary in their filings to create a general description of the company The summary is seen as the bottom third of the tooltip | function createSummary(summary) {
summary.toString()
if(summary != "") {
var first = true;
var endIndex = 0;
for(let i = 0; i < summary.length; i++) {
// Find the first sentence and stop
if(summary.charAt(i) == ".") {
// All corporations will have an initial . in thei... | [
"function writeDescriptive() {\n \n\t/**\n \t\tcreate string components for descriptive and write to div\n \t*/\n\tvar descTitle = \"<h3>School Performance Profile (SPP) and Income<BR>Descriptive Statistics for Allegheny County</h3>\"; \t\n \t\n\tvar sppTitle = \"<p class=\\\"highlight2\\\">2012-2013 SPP ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to get streamer data from Twitch's API / Twitch seems to require that the clientid be in the Javascript Header Object, more info on those: | async function getStreamerTwitch() {
const user = document.querySelector("#streamId").value;
console.log("Calling twitch api for user: " + user);
fetch(BASE_URL_TWITCH + user, {
method: 'GET', // or 'PUT'
headers: {
'Content-Type': 'application/json',
'Client-ID': CLIENT_ID_TWITCH,
},
})
.then((respon... | [
"function getStreamerTwitch() {\n\tconst user = document.querySelector(\"#streamId\").value;\n\tconsole.log(\"Calling twitch api for user: \" + user);\n\n\tfetch(BASE_URL_TWITCH + user, {\n\t\tmethod: 'GET', // or 'PUT'\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Client-ID': CLIENT_ID_TWITCH,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function drawing line or scatters (is "special" timeseries are provided) d: data bound to the line element svg: svg element in which the line is drawn line: svg line special: name of special timeseries; false otherwise special_ts: timeseries data for the special timeseries TODO: allow various plots styles for sp... | function draw_line(d, svg, line, special, special_ts)
{
//draw date indicator
if(special)
{
if(special_ts.hasOwnProperty(d.name))
{
if(d.visible)
draw_special(svg, d.values, line, d.name);
else
remove_special(svg, d.name);
}
else
... | [
"function renderScatterLineChart() {\n var chart = {};\n // Get the chart container's dimension\n var chartContainer = d3.select(\"#\" + scatterLineChartId);\n var chartContainerWidth = chartContainer.node().clientWidth;\n var chartContainerHeight = chartContainer.node().clientHeight;\n\n // Chart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the owner and name of a repo, and the results for a specific invocation of `lintRepo()`, this will print out the repo's full name and its results as a colored list with check marks next to passing linters. | function printResults(owner, repo, results) {
console.log(owner + '/' + repo + ':');
results.forEach(function (result) {
var mark = result.result ? '✓' : '✖';
var output = util.format(' %s %s', mark, result.message);
if (colors.enabled) {
output = output[result.result ? 'green' : 'red'];
}
... | [
"function printResults(owner, repo, results) {\n var mark = results.length ? '✖' : '✓';\n var output = util.format('%s %s/%s', mark, owner, repo);\n var color = results.length ? 'red' : 'green';\n console.log(chalk[color](output));\n\n results.forEach(function (result) {\n console.log(' %s', result);\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calcul du nombre total de likes | calculateLikes() {
let resultat = 0;
this.media.forEach((media) => {
resultat = resultat + media.likes;
})
this.totalLikes = resultat;
return resultat;
} | [
"getTotalLikes() {\n let likeElements = this.query(this.likesQuery);\n let numLikes = 0;\n\n for (let element of likeElements) {\n let amount = /[\\d.kK]+/.exec(element.innerHTML)[0];\n if (amount.toLowerCase().indexOf('k') > 0) {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs the `testResolver` with the `dependencies` and the `tests`, then returns the results | function resolve() {
return testResolver(dependencies, tests);
} | [
"runTests() {\n this.testCorrect()\n this.testComplete()\n }",
"exec () {\n this.setupTests()\n return this.runTests()\n }",
"function test() {\n return Promise.all(normalizeData.map(function(item) {\n var parentName = item[0];\n var deps = item[1];\n return Promise.all(deps.map(fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Auth the user either via the JS SDK, or via the REST API | function auth() {
var token = getParameterByName('token');
var auth = getParameterByName('auth');
if (auth == 'rest') {
return authWithRest(token);
} else {
return authWithSDK(token);
}
} | [
"function Auth() {\n var authscheme = readAuth().then(data => {\n \tclient = data[0].clientID;\n \tsecret = data[0].secret\n \tstartAuthServer({clientID: data[0].clientID}) // Starts an auth server so the user can authorize their app.\n })\n}",
"function auth() {\n\n // we call the generic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lookup and display the work orders for the current location. | function locationOrders(page)
{
$("#locationOrders").displayResults(
{
url: root + "selfserve/locationwolookup.jsf?",
page: page,
recordName: "Work Orders",
rowClass: "clickable",
columnBefore: true,
columnBeforeHtml: "<a href='#'>View</a><img class='notShown busy' src='" + root + "images/busy-small.gif' ... | [
"function showWorkingOrders() {\n\treturn new Promise((res, rej) => {\n\t\tget('/workingorders')\n\t\t\t.then(r => {\n\t\t\t\tif (r.status !== 200) {\n\t\t\t\t\trej(r);\n\t\t\t\t} else {\n\t\t\t\t\tres(r.body);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(e => {\n\t\t\t\trej(e);\n\t\t\t});\n\t});\n}",
"function openWorkOrd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that calculates and returns the distance between two points. Your function should take two arrays as paramaters and return the distance between the two points. Save your return value to a variable and `console.log` it! | function distance (point1, point2) {
Math.sqrt(Math.pow(point1[0] - point1[1], 2) + Math.pow(point2[0] - point2[1], 2))
} | [
"function calculateDistanceBetweenTwoPoints(x1, y1, x2, y2) {\r\n let distance = Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2));\r\n console.log(distance);\r\n}",
"function getDistance(point0,point1) {\n var distance = ( Math.sqrt( Math.pow( ( point0[0] - point1[0]),2 ) + Math.pow( ( point0[1] - point... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for handling the server's response. It receives a JSON object from the server and calls receiveJSON for its manipulation | function handleResponse(){
if((request.status == 200)&&(request.readyState == 4)){
var jsonString = request.responseText;
receiveJSON(jsonString);
}
} | [
"function handleResponse() {\n if (this.status == 200 && this.responseText != null) {\n\n var response = JSON.parse(this.responseText);\n\n stdout.value += response.stdout + \"\\n\";\n stderr.value += response.stderr + \"\\n\";\n }\n else if (this.status == 404) {\n console.log(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |