query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Create a new lane for adding a new event. | function createLane(lane) {
var container = document.getElementById("container");
var id = "lane" +lane;
var lane_ul = document.createElement("ul");
lane_ul.setAttribute("id",id);
lane_ul.className = "one-event-lane";
container.appendChild(lane_ul);
return lane_ul;
} | [
"function addLaneEvent(lane) {\n\t\t myDiagram.startTransaction(\"addLane\");\n\t\t if (lane != null && lane.data.category === \"Lane\") {\n\t\t // create a new lane data object\n\t\t var shape = lane.findObject(\"SHAPE\");\n\t\t var size = new go.Size(shape.width, MINBREADTH);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shuffle cards and change the DOM with this new info by adding a class like fabitcoin from Font Awesome | function shuffleCards() {
// shuffle the array of figures with each figure appearing twice
const figureNamesShuffled = shuffle(FIGURE_NAMES.concat(FIGURE_NAMES));
const figureElements = document.querySelectorAll('.card>i');
figureElements.forEach(
function(currentValue, currentIndex, listObj) {
curren... | [
"function shuffleCards() {\n for (var j = 0; j < cards.length; j++) {\n cards[j].classList.remove('open', 'show', 'match')\n };\n\n allCards = shuffle(allCards)\n for (var i = 0; i < allCards.length; i++) {\n deck.innerHTML = ''\n for (const e of allCards) {\n deck.appendChild(e)\n }\n }\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given 2 known networks names, if there is a probe in fromNet, checks reachability of toNet Basically it requires a probe to do some measure(s) (REACHABILITY_CAPABILITY) from A to B, including all net on the PATH IF fromNet has more that one probe available, one is choosen RANDOMLY The target for measure is the farest I... | function doPathMeasures(fromNet , toNet){
var fromNetID = getNetworkID(fromNet);
var toNetID = getNetworkID(toNet);
if (!fromNetID || !toNetID)
return;
var probesId = hasProbeType(fromNetID , REACHABILITY_CAPABILITY);
// Are there any probes in the from net?
if (probesId.length == 0){
... | [
"checkNetwork(network){}",
"function gatewayIpOnNet(gwName , netName){\n if (!gwName || !netName || (gwName == LEAF_GW))\n return null;\n if (!netDef['gateways'][gwName]){\n showTitle(\"Missing info about net gateway \" + gwName);\n return null;\n }\n for (var i=0 ; i<netDef['gate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a function that adds two numbers and alerts the sum | function addTwoAndAlert(num1,num2){
let answer = num1 + num2
alert(answer)
} | [
"function add(num1, num2){\n console.log(\"Summing Numbers!\");\n console.log(\"num1 is: \" + num1);\n console.log(\"num2 is: \" + num2);\n var sum = num1 + num2;\n return sum;\n }",
"function addSum(a,b){\n var answer = a + b;\n//4. Create a function that returns the diff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert vowel to hindi matra, given whether or not there is space for a matra | function vowel_to_hindi(eng, space_for_matra) {
if (space_for_matra) {
return vowel_to_hindi_matra(eng);
}
else {
return vowel_to_independent_hindi_vowel(eng);
}
} | [
"function ipa_adjust_doubleVowel(graphemes) {\n\n var doubleVowel = {\n \"\\u0069\":\"\\u0069\\u02D0\", // LATIN SMALL LETTER I to I with IPA COLON\n \"\\u0251\":\"\\u0251\\u02D0\", // LATIN SMALL LETTER ALPHA to ALPHA with IPA COLON\n \"\\u0075\":\"\\u0075\\u02... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map a `DraftEditorCommand` command value to a corresponding function. | function onKeyCommand(command, editorState) {
switch (command) {
case 'redo':
return EditorState.redo(editorState);
case 'delete':
return keyCommandPlainDelete(editorState);
case 'delete-word':
return keyCommandDeleteWord(editorState);
case 'backspace':
return keyCommandPlainBa... | [
"function commandFunc(id){\n\n}",
"function transrateCommand(command){\n\tvar array_tmp = command.split(\"、\");\t\n\tvar str_tmp = \"\";\n\tswitch(array_tmp[0]){\n\t\t\tcase \"■背景\":\n\t\t\t\tstr_tmp = \"bg\";\n\t\t\tbreak;\n\t\t\n\t\t\tcase \"■タイトル\":\n\t\t\t\tstr_tmp = \"title\";\n\t\t\tbreak;\n\t\t\t\n\t\t\tca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets technologies list from json | function getTechnologies() {
$http.get('/assets/json/technologies.json')
.success(function (data) {
$scope.technologies = data;
});
} | [
"function TechnologyList() {\n const technologies = [\n {\n name: \"Node.js\",\n id: 1,\n },\n {\n name: \"Express\",\n id: 2,\n },\n {\n name: \"React\",\n id: 3,\n },\n {\n name: \"Jest\",\n id: 4,\n },\n {\n name: \"JWT\",\n id: 5,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the sum of the number of CPU ms spent by this UserExpectation. | get totalCpuMs() {
var cpuMs = 0;
this.associatedEvents.forEach(function (event) {
if (event.cpuSelfTime) cpuMs += event.cpuSelfTime;
});
return cpuMs;
} | [
"get bestGuessAtCpuCount() {\n var realCpuCount = tr.b.dictionaryLength(this.cpus);\n if (realCpuCount !== 0)\n return realCpuCount;\n return this.softwareMeasuredCpuCount;\n }",
"elapsed() {\n if (this.sumElapsed === 0) {\n console.error('Got level duration as 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a version of an array that is scale x bigger | function magnifyArray(arr, scale) {
var res = [];
if(!arr.length)
return arr;
for (var i = 0; i < arr.length; i++) {
var temp = magnifyArray(arr[i], scale);
for (var k = 0; k < scale; k++) {
res.push(temp.slice ? temp.slice(0) : temp);
}
}
return res;
} | [
"function scaleData(unscaledData, height, width) {\n\tscaledData = [];\n\n\t//Create the scalers with computed min/max values\n\tvar x = d3.scaleLinear()\n\t\t\t .domain([X_MIN, X_MAX])\n\t\t\t .range([0, width]);\n\n\tvar y = d3.scaleLinear()\n\t\t\t .domain([Y_MIN, Y_MAX])\n\t\t\t .range([0, height]);\n\n\t//... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to display an hr element as a divider between list of categories and form elements if there are more than 1 li elements(category item) or else hide the hr element | function displayDivider() {
var elems = document.querySelector("#categoryContainer").childNodes;
var num = 0;
for(var i = 0; i < elems.length; i++){
if(elems[i].nodeType === 1) {
num += 1;
}
}
if(num > 0){
document.getElementById("categoryDivider").style.display = "block";
} else {
document.getElemen... | [
"function setNavDivider() {\r\n if ($('ul#templatesNav > li').exists() && $('ul#categoriesNav > li').exists()) {\r\n $('#navDivider').show();\r\n } else {\r\n $('#navDivider').hide();\r\n }\r\n }",
"function showItems() {\n // Get li's in list\n var listitems = $('li.alert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the slide to a given slide id | function changeSlide(slideId) {
clearInterval(slideShow);
setSlide(slideId);
updateSlideVars(slideId);
if (autoPlay) {
play()
}
} | [
"function changeImage(){\n\tdocument.getElementById(slidename).src = slideImages[step].src\n}",
"moveToSlide( slide) {\n console.debug( \"dia-show › moveToSlide()\", slide);\n this.slide = slide != undefined ? slide : null;\n }",
"function switchSlides() {\n\n pit.cookies.set({\n name: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scene_Workman_Options The scene class of the options screen. | function Scene_Workman_Options() {
this.initialize.apply(this, arguments);
} | [
"function Workman_Options() {\n this.initialize.apply(this, arguments);\n}",
"function createOptions(game) {\n // Data\n var music = game._music;\n var playerData = game._playerData;\n\n // Background\n fadeSceneIn(game, null, null, true);\n game.add.image(0, 0, 'game-bg').setOrigin(0, 0);\n\n\n // Menu s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand/Collapse Absolute Help Content French | function toggleHelpAbsoluteFrench(obj, a_id) {
var content = document.getElementById(obj);
var opener = document.getElementById(a_id);
iconState = opener.lastChild.alt;
iconState = iconState.replace("R\u00E9duire","");
iconState = iconState.replace("D\u00E9velopper","");
if (content.style.display != "none"... | [
"function toggleHelpInline(obj, a_id) {\n\tvar content = document.getElementById(obj);\n\tvar opener = document.getElementById(a_id);\n\t\n\ticonState = opener.lastChild.alt;\n\ticonState = iconState.replace(\"Collapse\",\"\");\n\ticonState = iconState.replace(\"Expand\",\"\");\n\t\n\t\tif (content.style.display !=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permite verificar si un select tiene algun valor seleccionado | function verificar_select_seleccionado() {
if ($("#id_provincia option:selected").text() != '-- Seleccione --') {
$('#id_canton').prop('disabled', false);
$('#id_parroquia').prop('disabled', false);
}
} | [
"function checkSelect(select){\r\n\treturn (select.selectedIndex > 0);\r\n}",
"function checkSelectCase() {\n //get the value of the option selected\n let optionValue = $(\"select\").val();\n\n //take out the default value\n let optionValid = optionValue != null;\n //make the logic\n if (optionV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add column to existing row | function addColumn(event) {
rowColumns[currentRow] = rowColumns[currentRow] + 1;
event.column = rowColumns[currentRow];
} | [
"async add_new_col(new_col, cols) {\n this.df = this.df.map(row => {\n var val = 0\n cols.forEach(c => {\n if (!isNaN(row[c])) val += Number(row[c])\n });\n row[new_col] = val\n return row\n })\n }",
"function _addColumn(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JS expression parser: WooCommerce cost examples: | function ParseAndCalcShipCost(val) {
console.log('ParseAndCalcShipCost()')
if (val == null || val == '')
return 0
var expression = val.toLowerCase().replace(/'/g, '"')
// var expression = '20 + [ fee percent="10" min_fee="4" ]'
// var expression = '20 + [ qty]*10'
// var expression = '[qty] * 10 ... | [
"function shippingCost(order)\n{\n return order.shipping_lines.reduce((total, sl) => total + parseFloat(sl.price), 0);\n}",
"function makeTestChemicalEquation(reacts, prods){\n let eq = {};\n eq[EQUATION_PROPERTY_REACTANTS] = reacts;\n eq[EQUATION_PROPERTY_PRODUCTS] = prods;\n return eq;\n}",
"_e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: ServerBehavior.queueDocEditsForDelete DESCRIPTION: Schedule the SB edits required to delete this server behavior. They are commited when dwscripts.applyDocEdits() is called. ARGUMENTS: none RETURNS: boolean true if successful. | function ServerBehavior_queueDocEditsForDelete()
{
extGroup.queueDocEditsForDelete(this);
return true;
} | [
"function extPart_queueDocEditsForDelete(partObj)\n{\n var partName = partObj.getName();\n var nodeSeg = partObj.getNodeSegment();\n var version = partObj.getVersion();\n\n var optionFlags = 0;\n if (version < 5.0)\n {\n optionFlags = docEdits.QUEUE_DONT_MERGE;\n }\n\n if (extPart.DEBUG) alert(\"deleting... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
User is typing (since 1.1) | function user_is_typing(type, id)
{
var token = $('#token').val();
var URL = $.base_url + 'ajax/chat_type_ajax.php';
var timer, timeout = 750;
$(type).keyup(function()
{
if (typeof timer != undefined)
clearTimeout(timer);
$.post(URL, 'status=typing_'+id+'&token='+toke... | [
"function updateTyping() {\n\n if (!typing) {\n typing = true;\n socket.emit('typing', {name:username});\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function() {\n var typingTimer = (new Date()).getTime();\n var timeDiff = ty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch all existing text_notes | function getAllTextNotes(){
var count = 0;
text_noteRef.once("value")
.then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
count += 1;
var eachNote = childSnapshot.val();
showTextNote(childSnapshot.key, eachNote.note);
});
});
} | [
"async getNotes() {\n\t\ttry {\n\t\t\tconst notes = await readFileAsync(\"db/db.json\", \"utf8\");\n\t\t\treturn JSON.parse(notes);\n\t\t} catch (err) {\n\t\t\tthrow err;\n\t\t}\n\t}",
"static async getAll(lessonId) {\n const result = await db.query(\n `SELECT * FROM notes WHERE lesson_id = $1`,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes and optionally assigns the scroll height of an object id the id of some object assign true/flase as to whether the assignment should be made return a number Compatibility: IE, NS6 | function i2uiComputeScrollHeight(id, assign)
{
var height = 0;
var unknown = 0;
var obj = document.getElementById(id)
if (obj != null)
{
if (document.all)
return obj.scrollHeight;
var kids = obj.childNodes;
if (kids != null)
{
for (var i=0; i<kids.length; i++)
... | [
"function i2uiManageTableScroller(id,maxheight,newheight)\r\n{\r\n if (document.layers || document.all)\r\n return;\r\n var table_obj = document.getElementById(id);\r\n var scroller_obj = document.getElementById(id+\"_data\");\r\n if (table_obj != null && scroller_obj != null)\r\n {\r\n var len = tabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check Artist Sprite's "When I Receive" scripts for a sound block | checkSound(sprite) {
let sound = false;
// iterate through each of the sprite's scripts that start with the event 'When I Receive'
for (var script of sprite.scripts.filter(s => s.blocks[0].opcode.includes("event_whenbroadcastreceived"))) {
iterateBlocks(script, (block, level) => {
... | [
"function mixedShot() {\n playSound(\"audioMixedShot\");\n }",
"function checkGameCodes(game, playerData, code) {\n var success = false;\n\n if (code == \"Jess#8978\") {\n addServant(playerData, Artemis(game));\n success = true;\n }\n\n\n if (success) {\n var sound = game.sound.add(\"accept... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to Email the Contact using the native email tool | function emailContact() {
/**
* Appcelerator Analytics Call
*/
Ti.Analytics.featureEvent(Ti.Platform.osname+".details.emailButton.clicked");
/**
* Account for if the user is on iOS and using a simulator - iOS Simulator no
* longer supports sending email as of iOS 8
*/
if(OS_IOS && Ti.Platform.model ==... | [
"function _sendEmail() {\n\t\t\t}",
"sendEmail(sendBody) {\n return API.post(\"emailto\", \"/emailto\", {\n body: sendBody\n });\n }",
"function sendEmail() {\n const mailOption = {\n to: toEmail,\n from: fromEmail,\n subject: `Change detected in ${urlToCheck}`,\n html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get tenant script content based on unique script id and version identifier. | function getTenantScriptContent(axios$$1, identifier, tenantToken, scriptId, versionId) {
return restAuthGet(axios$$1, 'instance/microservice/' + identifier + '/tenants/' + tenantToken + '/scripting/scripts/' + scriptId + '/versions/' + versionId + '/content');
} | [
"function getGlobalScriptContent(axios$$1, identifier, scriptId, versionId) {\n return restAuthGet(axios$$1, 'instance/microservice/' + identifier + '/scripting/tenants/' + tenantId + '/scripts/' + identifier + '/' + scriptId + '/versions/' + versionId + '/content');\n }",
"function getTenantScriptMetadata(ax... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively get pages of uploads from one chat. This function returns a promise with the number of uploads in the chat. | function getAllUploadsOfChatPromise(chatId, cursor, optionalAfter, optionalBefore) {
return connector.getChatUploadsPromise(chatId, cursor, optionalAfter, optionalBefore)
.catch(err => HttpErrorHandler.bailOut(err, "chat_messages_read"))
.then(bodyWithPageOfUploads => {
console.log("\nPage " + (++pageCo... | [
"async function getFollowers(login) {\n let response = 0;\n let followers = 0;\n let page = 1;\n let done = false;\n while (done === false) {\n response = await fetch(githubFollowers(login, page))\n .then(res => res.json())\n .then(json => {\n return json.length;\n });\n followers +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to update the time. This runs every minute and when the hour changes, the coloring will update | function setTime() {
setInterval(function() {
// Checking to see if the current hour matches what the page thinks it is
if (curHour != parseInt(moment().hour())) {
// Updating the current hour
curHour = parseInt(moment().hour());
//console.log("You entered an hour... | [
"function updateTime() {\n const datetime = tizen.time.getCurrentDateTime();\n const hour = datetime.getHours();\n const minute = datetime.getMinutes();\n const second = datetime.getSeconds();\n\n const separator = second % 2 === 0 ? \":\" : \" \";\n\n $(\"#time-text\").htm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get face option parameter. | function addFaceOptionParameter(params, section) {
// options
let optionKeys = ['eye', 'nose', 'mouth', 'blink', 'age', 'gender',
'faceDirection', 'gaze', 'expression'];
let options = new Array();
for (let index in optionKeys) {
let optionKey = optionKeys[index];
if ($('#' + o... | [
"get(name) {\n return this.options[name];\n }",
"getFlagParameter(parameterLongName) {\n return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Flag);\n }",
"static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('flav... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursive method to render all layers of nested todos. | function renderNestedTodos(todoList, todoListUl) {
for (var i = 0; i < todoList.length; i++) {
var nestedTodoList = todoList[i].nestedTodos; // access the nestedTodos array, if it exists.
var todoNode = App.getTodoListNodeById(todoListUl, todoList[i].id); // access each li on the root todo-list... | [
"function render_menu(menu, root) {\n for(var idx in menu) {\n var item = menu[idx];\n var key = item.kind || 'item';\n\n // Collection of functions we're going to use to render each type of list item\n var render = {\n 'header' : function header_template(item) {\n var label =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This service contains the rail which can be edited, saved, loaded and visualized. The camera can be moved on a rail as implemented with the PathControls | function RailService(CameraService, SceneService, THREE, toastr, $window) {
/**
* A waypoint is a user picked camera location and look at location.
* Format of one waypoint is [camX,camY,camZ,lookatX,lookatY, lookatZ]
* Positions are in geospatial coordinate system.
*
* @type {Array}
*... | [
"roadLineDrawtest()\n {\n this.direction.route({\n origin:{lng:-78,lat:39.137},\n destination:{lat:39.281,lng:-76.60},\n travelMode:google.maps.TravelMode.DRIVING\n },(r,s)=>{\n var pathPoints=r.routes[0].overview_path;\n var path=new google.ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Waits for the image to load and then tries to decode it. | _decodeOnLoadImage(element){return __awaiter$1(this,void 0,void 0,function*(){const isImageLoaded=BrowserCodeReader$1.isImageLoaded(element);if(!isImageLoaded){yield BrowserCodeReader$1._waitImageLoad(element);}return this.decode(element);});} | [
"decodeFromImageElement(source){return __awaiter$1(this,void 0,void 0,function*(){if(!source){throw new ArgumentException('An image element must be provided.');}const element=BrowserCodeReader$1.prepareImageElement(source);// onLoad will remove it's callback once done\n// we do not need to dispose or destroy the im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively checks whether an object has any undefined values inside. | function hasUndefined(obj) {
if (obj === undefined) {
return true;
}
if (obj) {
if (Array.isArray(obj)) {
for (var i = 0, len = obj.length; i < len; i++) {
if (hasUndefined(obj[i])) {
return true;
}
}
... | [
"function hasUndefined(obj) {\r\n\t if (obj === undefined) {\r\n\t return true;\r\n\t }\r\n\t if (obj) {\r\n\t if (Array.isArray(obj)) {\r\n\t for (var i = 0, len = obj.length; i < len; i++) {\r\n\t if (hasUndefined(obj[i])) {\r\n\t return true;\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
same as downloadHanlder, but wraps the promise with a raced timeout... could also return the original promise, and stick it in an unresolved queue. The timeout here, is for download to have been initiated, not finished.. | function downloadHandlerWithTimeout (n, id, timeout) {
const [responseHandler, responsePromise] = downloadHandler(n, id, timeout)
// Promise.race between responsePromise and sleep
// let [completed] = await Promise.race(queue.map(p => p.then(res => [p])));
const responseWithTimeoutPromise = Promise.race([
r... | [
"function downloadHandler (n, id, timeout) {\n // parameter; id is included in closure\n const start = +new Date()\n let resolver\n const responsePromise = new Promise(function (resolve, reject) {\n resolver = resolve\n })\n\n const responseHandler = response => {\n const url = response._url\n const ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a Date object and returns a Date which is the last day of that month. For example: lastDayOfMonth(new Date(2019, 2, 7)) // => new Date(2019, 2, 28) Input type: Date Output type: Date | function lastDayOfMonth(date) {
return new Date(date.getFullYear(), date.getMonth() + 1, 0)
} | [
"function getMonthLastDate(year, month) {\n return new Date(year, month + 1, 0, 23, 59, 59, 999);\n}",
"function NLDate_getLastDayOfMonth(dDate)\n{\n var m = dDate.getMonth();\n var days = NLDate_pnDaysInMonths[m];\n\n if(m == 1) // feb -- handle possible leap year\n {\n var y = dDate.getYear(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A BotRunner listens for POST requests, forwards them to bots registered under it, and submits their responses to a given function. submit is the function to be called when the bot says something. options is an object that may contain the following keys: verbose: Whether to print debug messages, etc. debugBotId: The bot... | function BotRunner(submit, options) {
if (typeof submit !== 'function') {
throw new TypeError('submit must be a function');
}
// if options wasn't given, use a default object
options = options || {
verbose: false,
debugBotId: undefined
};
if (typeof options !== 'object'... | [
"function ProcessSubmission (options) {\n return function (req, res, next) {\n if (!req.body.length) {\n return next(new Error('No form submission found'))\n }\n\n logger.info('Received xml submission')\n\n options = extend(defaults, options)\n\n options.meta = extend(options.meta, {\n dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get registration no from color | getRegNoFromColor(color) {
try {
const registrationNo = this.parkingManager.getRegNumberForColor(color);
if(registrationNo.length === 0)
console.log('Not Found');
else {
console.log(registrationNo.join(","));
}
} catch (e) {... | [
"function get_color_index(selector, elem) {\n var result = null;\n $root.find(selector + \" .color_sample\").each(function(i, e) {\n if(e == elem) result = i;\n });\n return result;\n }",
"function _g_scr_color() { \n\tvar sc=\"\";\n\tif (self.screen) {\n\t\tsc=sc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse an event names object | function parseEventNamesObject(operatorsOriginal, listenerEventsMemory) {
// Checks
if (config.checks)
// Loop over the operators
for (var i3 = 0, length3 = operatorsOriginal.length; i3 < length3; i3++) {if (operatorsOriginal[i3] !== null) {
// Even and not a string, array or boolean
if... | [
"function decodeEvents(events) {\n // If `events` is falsy return empty array\n if(!events){\n return [];\n }\n // If value passed is an array, return it untouched\n if (_.isArray(events)) return events;\n\n // If value passed is an object, return it wrapped in an array\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens the dialog to rename a particular folder, and does the renaming if the user clicks OK in that dialog | renameFolder(aFolder) {
let folder = aFolder || GetSelectedMsgFolders()[0];
let controller = this;
function renameCallback(aName, aUri) {
if (aUri != folder.URI)
Cu.reportError("got back a different folder to rename!");
controller._resetThreadPane();
let folderTree = GetFolderTre... | [
"function renameElement() {\n var id = $(this).parent().attr(\"data-id\");\n var item = fileSystem.findElementById(id);\n var editedItemName = prompt(\"Please enter the new name\", item.name);\n if (editedItemName == undefined) {\n return;\n }\n try {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts an entry into the pool list for searching. | function insertPoolListRecord(dynamo, config, pool) {
return dynamo
.put(insertRequest(config, poolListItem(config, pool)))
.promise();
} | [
"insert(key, value) {\n // const strKey = typeof key === 'number' ? key.toString() : key;\n const index = getIndexBelowMax(key, this.limit);\n const bucket = this.storage;\n\n if (bucket.get(index) === undefined) { // No bucket at index yet\n bucket.set(index, [[key, value]]); // Create... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle a P2P stream request (seeder side) | function onP2PstreamRequest(evt) {
util.trace('DataChannel opened');
var chan = evt.channel;
chan.binaryType = 'arraybuffer';
var trackWanted = chan.label;
var cancellable;
chan.onmessage = apply(function(evt) {
util.trace('Receiving P2P stream request');
var req = JSON.parse(evt.d... | [
"streamHandshakeHandler(msg) {\n\n // Also his only role is to receive the message and log it. It doesn't even\n // do anything useful with it. Gods what a stupid handler.\n console.log(JSON.parse(msg.data));\n\n let start_msg = {\n \"client_id\": this.id,\n \"rover... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a random row and column value within the contraints of the table size itself | function getRandomCell() {
var randRow = Math.floor(Math.random()*tableHeight) + 1;
var randCol = Math.floor(Math.random()*tableWidth) + 1;
return [randRow, randCol];
} | [
"static generateFood(model, rows, columns) {\n const FOOD_LIMIT = rows;\n let size = FOOD_LIMIT;\n for (let i = 0; i < size; i++) {\n const x = Math.floor(Math.random() * FOOD_LIMIT);\n const y = Math.floor(Math.random() * columns);\n const currentValue = model[x][y];\n if (currentValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the state with a new active view | setActiveView(view) {
this.setState({activeView: view});
} | [
"function changeView(newMenuBtn, newView) {\n $(activeMenuBtn).removeClass(\"menu-btn-selected\");\n $(newMenuBtn).addClass(\"menu-btn-selected\");\n activeMenuBtn = newMenuBtn;\n\n const mainInitialHeight = viewsContainer.offsetHeight + \"px\";\n root.style.setProperty(\"--views-container-initial-height\", ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for creation Monthyear title | function CreateMonthYearTitle(month, year) {
var month_array = ['January', 'Fabruary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
for (var i = 0; i < month_array.length; i++) {
if (month === i) {
monthYearHeader.innerHTML = month_... | [
"function printMonthTitle(month, year) {\n output = monthsName[month] + ' ' + year + '.';\n document.getElementsByClassName(\"date-info\")[0].innerText = output;\n }",
"getMonthOfYear() {\n switch (this.getJMonth()) {\n case '1':\n return 'فروردین';\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the json object with guid===guid | jsonread(guid) {
return __awaiter(this, void 0, void 0, function* () {
const jsondata = this.jsonreadall();
const result = jsondata.filter((el) => el.guid === guid);
if (result.length !== 0) {
return result[0].secret.toString();
}
else
... | [
"jsondelete(guid) {\n const alljson = this.jsonreadall();\n const result = alljson.filter((el) => el.guid !== guid);\n const resultstring = JSON.stringify(result);\n fs_1.default.writeFileSync(path_1.default.join(__dirname, 'guiddata.json'), resultstring);\n }",
"function findObject... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the placeholder value on a single element. Returns true if the placeholder was shown and false if it was not (because it was already visible) | function showPlaceholder(elem) {
var type,
val = elem.getAttribute(ATTR_CURRENT_VAL);
if (elem.value === "" && val) {
elem.setAttribute(ATTR_ACTIVE, "true");
elem.value = val;
elem.className += " " + placeholderClassName;
// If the type of ele... | [
"placeholderHidden() {\n return !!(this.labels.length > 0 || this.value);\n }",
"handlePlaceholderVisibility() {\n if (!this.multiple)\n return;\n const e = this.choicesInstance.containerInner.element.querySelector(\n \"input.choices__input\"\n );\n this.placeholderText... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called to retrieve the code that the experiment demands. | fetchExperiment(_expID, _code) {
console.log("\nInside fetchExperiment method:");
console.log("ExpID:" + this.web3.utils.bytesToHex(_expID));
console.log("Exp code: " + _code);
// VERSION 0.1 DOES NOT CONTROL THE FETCHING OF EXPERIMENT CODE. IT CALLS THE EXECUTE EXPERIEMNT IMMEDIATE.
... | [
"function getUrlCode() {\n\n const param = 'code';\n\n return getUrlParameter( param );\n\n }",
"get code() {\n return this.result.code;\n }",
"function call_hscode(){\n\t\tstrURL = \"hs_code.html\";\n\t\tPopupOpenDialog(850,490);\n\n\t\tif(PopWinValue != null ){\n\t\t\tgc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggers screenshot after timetout | function captureScreenshot() {
setTimeout(() => {
Page.captureScreenshot({ format: 'png' }).then(afterCapture);
}, timeout);
} | [
"function processScreenshot(args, document) {\n if (args.delay > 0) {\n return new Promise((resolve, reject) => {\n document.defaultView.setTimeout(() => {\n processScreenshotNow(args, document).then(resolve, reject);\n }, args.delay * 1000);\n });\n }\n else {\n return processScreensho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new AxesViewer | function AxesViewer(scene,scaleLines){if(scaleLines===void 0){scaleLines=1;}this._xline=[BABYLON.Vector3.Zero(),BABYLON.Vector3.Zero()];this._yline=[BABYLON.Vector3.Zero(),BABYLON.Vector3.Zero()];this._zline=[BABYLON.Vector3.Zero(),BABYLON.Vector3.Zero()];/**
* Gets or sets a number used to scale line ... | [
"initAxes() {\n // length of the axes\n const length = 100;\n\n const lineMaterial = new THREE.LineDashedMaterial({\n ...this.settings.lineMaterial,\n color: this.settings.colors.amber,\n });\n const points = [\n new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changingFaceColor Face will animate (fade) from one shade of blue to another | function changingFaceColor() {
$faceBg.animate({
backgroundColor: '#0077b3;'
}, COLOR_CHANGE_SPEED, function() {
changingFaceColor2();
});
} | [
"function changingFaceColor2() {\n $faceBg.animate({\n backgroundColor: '#006699;'\n }, COLOR_CHANGE_SPEED, function() {\n changingFaceColor();\n });\n}",
"setFaceColor ( face, RGB) {\n\t\t// debug\n\t\t//console.log(\"atomicGLskyBox(\"+this.name+\")::setFaceColor\");\n\t\tvar r = RGB[0];\n\t\tvar g = RG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter for this.consent_disclosure, tells the model whether to offer consent disclosure frame. | set_consent_disclosure(value) {
this.consent_disclosure = value;
return this;
} | [
"build_consent_disclosure_frame() {\n let consent_questions = [];\n for (let question of CONSENT_DISCLOSURE_QUESTIONS) {\n consent_questions.push([question, false]);\n }\n\n let consent_frame = {};\n\n consent_frame.title = CONSENT_DISCLOSURE_TITLE;\n consent_fra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new ActivityPostAllOf. | constructor() {
ActivityPostAllOf.initialize(this);
} | [
"function bulkCreateActivityGroups() {\r\n var ss = SpreadsheetApp.getActiveSpreadsheet();\r\n var sheet = ss.getSheetByName(CREATE_ACTIVITY_GROUPS);\r\n\r\n // This represents ALL the data\r\n var range = sheet.getDataRange();\r\n var values = range.getValues();\r\n\r\n const profile_id = _fetchProfileId();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the map details overlay | function showMapDetails() {
var mapInfo = this.parentNode;
var id = mapInfo.getAttribute("data-id");
var map = mapInfo.parentNode;
openMap = map;
// Create transparent overlay and append to page
var overlay = document.createElement("div");
overlay.id = "overlay";
document.body.appendChild(overlay);
// Create... | [
"function displayMap(){\n var coordinates = infoForMap();\n createMap(coordinates);\n}",
"function makeDetailsVisible() {\n setDetailView(\"show-details\");\n setBlurry(\"blurred-out\");\n }",
"function showInfoWindow() {\n var marker = this;\n hotels.getDetails({placeId: marker.placeResult.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used for editing an issue Creates a new form already filled in with the issue's details | function editIssue(obj) {
// Creates a form for editied issue
var form = document.createElement("form");
form.setAttribute("id","listAll");
// ID of issue
var id = document.createElement("p");
id.innerHTML = "<b>ID:</b>" + obj["ID"];
// Title box
var tit = document.createElement("input");
tit.setAtt... | [
"function _createIssue() {\n if (currentRepo && currentRepo.repo) {\n var dialog = Dialogs.showModalDialogUsingTemplate(\n Mustache.render(IssueDialogNewTPL, currentRepo)\n );\n \n var submitClass = \"gh-create\",\n cancelClass = \"gh-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GCode file info caching | function loadFileCache() {
cachedFileInfo = getLocalSetting("cachedFileInfo", {});
} | [
"fileListCache() {\n return remote.getGlobal('application').fileListCache;\n }",
"function FileInfo() {\n}",
"set(file) {\n this.cache.set(file.path, file);\n }",
"static instances(){\n return Object.keys(__cache).map(path => __cache[path])\n }",
"async function cacheFiles() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONSTRUCTOR :: STRING > yngwieNode | constructor(value) {
if (typeof(value) === "string") {
this._value = value; // Arbitrary STRING value that can be stored by this node
this._parent = undefined; // Parent of this node
this._first = undefined; // First child of this node
this._last = undefined; // Last child of thi... | [
"function objj_string(string) {\n\treturn new _CPString2.default(string);\n}",
"function TrueNode() {\n}",
"function Node(x,y) {\n\tthis.x = x;\n\tthis.y = y;\t\n}",
"constructor(idNode, value) {\n this.idNode = idNode;\n this.value = value;\n // ideally valueNode would be cloned otherwise it can get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Magento 2: createCustomer normalizer | function normalizer(rawData) {
const rawCustomerData = get(rawData, 'data.createCustomer.customer', null);
const firstName = get(rawCustomerData, 'firstname', null);
const lastName = get(rawCustomerData, 'lastname', null);
const isSubscribed = get(rawCustomerData, 'is_subscribed', null);
return {
account:... | [
"function createCustomer(so,callback){\n\t// Create customerCode\n\tvar genCode=new Request(\"DECLARE @docCode NVARCHAR(30);EXEC [dbo].GenerateDocumentCode @Transaction='CustomerDetail', @DocumentCode=@docCode output;SELECT @docCode;\",function(err,rowCount,docRows){\n\t\tvar customerCode=docRows[0][0].value;\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Production PrintStatement ::== print ( Expr ) | function parse_PrintStatement(){
document.getElementById("tree").value += "PARSER: parse_PrintStatement()" + '\n';
CSTREE.addNode('PrintStatment', 'branch');
matchSpecChars(' print',parseCounter);
parseCounter = parseCounter + 1;
matchSpecChars('(',parseCounter);
parseCounter = parseCounter + 1;
p... | [
"function generatePrint(node)\n\t{\n\t\t// Get the node containing the value we want to print\n\t\tvar valueNode = node.children[0];\n\n\t\t// Three cases:\n\t\t// 1. Id - determine whether the Id's value is a static or heap value and handle appropriately\n\t\t// 2. String - get the ascii values representing the st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
member function collideOverlaps(overlaps) applies collisions to all of the detected overlaps params: overlaps:[box] an array of collisions that should be applied | collideOverlaps(overlaps){
if(overlaps.length <= 0)
return;
var c = this.getCol();
for(var i = 0; i < overlaps.length; i += 1){
if(overlaps[i].largestSideLength() < 2)
continue;
if(overlaps[i].size.x > overlaps[i].size.y){ //vertical collision
if(c.top() == overlaps[i].top()) // ceiling
t... | [
"checkBlocks(){\n\t\tvar overlaps = [];\n\t\tfor (var i = 0; i < blocks.length; i += 1){\n\t\t\tif(box.testOverlap(this.getCol(), blocks[i].col))\n\t\t\t\toverlaps.push(box.intersection(this.getCol(), blocks[i].col));\n\t\t}\n\t\tthis.collideOverlaps(overlaps);\n\t}",
"collisions() {\r\n this.collisionEcra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subtracts the amount that an element is overflowing on an axis from its length. | _subtractOverflows(length, ...overflows) {
return overflows.reduce((currentValue, currentOverflow) => {
return currentValue - Math.max(currentOverflow, 0);
}, length);
} | [
"getMaxX(){ return this.x + this.width }",
"subtract(otherSize) {\n const r = new Size(this.width - otherSize.width, this.height - otherSize.height);\n return r;\n }",
"_decreaseX() {\n if (!this._invertedX()) {\n this.valueX = Math.max(this.minX, this.valueX - this.stepX);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the option based on the get parameter, if supplied. | function jkn_rdr_read_get() {
var $option = jkn_rdr_url_param(JKNRendererSwitch.get_key);
if ($option) {
$select = $('#' + JKNRendererSwitch.id_select);
// Only change if we have such an option
if ($select.has('[value="' + $option + '"]').length > 0) {
$select.val($option);
... | [
"setOption(option, value) {\n this.options_[option] = value;\n return this.store();\n }",
"function updateOptionList (listName, updateFunc) {\n var newOptions;\n\n if (!directory.hasOwnProperty(listName)) {\n $log.error('No known option list with name: ', listName);\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a font is selected, loop through the existing fonts and remove the active class, then add the active class to the font that was clicked | function handleFontFamily(font, event) {
setFontFamily(font);
let fontButtons = document.querySelectorAll(".font-button");
fontButtons.forEach((item) => {
item.classList.remove("active");
});
event.target.classList.add("active");
} | [
"_listenFontSelectionChange() {\n var self = this;\n BB.comBroker.listenWithNamespace(BB.EVENTS.FONT_SELECTION_CHANGED, self, function (e) {\n if (!self.m_selected || e.caller !== self.m_labelFontSelector) {\n return;\n }\n var config = e.edata;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
log a specific challenge to a specific trophy | function challengeToTrophy(trophy) {
var trophy_title = "Trophy";
var trophy_description = "Description";
var numCom = 0;
// key will be "monNum-Date"
var monNum = m + 1;
passDate = date;
if( passDate < 10 ) {
passDate = "0" + date;
}
var tDate = monNum + "-" + passDate;
var chalT = $("#challenge").text(... | [
"function addChallenge(goal, duration, miles) {\n $.post(\"/api/hiking\", {\n goal: goal,\n duration: duration,\n miles: miles\n }).then(data => {\n window.location.replace(\"/profile\");\n // If there's an error, handle it by throwing up a bootstrap alert\n });\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw basic circles indicating stations | function drawStationCircles(canvas,xscale,yscale,data){
canvas.selectAll(".StationCircle")
.data(data)
.enter().append("circle")
.attr("class","StationCircle")
.attr("id", function(d){ return d.ST_NAME_EN; })
.attr("r",1)
.attr("cx",function(d){return xscale(... | [
"function draw_circle() {\n ctxe.beginPath()\n ctxe.arc(EW_CENTER_POINT.x, EW_CENTER_POINT.y, inverseWavelength, 0, Math.PI * 2)\n ctxe.stroke()\n }",
"function draw_layer(num_neur, x_pos, diam) {\n let ver_dist = height / (num_neur+1);\n for (let i = 1; i <= num_neur; i++) {\n fill(2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deserialize simple Python objects back into Django ORM instances. It's expected that you pass the Python objects themselves (instead of a stream or a string) to the constructor | function Deserializer(object_list) {
models.get_apps();
for each (var d in object_list) {
// Look up the model and starting build a dict of data for it.
var Model = models.get_model_by_identifier(d["model"]);
if (Model == null)
throw new sbase.DeserializationError("Invalid mo... | [
"deserialize(any) {\n const desc = this.lookupDescriptor(any);\n let bytes = any.value;\n if (typeof bytes === \"undefined\") {\n bytes = new Buffer(0);\n }\n return desc.decode(bytes);\n }",
"static cast(t) {\n return new BaseProof(t.toJSON())\n }",
"serialize(obj) {\n if (!obj.cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finds the angle of (x,y) on a plane from the origin | function getAngle(x, y) {
return Math.atan(y/(x==0?0.01:x))+(x<0?Math.PI:0);
} | [
"function angularCoord(x, y)\n {\n var phi = 0.0;\n\n if (x > 0 && y >= 0) {\n phi = Math.atan(y / x);\n }\n if (x > 0 && y < 0) {\n phi = Math.atan(y ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pos = 0; total = 0; links = 0; | constructor() {
this._pos = 0;
//this.total = 0;
this._links = [];
} | [
"function setLinkIndexAndNum()\r\n {\r\n for (var i = 0; i < finalResult[1].length; i++)\r\n {\r\n if (i != 0 &&\r\n finalResult[1][i].source == finalResult[1][i - 1].source &&\r\n finalResult[1][i].target == finalResult[1][i - 1].target)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helpers Augment a target Object or Array by intercepting the prototype chain using __proto__ | function protoAugment(target,src){/* eslint-disable no-proto */target.__proto__=src;/* eslint-enable no-proto */} | [
"function extend(__proto__) {\n for (var key in __proto__) {\n if (hasOwnProperty.call(__proto__, key)) {\n this[key] = __proto__[key];\n }\n }\n return this;\n }",
"function overridePrototype(prototype, methodName, func) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the content of all application JavaScript files and pass them to a processor | function getJavaScriptContent(url, processor) {
return bluebird.map(getAppJavaScriptUrls(url), requests.fetch)
.then(responses => bluebird.map(responses, response => response.body))
.then(function(contents) {
return contents.forEach(function(content) {
processor(content);
});
... | [
"function jsTask() {\n return src(files.jsPath)\n .pipe(concat(\"all.js\"))\n .pipe(minify())\n .pipe(dest(\"dist\"));\n}",
"function processScriptsAndSheets() {\r\n\tif (dbug) console.log(\"wwvf-cs::processScriptAndSheets\");\r\n\tif (wetw) {\r\n\t\ttotFiles = wetw[\"css\"].length + wetw[\"js\"].length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method: Get Satellite data | function getSatelliteData(satId) {
var self = this;
var result_obj;
self.loading = true;
// Get request to wheretheiss for data
request({
uri: 'https://api.wheretheiss.at/v1/satellites/'+satId,
method: "GET",
timeout: 10000,
}, function(error, response, body) {
self.loading = false;
... | [
"function getStationsToArray() {\n fetch('https://rata.digitraffic.fi/api/v1/metadata/stations')\n .then((response) => response.json())\n .then(function (response) {\n return response.map(function (data) {\n stations.push(data.stationName);\n stationShorts.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add &DbPAR= and &System= to the links in DisplayArea div / skip for object files | function fixURL(module, system) {
var itemlink = document.getElementById("DisplayArea").getElementsByTagName("a");
var pSystem = (system === null) ? getSystem() : system;
var pAppl = (module === null) ? "WRITER" : module;
var n = itemlink.length;
for (var i = 0; i < n; i++) {
if (itemlink[i]... | [
"function showLinks() {\n var app = UiApp.createApplication();\n var mainPanel = app.createVerticalPanel(); \n var scrollPanel = app.createScrollPanel().setPixelSize(500, 300);\n var links = PropertiesService.getDocumentProperties().getProperty('LINKS');\n if(links != null) {\n links = JSON.parse(Propertie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
submitkommentar() Denne funksjonen skal: sende kommentardata med et ajaxkall til lagrekommentar.php legge til en ny kommentar i DOM | function submitkommentar(){
$("#progress").css("display", "table-row");
$.ajax({url: "/api/lagreKommentar.php",
data: {kommentar: $("#tekstfelt").val(),
dato: new Date().toLocaleDateString(),
album: albumId,
bilde: bilde,
navn... | [
"function ajax_futbol_crear(){\r\n\t\r\n\t\r\n\t$('#form_crear_futbol').submit(function(){\r\n\t\tnew_team_name = $('#nombre_equipo_futbol').val();\r\n\t\t\t\t\r\n\t\t$.ajax({\r\n\t\t type: \"POST\",\r\n\t\t url: \"/crear_equipo_futbol\",\r\n\t\t data: JSON.stringify({myDict: {'equipo_futbol': new_team_nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API const ImWchar GetGlyphRangesChineseSimplifiedCommon();// Default + HalfWidth + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese | GetGlyphRangesChineseSimplifiedCommon() { return this.native.GetGlyphRangesChineseSimplifiedCommon(); } | [
"function buildCharMapIndex() {\n // Unicode Blocks\n let basicLatin = []; // Block: 00..7E; Subset: 20..7E\n let latin1 = []; // Block: 80..FF; Subset: A0..FF\n let latinExtendedA = []; // Block: 100..17F; Subset: 152..153\n let generalPunctuation = []; //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
purpose get referral code args (none) returns (none) | getReferralCode (form_data, success_callback, failure_callback)
{
var url = '/global/crm/user/code/referral/system';
return WebClient.basicPost(form_data, url, success_callback, failure_callback);
} | [
"function getUrlCode() {\n\n const param = 'code';\n\n return getUrlParameter( param );\n\n }",
"function call_hscode(){\n\t\tstrURL = \"hs_code.html\";\n\t\tPopupOpenDialog(850,490);\n\n\t\tif(PopWinValue != null ){\n\t\t\tgcDs2.namevalue(gcDs2.rowposition,\"HSCODE\") = PopWinValue[0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show a list of all lectures. GET lectures | async index () {
const lectures = await Lecture.all();
return lectures;
} | [
"static view() {\n const coursesByDepartment = getCoursesByDepartment(\n courses.list,\n selectedDepartment,\n );\n return getUniqueYears(coursesByDepartment).map(year =>\n m(expandableContent, { name: `Year ${year}`, level: 0 }, [\n getUniqueLecturesByYear(\n coursesByDepart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the passwords entered in the two password fields are matching. If they don't, the submit button remains disabled and a warning message is displayed. | function checkPasswords() {
confirmPasswordMessage.innerHTML = "";
validPassword = true;
submitButton.disabled = true;
const passwordEntry = passwordInput.value;
const confirmPasswordEntry = confirmPasswordInput.value;
if (passwordEntry != confirmPasswordEntry) {
... | [
"function checkPasswords(name1, name2, pwdLen) {\n\n var elem1 = eval(\"'input[name=\" + name1 + \"]'\");\n var elem2 = eval(\"'input[name=\" + name2 + \"]'\");\n\n elem1 = $(elem1)[0];\n var pwd1 = elem1.value;\n\n elem2 = $(elem2)[0];\n var pwd2 = elem2.value;\n\n var saveEl = $('input#btnSub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interpret string as a date range. Accepted formats: 20171224 one day starting at this date 1224 one day starting at this date (previous december) 2017 jun 4 one day starting at this date jan 4 2017 one day starting at this date 2017 jun one monty starting jan 1 2017 2017 the entire year 2017 jun 7 one day starting last... | function dateRangeFromString(s) {
var now = new Date();
var regex = '^(?:' + ['(([0-9]{4})(?:-([0-9]{1,2})(?:-([0-9]{1,2}))?)?)', // year-month-day
'(([0-9]{1,2})-([0-9]{1,2}))', // month-day
'(([0-9]{4})?(?:[ ]*([a-zA-Z]{3})[ ]*([0-9]{1,2})?)?)', // month nam... | [
"function scanRange(string, start = 0, ranges = SPACE) {\n\t\tif ((typeof ranges) === \"string\") {\n\t\t\tranges = getRanges(ranges);\n\t\t}\n\t\tvar subString = \"\";\n\t\tvar char;\n\t\tvar code;\n\t\t_scanString: for (var loc = start; loc < string.length; loc++) {\n\t\t\tchar = string[loc];\n\t\t\tcode = char.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the user with the given name is an assis for this group | isAssis(name){
for(u in this.assisList){
if(u.name == name){
return true;
}
}
return false;
} | [
"is(name) {\n if (typeof name == 'string') {\n if (this.name == name) return true\n let group = this.prop(dist_NodeProp.group)\n return group ? group.indexOf(name) > -1 : false\n }\n return this.id == name\n }",
"function isOrgAccount() {\r\n\t\tvar plate = $( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run Runs all test_ methods in the passed object, displaying any assertions that fail | function run(obj) {
// Add the methods to the object
obj['assert'] = assert;
obj['assertTrue'] = assertTrue;
obj['assertFalse'] = assertFalse;
// Get the current time
var iStart = new Date().getTime();
// Init the count of tests
var iTests = 0;
// Init the list of errors
var lErrors = [];
//... | [
"function runTestCase(object){\n var path = '../testCasesExecutables/' + object.filename;\n var testCase = require(path);\n var result = testCase.test(object.inputs);\n resultsObject[object.number] = createHTMLResultTable(object.number, object.requirement, object.component, object.method, object.inputs,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if date of range changed, save old values, then reload new ones. | function changeDate(after, before) {
if (before !== after) {
if (before) {
var _before = $filter('rangeDate')(before);
dataService.save($scope.xpns, _before);
}
if (after) {
$scope.range = $filter('rangeDate')(after);
... | [
"function setSliderMinMaxDates(range) {\n $scope.layoutEndTimeMS = range.max;\n $scope.layoutStartTimeMS = range.min;\n $scope.currentDate = range.min;\n $scope.layoutCurTimeMS = range.min;\n }",
"function updateIfChanged( newData ) {\n switch ( DA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build the pintrest href link | function build_pintrest_link(img_src,domain) {
// https://pinterest.com/pin/create/button/?url=http://hopetracker.com/inspiration/?og_img=/site/public/images/quotes/quote.choosing_peace.jpg&media=http://hopetracker.com/site/public/images/quotes/quote.choosing_peace.jpg
/** base part of the pintrest shar... | [
"createLink(options) {\n 'use strict';\n\n let link;\n let counter;\n\n link = $.otp.contextPath;\n if (options === undefined || !options) {\n return link;\n }\n link = $.otp.addLinkComponent(link, options.controller);\n link = $.otp.addLinkComponent(link, options.action);\n link = $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds inline attachment data such as an image. | function addInline(payload, inline) {
return addAttachment(payload, inline, true);
} | [
"function addAttachment(payload, attachment, asInline = false) {\n if (asInline)\n payload.inline = [...utils_1.ensureArray(payload.inline), ...utils_1.ensureArray(attachment)];\n else\n payload.attachment = [...utils_1.ensureArray(payload.attachment), ...utils_1.ensureArray(atta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Created By: Tim Bechmann Date: 1042017 Purpose: Copies the passed dateLabel from D_CurrentStaffWorkAvailabilitiies into a temp page (SelectedDay) Params: dateLabel:?? | function CopyToTempPage(dateLabel) {
try {
/* IF on mobile device.*/
if (OnMobileApp()) {
/* Check to ensure an elementIndex was found */
var elementIndex = CB.indexInPageList("DateLabel", dateLabel, "D_CurrentStaffWorkAvailabilities.WorkAvailabilities");
if (ele... | [
"function copyDaySchedulePks() {\r\n $prev_day_clicked = $(\".fc-day-clicked\"); // Check if a date has been clicked\r\n if ($prev_day_clicked.length) {\r\n copyBtnActive = 'day';\r\n var date = $addScheduleDate.val();\r\n\r\n // Style copy buttons and tooltips\r\n $(\".copy-active\").remo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
//////////////////////////////FUNCIONES QUE TIENEN QUE VER CON LOS FORMATOS DE FECHA, YA SEA DE ARMADO DE FECHAS, O DE CAMBIO DE FORMATO A SQL O NORMAL | function fun_arma_fecha_sql(arg_dia,arg_mes,arg_anio){ //los numeros pueden venir en STRING o enteros
var _dia=parseFloat(arg_dia);
var _mes=parseFloat(arg_mes);
var _anio=parseFloat(arg_anio);
var fecha=_anio;
if(_mes<10){
fecha=fecha+"-0"+_mes;
}
else{
fecha=fecha+"-"+_mes;
}
if(_dia<10){
fecha... | [
"function formatDecimal(field,lunghezzaInteri,lunghezzaDecimali,visualizzaSeparatoreMigliaia)\n{\n\tvar obj;\n\n\tformatError=false;\n\n\tif (field.toString().indexOf(\"object\")>=0)\n\t\tobj=field.value; \n\telse \n\t\tobj=field+\"\";\n\t\n\tif (obj==\"\")\n\t\treturn;\n\n\tvar reSeparatoreMigliaia = /\\./g;\n\t\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a lookup Object from an Array, coercing each item to a String. | function lookup(arr) {
var obj = {}
for (var i = 0, l = arr.length; i < l; i++) {
obj[''+arr[i]] = true
}
return obj
} | [
"function createNamesArray(array) {\n const nameArray = [];\n array.map(item => nameArray.push(` ${item.item_name}`))\n return nameArray;\n}",
"function formatMatchedCountyIDsArray(array) {\n\n formatedMatchedCountyIds = [];\n\n for (var i = 0; i < array.length; i++) {\n var matc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Object that can be used to configure the drag items and drop lists within a module or a component. | function DragDropConfig() { } | [
"function ListEditor(parentControl) {\n this.parentControl = parentControl;\n this.$element = null;\n this.$activity = null;\n\n this.newItemEditor = new NewItemEditor(this);\n this.listView = new ListView(this);\n}",
"function dragItem(event){\n draggedItem = whereInLists(event.target);\n dragge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RenderFunction(f) renders the input funtion f on the canvas. | RenderFunction(f) {
var first = true;
var Canvas = this.refs.canvas;
const Ctx = this.refs.canvas.getContext('2d');
Ctx.beginPath() ;
for (var x = this.MinX; x <= this.MaxX; x += this.state.XSTEP) {
var y = f(x) ;
if(y >= this.MinY && y <= this.MaxY) {
console.log('Plo... | [
"onRender() {}",
"function render() {\n\t\t// Clear canvas\n\t\tctx.clearRect(0, 0, canvas.width, canvas.height);\n\n\t\tctx.imageSmoothingEnabled = false;\n\n\t\tctx.fillStyle = \"rgba(255,255,255,1)\";\n\t\tctx.fillRect(offset.x, offset.y, width * pixelSize, height * pixelSize);\n\t\tif (showTransparencyBackgro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funciones Muestra los autos | function mostrarAutos(autos) {
// Elimina los resultados previos del html
limpiarHTML();
// Itera en el arreglo autos contenido en el archivo db.js
autos.forEach(auto => {
// Crea un párrafo por marca
const autoHTML = document.createElement('p');
// Al declarar de est... | [
"function cargarDatosAModificar() {\n cargarDatosPersonales();\n cargarDatosDelPuesto();\n cargarFotoPerfil();\n cargarCV(); \n}",
"actualizarCuota () {\n this.interesMensual = this.interes / 1200;\n this.factorFunc();\n this.cuotaFunc();\n }",
"function treinarGrupo() {\n\n \n\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end commandLoader.js start purgeTooLong.js / Copyright (C) 2013 InstaSynch Copyright (C) 2013 Bibbytube This program 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 3 of the License, or (at your opt... | function loadPurgeTooLongCommand(){
commands.set('modCommands',"purgeTooLong ",purgeTooLong);
} | [
"function loadCommandLoader(){\r\n commands = new function() {\r\n var items = {};\r\n items.regularCommands = [\r\n \"'reload\",\r\n \"'resynch\",\r\n \"'toggleFilter\",\r\n \"'toggleAutosynch\",\r\n \"'mute\",\r\n \"'unmute\"\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reformat the address you get from autocomplete (removing spaces and comma). This new address is used for 'Get GPS Coordinates' request. before: "10924 Saint Laurent Boulevard, Montreal, QC, Canada" after: "10924+Saint+Laurent+Boulevard+Montreal+QC+Canada" | function reformatAddressForRequest(address) {
return address.split(" ").join("+").replace(/,/gi, "");
} | [
"function getShortAddress(address) {\r\n\tvar firstCommaPos = address.indexOf(\",\");\r\n\tvar lastCommaPos = address.lastIndexOf(\",\", address.length);\r\n\tif (lastCommaPos != firstCommaPos)\r\n\t\treturn address.substring(0, firstCommaPos);\r\n\telse\r\n\t\treturn \"\";\r\n}",
"static reverse({ lat, lon, form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the target element is of class "entry" e.g., a post | function isEntry(target)
{
return $(target).hasClass("entry");
} | [
"function isExpandedView(entryTarget)\n{\n return $(entryTarget).parent().hasClass(\"cards\");\n}",
"inDOM() {\n\t\t\treturn $(Utils.storyElement).find(this.dom).length > 0;\n\t\t}",
"function isListView(entryTarget)\n{\n return $(entryTarget).parent().hasClass(\"list\");\n}",
"function hasSomeParentThe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After Clicking submit button, sends response variable to result_validation.php | function result_val() {
console.log(response);
console.log(questions);
test_live = false;
$("#staticBackdrop").modal("hide");
$("#processing").show();
$(".heading-hide").show();
$("#nav").hide();
$("#container_question").hide();
$("#response_result... | [
"function validateForm() {\n var emailInput = document.getElementById('email');\n var submitButton = document.getElementById('button-submit');\n var email = emailInput.value;\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes all lights from the scene | function removeAllLights(){
scene.remove(ambientLight);
scene.remove(directionalLight);
scene.remove(pointLight);
} | [
"function clearScene() {\n var obj;\n for( var i = scene.children.length - 1; i > 3; i--) {\n obj = scene.children[i];\n scene.remove(obj);\n }\n}",
"clearScenes() {\n for (let iScene = 0; iScene < this.scenes.length; ++iScene) {\n let scene = this.scenes[iScene];\n scene.tra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine the value of `ariacurrent`. Return 'page' if this item is an activated anchor tag. Otherwise, return `null`. This method is safe to use with serverside rendering. | _getAriaCurrent() {
return this._hostElement.nodeName === 'A' && this._activated ? 'page' : null;
} | [
"function getActivePage() {\n\t\treturn document.querySelector('li[data-active-page=\"true\"]');\n\t}",
"onCurrent(element) {\n\t\tvar slide = _.getSlide(element);\n\n\t\tif (slide) {\n\t\t\treturn \"#\" + slide.id === location.hash;\n\t\t}\n\n\t\treturn false;\n\t}",
"function getPageState() {\n ens... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A definition of a code system, inlined into the value set (as a packaging convenience). Note that the inline code system may be used from other value sets by referring to its (codeSystem.system) directly. | get codeSystem() {
return this.__codeSystem;
} | [
"function System()\n {\n function Box(w,h)\n {\n this.h = h;\n this.w = w;\n };\n this.box = new Box(1000,600); //Should be defined;\n this.set = new Array();\n this.push = function(body)\n {\n this.set.push(body);\n }\n this.pop = function()\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function parses all the workperiod shift rows into proper model format for controller | function parseWorkPeriodFields() {
var workperiods = [];
$('.shift-row-item').each(function (k) {
var workperiod = { "StartTime": $('#StartTime-' + k).val(), "EndTime": $('#EndTime-' + k).val(), "IsDayOff": ($('#IsDayOff-' + k).is(':checked')) ? true : false }
workperiods.push(workperiod);
}... | [
"function transformToSchedule(data){\n let daySessions = []\n let presentations = getPresentations(data)\n let sessions = getSessions(presentations)\n\n for (let i = 0; i < confLength; i++ ){\n daySessions.push(\n sessions.filter( \n d => d[0].session_id.substring(0,2) == confDayStart + i\n ))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The standard JavaScript `filter()` method, which passes each row to the callback function and returns all rows for which the it returns true. | filter(callback, thisArg) {
return this.rows.filter(callback, thisArg)
} | [
"function myFilter(array, callback) {\n return callback(array);\n}",
"function filter(arr, callback){\n var newArr = [];\n for (let i=0; i<arr.length; i++){\n if (callback(arr[i])) newArr.push(arr[i]);\n }\n return newArr;\n}",
"function FILTER(range) {\n for (var _len7 = arguments.length, filters = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The AWS::Batch::ComputeEnvironment resource to define your AWS Batch compute environment. For more information, see Compute Environments in the AWS Batch User Guide. Documentation: | function ComputeEnvironment(props) {
return __assign({ Type: 'AWS::Batch::ComputeEnvironment' }, props);
} | [
"function Environment(props) {\n return __assign({ Type: 'AWS::ElasticBeanstalk::Environment' }, props);\n }",
"get environment() {\n if (this._enviornment)\n return Promise.resolve(this._enviornment);\n return fs.readFile(this.environmentPath).then((file) => __awaiter(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the private discussions for this user | function loadDiscussions() {
console.log("loadDiscussions() started");
showMessage("Loading private discussions for '" + user.name + "' ...");
user.privateDiscussions.get({
limit : 1000
}).execute(function(response) {
console.log("loadDiscussions() response = " + JSON.stringify(response));
var html ... | [
"async function loadPublicMemes() {\n const response = await fetch(url + '/api/memes/filter=public');\n if (response.ok) {\n const pubmemes = await response.json();\n return pubmemes.map(m => new Meme(m.id, m.title, url + m.url, m.sentence1, m.sentence2, \n m.sentence3, m.cssSentences... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does validate an email address return True and displays Wanrning if the email address is invalid; if the email address is valid, not change the value of errorFlag, just return the value of errorFlag was passed. | function emailAddressIsInvalid(errorFlag)
{
// Validate Email Addess
// http://emailregex.com
let regexEmail = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i);
let emailAddress = document.getEleme... | [
"function email_check() {\r\n email_warn(email_validate());\r\n final_validate();\r\n}",
"function validateEmail()\n{\n//variable email is set by element id contactEmail from the form\n\tvar email = document.getElementById(\"contactEmail\").value; \n\t\n\t//validation for email\n\tif(email.length == 0)\n\t{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return renewing cost Arguments: int referrals int accountType | function renewingCost(referrals,accountType)
{
if(referrals <= 250)
{
return 0.20;
}else if(referrals <= 500)
{
if(accountType < 5 || accountType == 6)
{
return 0.21;
}else{
return 0.20;
}
}else if(referrals <= 750)
{
... | [
"function payResources() {\n var i, listResources = Variable.findByName(gm, 'resources'),\n budgetDescriptor = Variable.findByName(gm, 'budget'),\n budgetInstance = budgetDescriptor.getInstance(self),\n resourceDescriptor, resourceInstance,\n sumSalary = 0;\n for (i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ GETTERS / SETTERS / Finds the parent quiz of the question. | function findParentQuiz(quizId) {
return models.Quiz
.findOne({
where: {
id: quizId
}
});
} | [
"get parentId() {\n return this.getStringAttribute('parent_id');\n }",
"getQuizId() {\n return this._quizId;\n }",
"get parent() {\n return new Path(this.parentPath);\n }",
"get parentItem()\n\t{\n\t\t//dump(\"get parentItem: title:\"+this.title);\n\t\tif ((!this._parentItem) && (!this._newP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate input fields for tasks dynamically We create a long string of the data and then append it in one go as appends are expensive. | function generateTasks(){
$('.task').remove(); //remove previous fields
var numTasks = $('input[name=numTasks]').val(); //number of tasks entered
var taskFields = [];
//add numTasks extra input fields
for(var i = 1; i <= numTasks; i++){
taskFields[i-1] =
[
"<label class='task'>Task " + i + ": <br>",
... | [
"function createTechnicalTask() {\n var tasks, technicalTask, operations, requestsForDevelopers, operation, devRequest, tableRow;\n\n tasks = $(\"#tasks\");\n operations = [];\n technicalTask = {\n name: $(\"#technicalTaskName\").val(),\n description: $(\"#technicalTaskDescription\").val()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |