query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
This will convert the passed tokens into a priority queue of atomic operations. It will then iterate through the operations and resolve them 1 at a time, pushing them to the instruction queue that gets returned until there is only 1 token left to resolve. This method does not push the instructions, but calls methods th... | function order_assign_statement(passedTokens){
let instrQueue = createInstrQueue(passedTokens);
stepThroughRawInstr(instrQueue);
instrQueue = []; //for added measure, there should only be 1 token in the queue but it never hurts to empty it at conclusion
} | [
"function orderTokens(tokens) {\n const operators = [];\n const operands = [];\n let nOperators = 0;\n for (let i = 0; i < tokens.length; i++) {\n const t = tokens[i];\n if (t.type === \"num\" /* Number */ ) {\n operands.push(t);\n } else {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts the new control above the existing control. | function insertAtTop(newControl, dropControl, dropControlIsField) {
insertControl(newControl, containers.vertical, true, dropControl, dropControlIsField);
return true;
} | [
"function insertAbove() {\n\n\t\t// Hide the toolbar\n\t\thideToolbar();\n\n\t\t// Insert the row above and select the placeholder above the selected element\n\t\tinsertRow(currentElement, true, $(currentElement).column());\n\t}",
"function insertBelow() {\n\n\t\t// Hide the toolbar\n\t\thideToolbar();\n\n\t\t// ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getPlaceData takes the newQueryURL created by the getQueryURL fn. the callback fn pulls the data needed to create the heatmap from the response object and pushes dataPoint objects to an array that is used to generate the heatmap points. The reviews numbers are pushed to a seperate array that will be used to set the rad... | function getPlaceData() {
$.ajax({
url: newQueryURL,
method: "GET",
}).then(function (response) {
let places = response.results;
// console.log(places)
// console.log(restaurantArray);
let sortedRestaurantArray = places.sort(function (a, b) {
if (a.rat... | [
"function getJsonOfReviewsAndPhotos(placeid, callback) {\n console.log(\">>>>>>>>>>>>>>>>>>>>>>getJsonOfReviewsAndPhotos : \"+placeid+\">>>>>>>>>>>>>\");\n getPlaceDetailByPlaceid(placeid, function(ret) {\n var imageArray = [];\n \n // Retrieve photo urls.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalize transaction names using `Router.match` | function normalizeTransactionName(
appRoutes,
location,
match,
callback,
) {
let name = location.pathname;
match(
{
location,
routes: appRoutes,
},
(error, _redirectLocation, renderProps) => {
if (error || !renderProps) {
return callback(name);
}
const rout... | [
"function normalizeTransactionName(appRoutes, location, match, callback) {\n var name = location.pathname;\n match({\n location: location,\n routes: appRoutes\n }, function (error, _redirectLocation, renderProps) {\n if (error || !renderProps) {\n return callback(name);\n }\n\n var routePath ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether upload of Firefox Health Report data is enabled. | get healthReportUploadEnabled() {
return !!this._healthReportPrefs.get("uploadEnabled", true);
} | [
"set healthReportUploadEnabled(value) {\n this._healthReportPrefs.set(\"uploadEnabled\", !!value);\n }",
"get healthReportUploadLocked() {\n return this._healthReportPrefs.locked(\"uploadEnabled\");\n }",
"function isMedicalReport() {\n if (sessionStorage.getItem(\"reporttype\") == \"Medical Report\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stretch title row and remove "Recent Visitors by Visit Details" | function modify_title_space(){
//stretch title row
title_tr = main_t.getElementsByTagName("tr")[0];
title_td = title_tr.getElementsByTagName("td")[0];
title_td.setAttribute("colspan", "7");
//remove "Recent Visitors by Visit Details" so there is more vertical space
title_td.childNodes[2].style.display =... | [
"function showFillerTitle() {\n g.selectAll(\".openvis-title\")\n .transition()\n .duration(0)\n .attr(\"opacity\", 0);\n\n g.selectAll(\".square\")\n .transition()\n .duration(0)\n .attr(\"opacity\", 0);\n\n g.selectAll(\".count-title\")\n .transition()\n .duration(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Center popup in middle of window relative to window size | function centerPopup(popup){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = jQuery("#" + popup).height();
var popupWidth = jQuery("#" + popup).width();
jQuery("#" + popup).css({ //Look at adjusting popup positi... | [
"function centerPopup()\n {\n var $popup = $el.popups.filter(\":visible\").first();\n var offset = {};\n offset.left = ($window.width() / 2) - ($popup.width() / 2);\n offset.top = ($window.height() / 2) - ($popup.height() / 2);\n $popup.offset(offset);\n }",
"function cen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get fully resolved platformspecific file path from the given URL string/ object | function fileURLToPath$1(path) {
if (typeof path === "string") path = new URL(path);
else if (!(path instanceof URL)) {
throw new Deno.errors.InvalidData(
"invalid argument path , must be a string or URL",
);
}
if (path.protocol !== "file:") {
throw new Deno.errors.InvalidData("invalid url sch... | [
"convert_file_uri_to_path (url) {\n let returnString = url.split('file:///').join('');\n const is_win = /^win/.test(process.platform);\n //Need to add extra slash if windows\n if (!is_win) {\n returnString = '/' + returnString;\n }\n //disk letter on upper case f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update block scope and state | function updateBlock(block, index) {
blocks[index] = block;
if (block.new) { updateNewBlock(block); } // configure template for new blocks
if (!block.new && (block.scope.$index === index && block.scope[repeatName] === items[index])) {
updateState(block.scope, index); // update state ... | [
"enterBlock() {\n this.scope = new BlockScope(this.scope);\n }",
"function enterBlock(){\n blockContext = Object.create(blockContext)\n }",
"requestBlocksUpdate () {\n this.emit(Runtime.BLOCKS_NEED_UPDATE);\n }",
"requestBlocksUpdate() {\n this.emit(Runtime.BLOCKS_NEED_UPDATE);\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides: flow_ecma_string_of_float const Requires: caml_js_from_float, caml_new_string | function flow_ecma_string_of_float(num) {
return caml_new_string(caml_js_from_float(num).toString());
} | [
"function caml_js_from_float(x) { return x; }",
"function caml_float_of_string(s) {\n var res;\n s = caml_jsbytes_of_string (s);\n res = +s;\n if ((s.length > 0) && (res === res)) return res;\n s = s.replace(/_/g,\"\");\n res = +s;\n if (((s.length > 0) && (res === res)) || /^[+-]?nan$/i.test(s)) return re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a single dot at pointion (x, y) with radius r | function drawDot(x, y, r) {
ctx.beginPath();
ctx.arc(x, y, r, 0, 2 * Math.PI);
ctx.fillStyle = "white";
ctx.fill();
} | [
"function dot (ctx, x, y, color, radius) {\n ctx.fillStyle = color\n ctx.beginPath()\n ctx.arc(x, y, radius, 0, PIPI)\n ctx.fill()\n}",
"function drawDot(pt, r) {\n svg.append(\"circle\")\n .attr(\"class\", \"dot\")\n .attr(\"cx\", pt[0])\n .attr(\"cy\", pt[1])\n .attr(\"r\", r);\n}",
"drawDo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes underscores from server property names Remembers them in a private dictionary so it can restore them when translating from client name to server name Warning: use only with metadata loaded directly from server | function NoUnderscoreConvention() {
var _underscoredNames = {}; // hash of every translated server name
return new NamingConvention({
name: 'noUnderscore',
clientPropertyNameToServer: clientPropertyNameToServer,
serverPropertyNameToClient: serverPropertyNameToClient
});
function cli... | [
"function UnderscoreNamingConvention() {\n return new breeze.NamingConvention({\n serverPropertyNameToClient:\n function (serverPropertyName) {\n return '_' + serverPropertyName;\n },\n clientPropertyNameToServer:\n function (clientPropertyName) {\n return clientP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method displays records page by page | displayRecordPerPage(page) {
/*let's say for 2nd page, it will be => "Displaying 6 to 10 of 23 records. Page 2 of 5"
page = 2; pageSize = 5; startingRecord = 5, endingRecord = 10
so, slice(5,10) will give 5th to 9th records.
*/
this.startingRecord = (page - 1) * this.pageSize;
... | [
"displayRecordByPage() {\n this.showSpinner = true;\n this.startingRecord = (this.currentPage - 1) * this.pageSize;\n this.endingRecord = this.pageSize * this.currentPage;\n\n this.endingRecord =\n this.endingRecord > this.totalRecountCount\n ? this.totalRecountCount\n : this.endingRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save a new execution at axecution index | async save(recipe, hits, firedAction, result) {
console.log(`Butler => Saving process result for recipe [${recipe.application}] [${recipe.name}]`);
let execution = {
recipe: recipe,
hits: hits,
firedAction: firedAction,
result: result,
created... | [
"async saveCurentIndex(newStep, filename) {\n\n this.check()\n await this.storage.saveIndex(newStep, filename)\n }",
"async function addExecution({ blockNumber = 91, txIndex = 0, execution } = {}) {\n const tx = await txsDAL.create({\n blockNumber: blockNumber,\n version: 0,\n index: txIndex,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the length of the given path, in meters, on Earth. | function computeLength(path) {
path = common.convertToPositionArray(path);
if (path.length < 2) {
return 0;
}
var length = 0;
var prev = path[0];
var prevLat = toRadians(prev.lat);
var prevLng = toRadians(prev.lng);
path.forEach(function (point) {
var lat = toRadians(point.lat);
var lng = to... | [
"getLength(){\n return Math.round(google.maps.geometry.spherical.computeLength(this.getLocations()));\n }",
"GetPathLength(path) {\n let path_distance = 0;\n for (let j = 0; j < path.length - 1; j++) {\n let edge_start = path[j];\n let edge_end = path[j + 1];\n path_distance += this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var editing=0; Init default credentials | function default_credentials() {
editing = 0;
tdediting = 0;
editingtrid = 0;
editingtdcol = 0;
ready_save = 0;
} | [
"function Window_LoginEdit() {\n\t\ttry {\n\t\t\tthis.initialize.apply(this, arguments);\n\t\t} catch(e) {\n\t\t\tconsole.error(\"[CBAM] \"+e.stack);\n\t\t\talert(\"[CBAM] \"+e.name+\": \"+e.message);\n\t\t};\t\t\n\t}",
"function initializeSettingForEdit()\n{\n\t// validations \n\tvalidateFormEditUser() ;\n\t\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
viewport reference : image load based on viewport | function viewportThumbLoading() {
$('.item:in-viewport').each(function () {
var _this = $(this),
_leftImage = _this.find('img.img-left'),
_rightImage = _this.find('img.img-right');
_leftImage.attr('src', _leftImage.attr('data-original'));
_rightImage.a... | [
"function loadImageInView(){\n if(isAnyPartOfElementInViewport(elem[0])){\n var downloadingImage = new Image();\n console.log(\"image\")\n downloadingImage.src = scope.lpcLazyBackground;\n downloadingImage.onload = function() {\n //remove temporary loading class\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the url to which the request should be made. This function takes the userFilters object as input and returns the URL string | function buildRequestURL(userFilters, endPoint){
let baseURL = "https://api.sendgrid.com/v3";
// Append enpoint and limit to baseURL
let URL = baseURL + endPoint + '?limit=' + userFilters.limit;
// If there are any filters besides from the limit, build a query string which we then append to the url
if(Obj... | [
"buildUrl(){\n var url = \"\";\n \n var filter = \"\"\n \n // If there aren't any filters or terms for searching, use default url\n // that displays data in ascending order\n if(filter === \"\"){\n url = POLIURL + '?q={'\n + '\"}]}&page='\n + this.state.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function returns the device_id of the requested device name, if not exists then it is created a new register with the device name and not hide as only filled fields input: remoteAddress used only for logs | function request_device_id(devicename, remoteAddress){
return new Promise( (resolve,reject) => {
"use strict";
if(devicename==undefined){
reject("devicename is undefined");
}else{
var currentdate = dateFormat(new Date(), "yyyy-mm-dd'T'HH:MM:ss.l");
var result_count = DeviceModule.query_count_device(es_s... | [
"function _getSetDeviceIdentifier(){\n\n let deviceId = _getVadrDeviceFromCookie();\n\n if (!deviceId)\n deviceId = _setVadrDeviceCookie();\n\n deviceInfo['deviceId'] = deviceId;\n\n}",
"checkDeviceId() {\n if (NSystemService.getInstance().checkDevice() === 'browser') {\n this._d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pseudo Code input string a, b (assuming case insensitive) 1. if lengths of a & b differ greater than 1: return false 2. create map = HashMap (key>val, char>freq) 3. Insert the longer string into map for each char in longStr: map.has(char) ? map.put(char, map.get(char) + 1) : map.put(char, 1); 4. Remove shortStr chars f... | function oneAwayMap(a, b) {
if (Math.abs(a.length - b.length) > 1) {
return false;
}
let short = a.length >= b.length ? a : b;
let long = short === a ? b : a;
const map = new Map();
for (const i in long) {
const char = long[i];
map.has(char) ? map.set(char, map.get(char) + 1) : ... | [
"function s(a, b) {\n const map = b\n .split(\"\")\n .reduce((acc, val) => ({ ...acc, [val]: acc[val] + 1 || 1 }), {});\n\n // ALL windows\n // function compare(a) {\n // const mapA = a\n // .split(\"\")\n // .reduce((acc, val) => ({ ...acc, [val]: acc[val] + 1 || 1 }), {});\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if this is a new day | function isNewDay() {
var lastCheckedDate = Properties_.getProperty(PROPERTY_EVENTS_CHECKED)
Logger.log('lastCheckedDate: ' + lastCheckedDate)
var today = (new Date()).toDateString()
Properties_.setProperty(PROPERTY_EVENTS_CHECKED, today)
Logger.log('today: ' + today)
var newDay = (lastCheckedD... | [
"function isNewDay(){\n return (numDaysSinceUTC() - today >= 1);\n}",
"checkNewDay() {\n if (!this.day) {\n this.day = this.getDate();\n } else {\n if (this.day !== this.getDate()) {\n this.goNextDay();\n this.day = this.getDate();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Middleware to get all device types | function getAllDeviceTypes(req, res, next){
utils.dbHandler(req, res, next, function(){
return dbDevice.getAllDeviceTypes();
});
} | [
"function getCameraTypes(req, res, next) {\n dataBase.any('SELECT * FROM \"CAMERA_TYPE\"')\n .then(function (data) {\n res.status(200)\n .json({\n status: 'success',\n data: data,\n message: 'Retrieved all products'\n });\n })\n .catch(function (err) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function when the ServerSynch button is pressed | function OnBtnServerSynch()
{
try
{
if( Titanium.Network.networkType === Titanium.Network.NETWORK_NONE )
{
alert( L( 'generic_no_network_msg' ) ) ;
}
else
{
BeginAsyncBusyAction( $.activity_indicator , controls , function()
{... | [
"function OnBtnServerSynch_Click( e )\n{\n OnBtnServerSynch() ;\n}",
"function OnBtnServerSynch_Click( e )\r\n{\r\n OnBtnServerSynch() ;\r\n}",
"function OnBtnServerSynch()\n{\n try\n {\n if( Titanium.Network.networkType === Titanium.Network.NETWORK_NONE )\n {\n alert( L( 'g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the normals for the vertices | function generateNormals(vertices) {
vertexNormals = [];
var p = 0;
var t1, t2, t3, norm;
for (var i = 0; i < numCurves; i++)
{
for (var t = 0; t < steps; t++) {
var savedP = p;
for (var a = 0; a < angles; a++) {
t1 = vertices[p];
... | [
"_calculateNormals() {\n const coords = this._coords;\n const edges = this._edges;\n const normals = this._normals;\n const count = coords.length;\n\n for (let ix = 0, iy = 1; ix < count; ix += 2, iy += 2) {\n const next = ix + 2 < count ? ix + 2 : 0;\n const x = coords[next] - coords[ix];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WEAPON TYPES : 1:basic 2:sp 3:beam WEAPON OBJ | function Weapon(name, type){
this.name = name;
this.type = type;
} | [
"function weapon(type){\n\tthis.type = type;\n\tthis.weapons = [];\n\tthis.weapons = this.setWeapon()\n}",
"function getType() : WeaponType {\n\t\treturn phaser.GetComponent(weaponScript).type;\n\t}",
"function Weapon(name, minDamage, maxDamage, criticalHit) {\n this.name = name;\n this.minDamage = minDamage;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take appointment and recup date from API | function reservation() {
API.makeAppoint(catId).then(data => {
getDatasDate(appointmentDate = getDate(data.appointment))
getHourDate(appointmentHour = getHour(data.appointment))
togglePopup(!showPopup);
})
.catch(error => { console.log(error)})
} | [
"function processAppointments() {\n $scope.myAppts = myAppointments.data.results;\n }",
"function listAppointments() {\n client.request\n .get(\n \"https://<%=iparam.freshsales_subdomain%>.freshsales.io/api/appointments?filter=upcoming\",\n options\n )\n .then(function (data) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The cameras scroll speed (in pixels). | get scrollSpeed() {
return this._scrollSpeed;
} | [
"_getScrollSpeed() {\n const lineHeight = this._context.configuration.options.get(64 /* EditorOption.lineHeight */);\n const viewportInLines = this._context.configuration.options.get(139 /* EditorOption.layoutInfo */).height / lineHeight;\n const outsideDistanceInLines = this._position.outsideD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creating a style function for Dist polygons in the map based on the agency number | function myStyleDistPoly(feature) {
switch (feature.properties.agency) {
case 0:
return {
color: "#fdfe00",
fillColor: "#fdfe00"
};
break;
case 1:
return {
color: "#54ff01",
fillColor: "#5... | [
"function myStyleDistPolyEdit(feature) {\n switch (feature.properties.agency) {\n case 0:\n return {\n color: \"#fdfe00\"\n };\n break;\n case 1:\n return {\n color: \"#54ff01\"\n };\n break;\n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function index 16 query to update the last name for an existing employee | updateEmployeeLastName(adr) {
const query = `
UPDATE employee
SET ?
WHERE ?;
`;
const post = [
{
last_name: adr[1],
},
{
id: adr[0],
},
];
return this.connection.query(query, post);
} | [
"updateEmployeeFirstName(adr) {\n\t\tconst query = `\n\t\tUPDATE employee\n\t\tSET ?\n\t\tWHERE ?;\n\t\t`;\n\t\tconst post = [\n\t\t\t{\n\t\t\t\tfirst_name: adr[1],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: adr[0],\n\t\t\t},\n\t\t];\n\t\treturn this.connection.query(query, post);\n\t}",
"function updateEmployee(req, res) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates candidate data object containing element, name, party, segment, id (candidate number), district, age, education, url, xCoordinate, yCoordinate | function defineCandidate(d, givenElement){
candidate = {element: givenElement,
name: d.name,
party: d.party,
segment: d.segment,
district: d.district,
age: d.age,
education: d.education,
url: d.www,
xCoordinate: +getXValue(d),
yCoordinate: +getYValue(d)};
return candidate;
} | [
"function CandidateData(data) {\n this.avatar = data.avatar;\n this.birthday = convertDate(data.birthday);\n this.education = data.education;\n this.email = data.email;\n this.id = data.id;\n this.name = data.name;\n }",
"function createCandidates() {\n /* TODO: sort ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
react on the "buttonGetCountPeople" | function buttonGetCountPeople(event){
//read variables from the event
let ev = JSON.parse(event.data);
let evData = ev.data; // the data from the argon event: "removePerson"
let evDeviceId = ev.coreid; // the device id
let evTimestamp = Date.parse(ev.published_at); // the timestamp of the event
... | [
"function LikedClicked() {\n noOfpeople++;\n likeLabel.innerHTML = noOfpeople + ' people like this!';\n}",
"function updatePersonCountLabel()\r\n{\r\n\tvar count = $('#personTableBody').children(':visible').length;\r\n\t\r\n\t$('#lbl_person_count').text(count+\" Personen\");\r\n\r\n}",
"function getPeopleCoun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
another way to find whole number | function testWholeNumber(number) {
let result = (number - Math.floor(number)) !== 0;
result ? console.log("Decimal Number") : console.log("Whole Number Found")
} | [
"function number_test(n) {\n var result = (n - Math.floor(n)) !== 0; \n \n if (result)\n return 'decimal';\n else\n return 'whole';\n}",
"function wholeNumberify(num) {\n if (Math.abs(Math.round(num) - num) < EPSILON_HIGH) {\n num = Math.round(num);\n }\n return num;\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return skill of pokemon URL | function findPokemonSkill(url) {
var request = $http({
method: "GET",
url: url,
});
return( request.then( handleSuccess, handleError ) );
} | [
"function readUrl() {\n\n let baseSkills = '';\n\n // For version with \"|\" as a splitter\n if (window.location.search.slice(3).indexOf('|') >= 0) {\n baseSkills = window.location.search.slice(3).split('|');\n }\n\n // For new version with \"x\" as a splitter\n if (window.location.search.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UTILITY METHODS Returns whether or not a value for a particular element exists. | valueExists(element) {
if(element !== undefined && element !== null && element !== '') {
return true;
} else {
return false;
}
} | [
"valueExists(element) {\n if(element !== undefined && element !== null && element !== '' && element !== ' ') {\n return true;\n } else {\n return false;\n }\n }",
"get elementExists() {\n\t\treturn !(this.element === null)\n\t}",
"function elementExists(domfld) {\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Margin applied to the left of the plot area. | get plotAreaMarginLeft() {
return this.i.oe;
} | [
"get plotAreaMarginRight() {\n return this.i.of;\n }",
"set margin(value) {}",
"function setLeftMargin(x, y) {\n return {\n type: 'setLeftMargin',\n x: x,\n y: y,\n };\n}",
"function adjustChartMarginForAxis(_super, c) {\n switch( c.orient ) {\n case 'left':\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
options shuffle, loopPuzzles, source | constructor(options = {}) {
this.i = 0
this.current = {}
this.puzzles = []
this.started = false
this.shuffle = options.shuffle
this.loopPuzzles = options.loopPuzzles
this.fetchPuzzles(options.source)
this.listenToEvents()
} | [
"static shuffle() {\n shuffleWords(words);\n shuffleWords(globalPool);\n }",
"provideHint(){\n \n let winningNum = this.winningNumber;\n let alt1 = generateWinningNumber();\n let alt2 = generateWinningNumber();\n let numsArray = [winningNum, alt1, alt2];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Now start the credits loop! CREDITS LOOP ===================================================================================================== | function credits_loop() {
do_fade();
draw_backDrop();
draw_scroller();
endScreenTimer--; // Countdown the timer.
if (endScreenTimer==0) end(); // If it gets to zero, end the credits!
else if (creditsLoopOn) requestAnimFrame( credits_loop ); // ... otherwise if th... | [
"function loadCredits(){\n\t\tpgame.state.start('credits');\n\t}",
"loop(){\n\t\tif( this.credit>= 1){\n\t\t\t// consume an entire credit\n\t\t\t--this.credit\n\t\t\t// perform our event\n\t\t\tif( this.outputPause){\n\t\t\t\tthis.outputPause()\n\t\t\t}\n\t\t}else{\n\t\t\t// all other conditions reset\n\t\t\tthis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute each time the "Edit feature" action is clicked | function editThis() {
// If the EditorViewModel's activeWorkflow is null, make the popup not visible
if (!editor.viewModel.activeWorkFlow) {
view.popup.visible = false;
// Call the Editor update feature edit workflow
editor.startUpdateWorkflowAtFeatureE... | [
"function editScenario() {\r\n\tmakeSliderDisplay();\r\n\t$(\"#actions-view\").hide();\r\n\t$(\"#actions-edit\").show();\r\n}",
"function editSelected(){\n // todo \n }",
"function editThis() {\n // If the EditorViewModel's activeWorkflow is null, make the popup not visible\n if (!editor.viewModel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End Monthly // Start Yearly // Checks if an item exists in the yearlyData obj, creates one if not and increments values within existing obj if it exists. (This function requires items to be inserted in order for binary search to be effective) | function buildYearlyForEach(item) {
const identityString = convertToFirstOfQuarter(moment(item.time));
const dataObj = binarySearchHelper(yearlyData, moment(identityString), cmpDay);
if (!dataObj) {
const itemCpy = JSON.parse(JSON.stringify(item));
itemCpy.time = identityString;
yearlyData.push(itemC... | [
"function ensure_allYears(data) {\n\n var min_year = 2008;\n var max_year = 2017;\n\n var country = data[0].Country;\n var forum = data[0][\"Forum classification\"];\n var income = data[0][\"Income group\"];\n var region = data[0][\"Region\"];\n\n var country_years = [];\n\n var new_objects ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
front() returns the front (tail) value without removing it | front() {
if (this.head == null) {
return null;
}
return this.tail.value
} | [
"front() {\n if (this.head) {\n return this.head.val\n } else {\n return null;\n }\n }",
"front() {\n \tif(this.head){\n return this.head.value;\n }\n return null;\n }",
"front(){\n if(this.head == null){\n return nul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A handler is valid if it handles the current event type and is either a global handler, or the current context is valid for a nonglobal handler | function validateHandler (h) {
return h.eventType === e.type && (h.isGlobal || isValidContext());
} | [
"getAnyHandler(handler) {\n if (this.anyHandlers.has(handler)) {\n return this.anyHandlers.get(handler);\n }\n const eventHandler = this.getReferenceListener(handler);\n this.anyHandlers.set(handler, eventHandler);\n return eventHandler;\n }",
"_isHandlerClass(hand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter for customers with first or last name starting with filter text | function filteredCustomers(){
var text = vm.customerFilterText.toLowerCase();
customerState.customerFilterText = text;
return text === '' ?
vm.customers :
vm.customers.filter(function (c){
return c.firstName.toLowerCase().indexOf(te... | [
"function partialSearch(data, input) {\n input = input.toLowerCase()\n dataBase = data.filter((user) => { \n let fName = user.first_name.toLowerCase().indexOf(input);\n let lName = user.last_name.toLowerCase().indexOf(input);\n return fName != -1 || lName != -1\n })\n fillData(dataB... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Which link SHOULD we be showing right now? Return 1 if none. If we should be showing several, returns the first one. | function currentLink(t, vidnumber) {
var linkNumber = -1;
for (var i = 0; i < linkTimer[vidnumber].length; i++) {
if (
t >= linkTimer[vidnumber][i].time &&
t < linkTimer[vidnumber][i].time + hxLinkOptions.hideLinkAfter
) {
linkNumber = i;
break;
}
}
ret... | [
"function currentLinkShown(vidnumber) {\n var linkNumber = -1;\n\n for (var i = 0; i < linkTimer[vidnumber].length; i++) {\n if (linkTimer[vidnumber][i].shown) {\n linkNumber = i;\n break;\n }\n }\n return linkNumber;\n }",
"function getActivePage() {\n const ul = document.q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes an entire plain text response to our socket. We ask for a headers object and convert it to a raw headers array. | function writeResponse(
statusCode,
rawHeaders = [],
bodyText = http.STATUS_CODES[statusCode],
) {
// Write the head to our socket...
writeHead(statusCode, [
"Connection",
"close",
"Content-Type",
"text/html",
"Content-Length",
Buffer.byteLength(bodyText),
... | [
"function _synReply(socket, statusCode, info, headers, eHandle) {\n try {\n var status = 'HTTP/1.1 ' + statusCode + ' ' + info + '\\r\\n';\n var headerLines = '';\n for (var index in headers) {\n headerLines += index + ': ' + headers[index] + '\\r\\n'; //append all the headers to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split a key value pair. | function splitKeyValuePair(str) {
var index = str.indexOf('=');
var key;
var val;
if (index === -1) {
key = str;
} else {
key = str.substr(0, index);
val = str.substr(index + 1);
}
return [key, val];
} | [
"function splitKeyValuePair(str){var index=str.indexOf('=');var key;var val;if(index===-1){key=str;}else{key=str.substr(0,index);val=str.substr(index+1);}return[key,val];}",
"function splitKeyValuePair(str) {\n\t var index = str.indexOf('=');\n\t var key;\n\t var val;\n\t\n\t if (index === -1) {\n\t key = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funzione che fa apparire la chat e imposta la foto profilo e il nome dell'utente con cui si sta chattando | function showChat(pathFotoProfilo, nomeUtente){
//Div che contiene la chat (inizialmente non visibile)
document.getElementById("divChatBackground").style.display = "block";
//Settaggio dell'immagine profilo
if(pathFotoProfilo != "default"){ //Se l'immagine è quella di default, l'url è già nel CSS
var pat... | [
"function TurnOfChat()\n\t{\n\t\tvar index = 0, user_name = \"\", id_user = \"\";\n\n if(Information_user('truefalse'))\n {\n //lay ten nguoi dung \n user_name = Information_user('name')\n\t\t id_user = Information_user('id') // lay id nguoi dung\n\t\t var r = confirm(\"Bạn chắc chắn tắt c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stores the user's location in a cookie. | function storeMyLocation(latitude, longitude) {
writeCookie('latitude', latitude);
writeCookie('longitude', longitude);
} | [
"function setLocation(location) {\n localStorage.setItem('location', location);\n}",
"function setGeoLocation() {\n\n var location = request.httpParameterMap.location.value;\n if (location.submitted) {\n\n var cookieName = Site.current.getCustomPreferenceValue('storeLocatorCookieName');\n\n\t i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
October 10, 2017 SList: Has Loop (pg. 98[version 1.1.1]) | function hasloop(SList){
let slowRunner = this.head
let fastRunner = this.head
while(fastRunner){
if(!fastRunner.next || !fastRunner.next.next){
return false
}
slowRunner = slowRunner.next
fastRunner = fastRunner.next.next
if(slowRunner === fastRunner){
... | [
"for_each_list(onforeach, node) {\n\n let cur_node = this.list_head;\n let head_node = this.list_head;\n\n if (node instanceof list_node) { //used more time\n cur_node = node;\n }\n \n do {\n let result = onforeach(cur_node);\n if (result == true) {\n break;\n }\n cur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get the next patientId from patients table | function getnextPatientId(patientId, pgPatientList) {
var patId;
$j(pgPatientList.patient).each(function (index, rowpatient) {
if(patientId==rowpatient.id) {
var arrayLength=(pgPatientList.patient).length;
var comp=arrayLength-1;
if(index==comp){
patId = patientId;
}else{
patId=pgPatien... | [
"function getnextCaseId(caseID, pgpatientList) {\r\n\tvar patId;\r\n\t$j(pgpatientList.caseList).each(function (index, rowpatient) {\r\n\t\tif(caseID==rowpatient.id)\t{\r\n\t\t\tvar arrayLength=(pgpatientList.caseList).length;\r\n\t\t\tvar comp=arrayLength-1;\r\n\t\t\tif(index==comp){\r\n\t\t\t\tpatId = caseID;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
process text request. This request is sent when the client is sending a text message the user entered in the chat. | function processText(query,res) {
// prepare the object to be pushed in messages
var msgObj = {};
msgObj.sender = query.id;
msgObj.message = query.message;
// for every client registered with the server
for (client in messages) {
if (client != query.id) { // except for the client ... | [
"function handleInput(text) {\n // test if string is not just whitespace\n if (/\\S/.test(text)) {\n //send data to our chat buddy\n that.sendTextFunction(text);\n // append new text to existing chat text\n that.textDisplay.innerHTML = that.textDisplay.inner... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a random integer between 0 (inclusive) and limit (exclusive) | function randomInt(limit) {
return Math.floor(Math.random() * limit);
} | [
"function randInt(limit) {\n return Math.floor(Math.random() * limit);\n}",
"function randInt(limit) {\r\n return Math.floor(Math.random() * Math.floor(limit));\r\n}",
"function getRandNumber(limit){\n\treturn Math.floor(Math.random()*limit);\n}",
"function randNumGen (limit) {\n var randNum = Math.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fileSearch_kp Fired as a global keyPress event. Checks to see if the key pressed was a sensible character, and if so then shows the search box and fires off the first search | function fileSearch_kp(e){
e = e || window.event;
// If there are any modifiers or if we're already entering text into
// another input field elsewhere, then do nothing
if(e.ctrlKey || e.altKey || e.metaKey || e.target.tagName === 'INPUT') return true;
// Grab the typed character, test it, and sho... | [
"keyPressSearch(e) {\n\t\tif (\n\t\t\te.keyCode == 83 &&\n\t\t\tthis.isOverlay == false &&\n\t\t\t!$(\"input, textarea\").is(\":focus\")\n\t\t) {\n\t\t\tthis.openOverlay();\n\t\t}\n\t\tif (e.keyCode == 27 && this.isOverlay == true) {\n\t\t\tthis.closeOverlay();\n\t\t}\n\t}",
"function onSearchKeyPress(e) {\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Responsive Caret Dropdown open | function menu_dropdown_open() {
var width = $(window).width();
if (width > 991) {
if ($(".ow-navigation .nav li.ddl-active").length) {
$(".ow-navigation .nav > li").removeClass("ddl-active");
$(".ow-navigation .nav li .dropdown-menu").removeAttr("style");... | [
"focus() {\n this.$el.querySelector('.dropdown-toggle').focus();\n }",
"open() {\n this._shouldBeOpen = true;\n if (this.disabled || !this.collapsed || this.target.children.length === 0) {\n return;\n }\n // if no drop-down width is set, the drop-down will be as wide... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
trim empty lines at beginning and end | trimEmptyLines () {
this.trimEmptyLinesAtBeginning()
this.lines.reverse()
this.trimEmptyLinesAtBeginning()
this.lines.reverse()
} | [
"function removeEmptyLines() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utLinesUtility,\n sp: utilitymanager_1.um.TIXSelPolicy.All,\n }, function (up) {\n var arr = up.inlines;\n for (var i = arr.length - 1; i >= ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LinkState with validate fields option key: it's a field name; section: section; required: field required; type: validate type | linkClientState (key, section = null, required = false, type = null) {
return {
value: this.state.fields[key],
requestChange: (value) => {
let obj = this.state.fields
obj[key] = value
this.setState(obj)
if (required) {
this._validates(section, key, type)
... | [
"function setupLink(){\n disableAdvance($field);\n var $cvcField = $( document.getElementById( fieldConfig.cvc ) ),\n $expField = $( document.getElementById( fieldConfig.exp ) );\n $cvcField.blur( function(){\n if ( $cvcField.val() ) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CAT SPA & GROOMING getting all catSpa | getSpas() {
return this.catSpa;
} | [
"function cats(){\n\t\tpresentation.showLoader();\n\t\tapi.getCats().then(function(items){ \n\t\t\tconst indexCat = randomIndex(items.length);\n\t\t\tpresentation.catToDom(items[indexCat].link);\n\t\t\tpresentation.showLoader();\n\t\t})\n\t\t.catch(function(error){\n\t\t\tconsole.log(error); \n\t\t\tpresentation.sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================= ARRAYS PART OF QUIZ Write a function named sortedPlanets that returns an array of the planet names sorted alphabetically. | function sortedPlanets(Planets) {
return Planets.sort();
} | [
"function sortedPlanets() {\n\tPlanets.sort();\n\tdocument.write(Planets);\n}",
"function sortedPlanets(){\n var alpha = Planets.sort();\n console.log(alpha);\n}",
"function sortedPlanets(array) {\n\treturn array.sort();\n}",
"function sortPlanets(planets){\r\n var sorted = {};\r\n foreach(planets, fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes last index back to 1 | function resetIndex() {
PropertiesService.getDocumentProperties().setProperty("last", 1);
} | [
"$resetIndex() {\n this.$index = utils.range(0, this.shape[0] - 1);\n }",
"back() {\n this.idx --;\n }",
"changeIndex(){\n if(this.index == this.text.length - 1) this.index = 0\n else this.index++\n }",
"function decrementIndex() {\n currentIndex = currentIndex ? currentIndex - 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONCATENATED MODULE: ./src/cluster/components/K8s/components/ResourceCard/ResourceCard.jsx / Copyright 2019 Gravitational, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by appl... | function ResourceCard(_ref) {
var onClick = _ref.onClick,
created = _ref.created,
name = _ref.name,
_ref$Icon = _ref.Icon,
Icon = _ref$Icon === void 0 ? src_Icon["p" /* FileCode */] : _ref$Icon,
_ref$buttonTitle = _ref.buttonTitle,
buttonTitle = _ref$buttonTitle === void 0 ? 'EDIT'... | [
"function genIconNextComponent(displayName) {\n return `/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apach... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onSubmit method to console.log values | onSubmit(values) {
console.log(values);
} | [
"onSubmit(event) {\n // Prevent default browser behaviours\n event.preventDefault();\n\n // Call the onSubmit prop function with form values\n this.props.onSubmit(this.getValues());\n }",
"submit (e) {\n this.onSubmit(this.getData());\n e.preventDefault();\n }",
"function getFormValuesAndDis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a layer to the supplied control layer. If the device/zone layers has a "grouping category", places it in, otherwise, uses generic Devices/Zones layers. | function addLayerToControlLayer(featureCollection, layer) {
var layer_display_name, display_name, name
if (featureCollection.type == "FeatureCollection") {
var type = "Devices"
if (featureCollection.features.length > 0) {
type = (featureCollection.features[0].geometry.type == "Point"... | [
"function addLayerInOrder(_) {\n\n\t\tvar insertBehindUID = \"start\";\n\n\t\tif (_.container!==undefined)\n\t\t\t_.container.find(_.type).each(function() {\n\t\t\t\tif (_.uid!==this.dataset.uid)\n\t\t\t\t\tinsertBehindUID = RVS.L[this.dataset.uid].group.groupOrder<=RVS.L[_.uid].group.groupOrder && RVS.H[this.datas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pre: when the program is started or time to update. sectionPages should pass a json file that contains pages data in the "today" section, progress should be only refer to the progress bar showing today's progress by default post: finds if there is any check list for today and update the percentage on the progress bar | function updateProgress(sectionPages, progressBar = todayProgress){
var flag = true;
for(var i = 0; i < JSON.parse(sectionPages).value.length; i++){
if(Date.parse(JSON.parse(sectionPages).value[i].title)
&& (new Date()) - new Date(JSON.parse(sectionPages).value[i].title.trim()) < 1000 * 60 * 60 * 24
... | [
"function updatePageData(){\n // Update current step number\n $(\".kf-current-step\").each(function(index) {\n $(this).text(currentStep);\n });\n }",
"function updateProgress() {\n\n // Update progress if enabled\n if (config.progress && dom.progress) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parses the attribute sortablefields and creates an internal array of sortable fields | _applySortableFields(fields) {
if (fields && fields.length) {
let sortableCols = fields.replace(/ /g, "").split(',');
sortableCols.forEach((f)=>{
let column = this.cols.filter(obj => {
return obj.id === f;
});
column[0].... | [
"_applySortableFields(fields){if(fields&&fields.length){let sortableCols=fields.replace(/ /g,\"\").split(\",\");sortableCols.forEach(f=>{let column=this.cols.filter(obj=>{return obj.id===f});if(column.length){column[0].sortable=!0}})}}",
"_initSortFields(sStartValues) {\n\t\t\tvar oFields = this._oViewModel.getPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update row of Property | function update_property(row_id){
create_property_list(row_id, from='update');
} | [
"function update_property_row(row_id){\n create_property_list(row_id, from='update');\n}",
"setCell(rowId, property, value) {\n const index = findIndex(this.props.rows, { id: rowId });\n const rows = cloneDeep(this.props.rows);\n\n rows[index][property] = value;\n\n this.props.setRows(rows)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set canvas title based on its model | setTitle(canvasObject) {
canvasObject.domTitle.innerHTML = `<b>${canvasObject.stringTitle}</b>`;
} | [
"function title() {\n \t\ttitleDef = new image(DEMO_ROOT + \"/def/resources/title_def.png\");\t\t\t\t\t// Load images\n \t\ttitleDemo = new image(DEMO_ROOT + \"/def/resources/title_demo.png\");\n \t\ttitleDefScreen = SeniorDads.ScreenHandler.Codef(\t\t\t\t\t\t\t\t\t// Set up \"'Def\" canvas\n \t\t\t\tti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ECMA262 12.4 Postfix Expressions | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1,... | [
"function parsePostfixExpression() {\n var expr, token, startToken = lookahead;\n \n expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);\n \n if (!hasLineTerminator && lookahead.type === Token.Punctuator) {\n if (match('++') || match('--')) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handles an event of clicking on a tile. The function locates the tile and if found, creates a popup with the time it was created in the system. It needs to know what type of tile is clicked one that is an aggregation of several altitudes or one that is 'regular'. | function turbulenceLayerClick(e) {
var tileX = mapTools.long2tile(e.latlng.lng, 11);
var tileY = mapTools.lat2tile(e.latlng.lat, 11);
var tsValue = '';
if ($scope.displayAllAltitude) { // Create the popup for tiles shown for all altitudes.
//create the key for the tile.
... | [
"function tileClicked(event) {\n\tselectTile(event.target);\n}",
"function tileClickEvent() {\r\n\r\n\t$(\".tile-wide, .tile-square, .tile-small\").click(function() {\r\n\r\n\tvar id = generateUniqueID();\r\n\tvar modalId = \"#modal_\" + id;\r\n\tvar buttonId = \"#btn_\" + id;\r\n\r\n\tvar url = $(this).data(\"ur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prepare function is to prepare webpage after reload i.e. adding event listeners, and erasing textarea, etc.. | function prepare(){
//This line erases the type area and changes its value to none.
document.getElementById('type-area').value='';
//this is to reset the forms...
$('#validate_s').trigger("reset");
$('#validate_l').trigger("reset");
//this is to add event listener to send button...
var send_button=document.get... | [
"prepare() {\n this.initializeScreenElements();\n this.initializeTutorialSteps();\n }",
"function prepPage() {\r\n\tvar uriObj = parseURI(); // update the uriObj\r\n\tif (uriObj['ajax'] && uriObj['ajax'] == 0) return; // in case i want to quickly change ajax state\r\n\tvar idDiv = document.getEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to load all the pages (max 10), and writing the names of the found repos in "repo_names.txt" | async function loadMore(pages, url) {
//console.log("ciao");
for ( let i = 1; i < pages +1; i++ ) {
const response = await fetch( url + '&page=' + i, {
"method" : "GET",
"headers": headers
})
.then( blob => blob.json() )
.then( function( data ) {
d... | [
"function process_repos (res) {\n repos = repos.concat(res);\n pages--;\n if (!pages) process_count(repos);\n }",
"function repos() {\n document.getElementById(\"numberOfRepos\").innerHTML = \"\";\n\n if (reposData.length == 0) {\n document.getElementById(\"numberOfRepos\").innerHTML ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global PropertyFactory, degToRads, TextSelectorProp / exported TextAnimatorDataProperty | function TextAnimatorDataProperty(elem, animatorProps, container) {
var defaultData = {
propType: false
};
var getProp = PropertyFactory.getProp;
var textAnimatorAnimatables = animatorProps.a;
this.a = {
r: textAnimatorAnimatables.r ? getProp(elem, textAni... | [
"function TextAnimatorDataProperty(elem,animatorProps,container){var defaultData={propType:false};var getProp=PropertyFactory.getProp;var textAnimatorAnimatables=animatorProps.a;this.a={r:textAnimatorAnimatables.r?getProp(elem,textAnimatorAnimatables.r,0,degToRads,container):defaultData,rx:textAnimatorAnimatables.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup editorkey observer which will forward it to focused widget. | function setupKeyboardObserver( widgetsRepo ) {
var editor = widgetsRepo.editor;
editor.on( 'key', function( evt ) {
var focused = widgetsRepo.focused,
widgetHoldingFocusedEditable = widgetsRepo.widgetHoldingFocusedEditable,
ret;
if ( focused )
ret = focused.fire( 'key', { keyCode: evt.data.keyC... | [
"onBeforeKeyDown() {\n if (!this.hot.isListening() || this.isEditorOpened()) {\n return;\n }\n const activeElement = this.hot.rootDocument.activeElement;\n const activeEditor = this.hot.getActiveEditor();\n\n if (!activeEditor ||\n (activeElement !== this.focusableElement.getFocusableElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts request message and responds if necessary. | function respond() {
var request = JSON.parse(this.req.chunks[0]);
message = request.text;
if (message.charAt(0) == '!') {
response = run(request);
send(response, this);
}
} | [
"function handleRequestMessage() {\n\t\t\t\t//++ TODO: implement request()\n\t\t\t\tconsole.error(\"TODO: implement request()\")\n\t\t\t}",
"async _onMessage() {\n this._log(this.levels.debug, 'message', 'Got new request');\n\n // If shutting down or already working ignore the message\n if (!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcion que crea un menu pokemon | function GenerarMenuPekemon()
{
for(var i=0;i<P.length;i++)
{
var menu=document.getElementById("menupokemon").innerHTML;
document.getElementById("menupokemon").innerHTML=menu+"<li onclick='pokedex(P"+(i+1)+");'>"+P[i+1].pokemonN+"</li>"
}
} | [
"function createMenu(menu){\n\tconsole.log(\"create menu being called\");\n\tif((charger.game.menu != null) || (menu === 'destroy')){\n\t\tif(charger.game.menu != null){\n\t\t\tcharger.game.menu.destroy();\n\t\t\tcharger.game.menu = null;\n\t\t}\n\t}\n\tif(menu === 'main_menu'){\n\t\tcharger.game.menu = charger.gam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor url URL for ajax call for serverside data parameter parameter for ajax call symbol the symbol for which this order book is created clientData data currently on clientside targetRows the rows of the target order book table sorter a sorter function that sorts orders strictly (order order > bool) insertFlashTi... | function OrderBook(url, parameter, symbol, clientData, targetRows, sorter, insertFlashTime, removeFlashTime) {
this.url = url;
this.parameter = parameter;
this.symbol = symbol;
this.clientData = clientData;
this.targetRows = targetRows;
this.sorter = sorter;
this.insertFlashTime = insertFlashTime;
this.removeFl... | [
"function clientPageInit(type) {\n\n AddStyle('https://1048144.app.netsuite.com/core/media/media.nl?id=1988776&c=1048144&h=58352d0b4544df20b40f&_xt=.css', 'head');\n\n // addStyle('https://1048144.app.netsuite.com/core/media/media.nl?id=1988776&c=1048144&h=58352d0b4544df20b40f&mv=j11m86u8&_xt=.css', 'head');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates and return a new Bootstrapbased popup modal window | function newPopup(options) {
var html = [];
html.push('<div class="modal hide fade" tabindex="-1"');
html.push('role="dialog" aria-hidden="true">');
html.push('<div class="modal-header">');
html.push('<button type="button" class="close" ');
html.push('data-dismiss="modal"... | [
"function CreatePopup(header, html, popSize) {\n \n if (header == undefined) {\n header = \"\";\n }\n if (html == undefined) {\n html = \"\";\n }\n var size = \"\";\n if (popSize == \"small\") {\n size = \" modal-sm\";\n }\n if (popSize == \"medium\") {\n size ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates the proof offchain using the PII information of the user and associated it with the other parameter details. | async function generateProof() {
// consider the given information that is verified privately off-chain (storing with wallet, name, age, personal ID, jurisdiction)
// they will be considered as leaves for the application.
const personalIdentifiedInfo = ["0x00000a86986129038908a9808098-toto-18-99123456-France", "0x00... | [
"function renderUserProofs() {\n $(\"#owner-address\").html(web3.eth.accounts[0]);\n renderProofs(\"proof-list\", {\n creator: web3.eth.accounts[0]\n });\n}",
"function buildICXUserPuff(username, passphrase) {\n var prependedPassphrase = username + passphrase\n var privateKey = passphraseToPrivateKeyW... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SET TOOL TAB (Vertical) | function setToolTab() {
var toolTabTitle = $('[data-tool-tab-title]');
var toolTabContent = $('[data-tool-tab-content]');
toolTabContent.attr('hidden', true); // hide all
$('[data-tool-tab]').removeClass('active'); // reset active
// loop all tab content
toolTabContent.each(function(){
var $this = $(this)... | [
"setTabProperties() { }",
"function draw_tabs() {\n // Get tab area\n var tabX = 0;\n var tabY = display.getHeight() - 4;\n var tabW = display.getWidth();\n var tabH = 4;\n\n // Draw the red area\n display.fill(tabX, tabY, tabW, tabH, \"white\", \"red\", ' ');\n\n // Draw instruction text\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends an AJAX request to get all the reservations of a user. Makes use of the HTTP GET method. ONSUCCESS => Displays all the reservations in a list ONERROR => Displays a message to the user to inform him that data could not be obtained | function get_user_reservations(api_url) {
$.ajax({
url: api_url,
type: 'get'
}).done(function(data, textStatus, jqXHR) {
// We have the user reservations
userReservations = data["items"];
// If user has no reservation, show a specific message
if (userReservations.length == 0) {
$("#t... | [
"function getReservations() {\n var hasTimedOut = false;\n var timeout = setTimeout(function() {\n hasTimedOut = true;\n location.reload();\n }, timeoutLength);\n $.get(\n \"/run/\",\n {run: \"igor show\"},\n function(data) {\n if (hasTimedOut) return;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set project meta input. | function set_proj_meta_input() {
proj_form = $('#proj');
// Set the project id header
var html = proj_form.html();
proj_form.html(html.replace(new RegExp('PROJECT_ID', 'g'), proj_id));
// Set up contributors.
var contributors_group = proj_form.find('.proj_contributors_group');
var contributors_div = con... | [
"function set_meta_input(cb) {\n // Then, set the samples metadata.\n set_samples_meta_input();\n\n // We have to set the common meta input form after setting up the samples\n // because this function assumes that the global sample_forms variable\n // is populated.\n set_common_meta_input(cb);\n\n // Deal wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback called when an http request failed | function onFailedXHR(request_intent, xhr) {
} | [
"function requestFailed(err) {\n console.log('XHR Failed for Main ' + err.data);\n return err.data;\n }",
"function OnError(request, data, status) {\t\t\t\t\n\t\tmessage = \"Network problem: XHR didn't work (perhaps, incorrect URL is called).\";\n\t\tDeleteMessage();\n\t\tCreateMessag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_playHTML5Audio() Plays using [params] Returns actual playing channel (which may be different from [id]) or AQ.ERROR | function _playHTML5Audio ( params )
{
var i, channel;
// play requested channel if ready
// is this sound already available in an ended, unpaused channel?
for ( i = 0; i < _channelCnt; i += 1 )
{
channel = _channels[i];
if ( ( channel.params.pathname === params.pathname ) && ( channel.status === _CH... | [
"function _playHTML5Channel ( channel, params )\n\t{\n\t\tvar audio, val, type;\n\n\t\tif ( _monitor )\n\t\t{\n\t\t\t_debug( \"Playing \" + channel.id + \": \" + params.pathname );\n\t\t}\n\n\t\tchannel.status = _CHANNEL_PLAYING;\n\t\taudio = channel.audio;\n\n\t\ttype = _typeOf ( params );\n\t\tif ( type === \"obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load manifest file with retries, defaults to 3 attempts. | async function loadManifest(manifestPath, attempts = 3) {
while(true){
try {
return require(manifestPath);
} catch (err) {
attempts--;
if (attempts <= 0) throw err;
await new Promise((resolve)=>setTimeout(resolve, 100));
}
}
} | [
"static init(retries = 5) {\n return new Promise((resolve, reject) => {\n this.tryInit()\n .then(downloader => resolve(downloader))\n .catch(err => (retries > 1 ? resolve(this.init(retries - 1)) : reject(err)));\n });\n }",
"function loadManifest(manifest, fromLocalStorage, timeout) {\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the overpass query code `pos` location where to search | static getOverpassQuery(pos)
{
throw new Error("Not implemented");
} | [
"function GeoLocQuery(){}",
"function searchPosition(pos) {\n\t\tposition = pos;\n\t\tshowSplash('spin');\n\t\tvar sqlQuery = 'SELECT * FROM map';\n\t\tdbQuery(sqlQuery, undefined, function(tx, rs) {\n\t\t\tif(rs.rows && rs.rows.length) {\n\n\t\t\t\t// Our flag to know if there are available stations\n\t\t\t\tvar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sidebar component, containing projects related to user | function SideBar() {
const { userData } = useUserContext();
return (
<NewProjectContextProvider>
<div className={CLASS.sideBar}>
<p className={CLASS.sectionTitle}>Hello, {userData.name} {userData.surname}</p>
<Accordion defaultActiveKey="0">
... | [
"function Sidebar(users, selectedUser, actions) {\n let sidebar = document.createElement(\"div\");\n sidebar.classList.add(\"sidebar\");\n sidebar.appendChild(FluttererLogo());\n sidebar.appendChild(AccountSelector(users, selectedUser, actions));\n return sidebar;\n}",
"showProjects() { \n\t\tvar c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the Ctrl + V keys for pasting | function handleKeyDown(e, args) {
if (!inFocus && e.which == keyCodes.V && (e.ctrlKey || e.metaKey)) { // CTRL + V
//reset value of our box
//$('#myPasteBox').val('');
//set it in focus so that pasted text goes inside the box
$('#myPasteBox').focus();
}
} | [
"onKeyPressed(event){\n switch(event.keyCode){\n case 27: /** ESCAPE pressed */\n this.command.reset();\n break;\n case 67: /** Key C pressed - perform Copy */\n if(event.isCtrlDown){\n this.command.context.chain.updateP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get some basic info on the component like name, children properties etc. | function getComponentInfo(object) {
if (typeof object.children != 'undefined' && object.children.length > 0) {
// Go throguh each children and return the class that has a component decorator (the component)
// right now only works if the decorator is right on top of the component !
let compo... | [
"function ComponentInfo()\n{\n this.name = \"\";\n this.displayName = \"\";\n this.description = \"\";\n this.parent = \"\";\n \n this.properties = new Array(); // array of property info\n \n this.methods = new Array();\n}",
"function getVnodeInfo(vnode) {\n if (!vnode || vnode.length > 1) return {};\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
declare an if statement that checks if freeCups is greater than or equal to 1 if it is return input coffeeCups plus freeCups If it is not then just return the input coffeeCups | function freeCoffeeCups(coffeeCups) {
var freeCups = coffeeCups / 6;
if(freeCups >= 1) {
return coffeeCups + Math.floor(freeCups);
} else {
return coffeeCups;
}
} | [
"function freeShipping(eligShipAmount, item1, item2) {\r\n if (item1 + item2 >= eligShipAmount) {\r\n return true; \r\n } else {\r\n return false; \r\n }\r\n}",
"function haveEnough() {\n\tif (totalCash >= earringsSum + watchesSum) {\n\t\treturn 'Enough $$$';\n}\telse {\n\t\treturn 'Not enough $$$';\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bot send a message with Weather data if user write "!getWeather" | function getWeather(prefix,message){
notCommande(prefix,message);
if(message.content.startsWith(prefix + "getWeather")){
var args = message.content.split(" ");
var WeatherCities = [];
for(var i=1;i < args.length;i++){
WeatherCities[i-1] = args[i];
}
app.Weather(WeatherCities,function(resultat){... | [
"function returnWeatherData(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n // Send a command to the device\n messaging.peerSocket.send(['weather',data]);\n } else {\n console.log(\"Error: Connection is not open\");\n }\n}",
"function returnWeatherData(data) {\n if (m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tween Ease images in from left and right | function imgsIn() {
tl.staggerTo(elImgsLeft, 1, {
autoAlpha: 1,
x: '+=100%',
scale: 1,
ease: Back.easeOut.config(1.5)
}, 0, '-=0.025');
tl.staggerTo(elImgsRight, 1, {
autoAlpha: 1,
x: '-=100%',
scale: 1,
... | [
"function moveImageSlider(whichDirection){\n sliderIsAnimating = true;\n\n currentSliderImage = checkNum((currentSliderImage += (whichDirection == \"left\" ? 1 : -1)), numberOfSliderImages);\n\n // First we calculate the distance the next image has to slide to be perfectly centered in the view\n var targetImage... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a fake event object with any desired event type. | function createFakeEvent(type, canBubble = true, cancelable = true) {
const event = document.createEvent('Event');
event.initEvent(type, canBubble, cancelable);
return event;
} | [
"createEvent(type) {\n return new Event(type, {\n bubbles: false,\n cancelable: false\n });\n }",
"static createFakeEvent(type, canBubble = false, cancelable = true) {\n let event;\n if (typeof Event === 'function') {\n event = new Event(type);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an exercise to the exercise list element in the dom | addExerciseToDom(exercise)
{
var row = document.createElement("tr");
var nameCol = document.createElement("td");
nameCol.textContent = exercise.name;
nameCol.className = "mdl-data-table__cell--non-numeric";
var repsCol = document.createElement("td");
repsCol.textCon... | [
"addExerciseToDom(exercise)\n {\n var row = document.createElement(\"tr\");\n row.setAttribute('data-id', exercise.id);\n\n var nameCol = document.createElement(\"td\");\n nameCol.textContent = exercise.name;\n nameCol.className = \"mdl-data-table__cell--non-numeric\";\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
\ Component: SearchMoviesScreen. Explanation: This component is used for loading the Search Movies Screen. ============================ Creator: Ansari || Date: 20200117 \ | function SearchMoviesScreen({ navigation }) {
const userQuery = {
s: '',
};
const [search, setSearch] = useState('');
// This function updates the search variable with user inputted text
const handleChangeText = searchValue => {
setSearch(searchValue)
}
/* This function ... | [
"function searchMovies (event){\n const searchText = event.target.value;\n setSearchQuery(searchText); \n const searchResultMovies = props.moviesArray.filter(function(movie){if(movie.title.toLowerCase().includes(searchText) || (movie.overview.toLowerCase().includes(searchText))){return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply rule Will return false if not applicable Will change cell state and return true if applicable | function apply(cell) {
var aliveNeighbours;
if (!cell.isAlive) {
return false;
}
aliveNeighbours = cell.aliveNeighbours().length;
if (aliveNeighbours >= 2) {
return false;
}
cell.isAlive = false;
return true;
} | [
"applyRuleOne(){\n for(let r=0; r < this.rows; r++) {\n for (let c = 0; c < this.cols; c++) {\n if(!(this.grid[r][c] == 'D' || this.grid[r][c] == 'F' || this.grid[r][c] == '0')){\n let neigh = this.getNeighbours(r,c);\n let adjBombs = Number(thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gatherStrings: given an object, return an array of all of the string values. Taken from solution | function gatherStrings(obj) {
let stringArr = [];
for (let key in obj) {
if (typeof obj[key] === "string") stringArr.push(obj[key]);
if (typeof obj[key] === "object") stringArr.push(...gatherStrings(obj[key]));
}
return stringArr;
} | [
"function gatherStrings(obj) {\n\n let acc = [];\n function _gather(vals, i = 0) {\n if (i < vals.length) {\n if (typeof vals[i] === 'string') acc.push(vals[i]);\n else if (typeof vals[i] === 'object') _gather(Object.values(vals[i]));\n _gather(vals, i + 1);\n }\n return acc;\n }\n\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads from URL the compare parameters and initialize the loading of historical data | function readCompareParameters() {
var parameters = $location.search();
var tickersSelected = _.map(parameters.tickers.split(","), function (ticker) {
return {ticker: ticker}
});
vm.fromDate = new Date(Number(parameters.fromDate));
vm.toDate = new Date(Number(parameters.toDate));
... | [
"function init() {\n urlArgsDict = getUrlArgs();\n var partsStrArray = urlArgsDict.parts.split(';');\n partsStrArray.forEach((it, ix) => {\n partsToRun.push(parseInt(it));\n });\n var t_scoreDataFileName = urlArgsDict.dataFileName || scoreDataFileName;\n var scoreDataFilePath = 'savedScoreData/' + t_scoreD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively a set the same value for all keys and arrays nested object, cloning | function setNestedObjectValues(object,value,visited,response){if(visited===void 0){visited=new WeakMap();}if(response===void 0){response={};}for(var _i=0,_Object$keys=Object.keys(object);_i<_Object$keys.length;_i++){var k=_Object$keys[_i];var val=object[k];if(isObject$2(val)){if(!visited.get(val)){visited.set(val,true)... | [
"function deepUpdate(currentObject, key){\n if (arr.length === 0){\n currentObject[key] = value;\n return currentObject;\n }\n\n let new_key = arr.shift();\n let temp = currentObject[key];\n return {...currentObject, [key]:deepUpdate(temp, new_key)}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a specific ship types image has been loaded already | function isShipLoaded(type) {
var loaded = false;
switch (type) {
case Constants.ShipType.EMPIRE_DESTROYER:
loaded = isDestroyerLoaded;
break;
case Constants.ShipType.EMPIRE_TIE_FIGHTER:
loaded = isTieFighterLoaded;
... | [
"function isSpriteLoaded(type) {\n var loaded = false;\n switch (type) {\n case Constants.SpriteType.EXPLOSION_SMALL:\n loaded = isExplosionSmallLoaded;\n break;\n case Constants.SpriteType.EXPLOSION_LARGE:\n loaded = isExplosionLargeL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper to remove a node from the DOM and to do all the necessary null checks. | function removeNode(node) {
if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
} | [
"function removeNode(node) {\n if (node && node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}",
"function remove_node(node)\n\t{\n\t\t// if the node's parent is null, it's already been removed\n\t\tif ( node.parentNode == null )\n\t\t\treturn;\n\n\t\tnode.parentNode.removeChild(node);\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This code will find jobs by Sector using Webelement:linkTesxt | findSectorLists(){
this.driver.findElement(By.linkText('Banking and finance'));
this.driver.findElement(By.linkText('Business services'));
this.driver.findElement(By.linkText('IT and telecoms'));
this.driver.findElement(By.linkText('Government'));
} | [
"async function getJobs(page, jobs) {\n // here we are scrolling to the bottom within the jobs container because the jobs' inner html after 7th job are not loaded when they are not scrolled into. \n await page.evaluate(() => {\n // selecting the jobs div\n const jobsDivSelector = 'body > div.app... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
objectfit fallback for ie internet explorer | function objectFitFallBackForIe() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (
msie > 0 ||
(!!navigator.userAgent.match(/Trident.*rv\:11\./) &&
$(".photo-callout-widget__img").length)
) {
$("img.photo-callout-widget__img").each(function ... | [
"function ieObjectFitFix() {\n var userAgent, ieReg, ie;\n const width = $(window).width();\n\n userAgent = window.navigator.userAgent;\n ieReg = /msie|Trident.*rv[ :]*11\\./gi;\n ie = ieReg.test(userAgent);\n\n // If IE is detected and we're at tablet and above screen widt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |