query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Tell the server to replace the current player. | function replace() {
view.fadeOut();
ws.send(JSON.stringify({
type: "replace",
}));
} | [
"restart() {\n this.player.restart();\n }",
"function reloadPlayer() {\r\n\t\tvar playerParent = player.parentNode;\r\n\t\tvar playerNextSibling = player.nextSibling;\r\n\t\tplayerParent.removeChild(player);\r\n\t\tplayerParent.insertBefore(player, playerNextSibling);\r\n\t}",
"function replace() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a stateless view showing inputs for add/replace groups. | function AddGroup(props) {
var onChangeName = event => props.onInputNameChange(event.target.value);
return (
<div className="container">
<div className="row">
<div style={{display:"inline-block", marginTop:"auto", marginBottom:"auto"}}>
<input type="text" onChange={onChangeName} value={props.input... | [
"registerAddGroup() {\n\t\tthis.container.on('click', '.js-group-add', (e) => {\n\t\t\tlet template = this.container.find('.js-condition-builder-group-template').clone();\n\t\t\ttemplate.removeClass('hide');\n\t\t\t$(e.target)\n\t\t\t\t.closest('.js-condition-builder-group-container')\n\t\t\t\t.find('> .js-conditio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HTTP call used to sort Viewpage Elements | sortViewpageElements(requestData) {
return axios({
url: '/sort/elements',
method: 'post',
baseURL: API_LOCATION + '/api/v1/',
headers: {
'Content-Type': 'application/json'
},
data: {
"viewsiteId": requestData... | [
"function call_ajax_sort_main(field,order,page,urlpage,div)\n{\n\tvar advancesearchstr\t=\tchkadvancesearch(div);\n\tvar param='';\n\tif(page)\n\t{\n\t\tparam='&page='+page;\n\t}\n\tjQuery('#'+div).load(urlpage+'?field='+field+'&order='+order+'&'+page+'&'+advancesearchstr);\n}",
"function onSortClick(e) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a link to the given configuration pid and/or factoryPid | function createConfigPidLink($scope, workspace, pid, isFactory) {
if (isFactory === void 0) { isFactory = false; }
return Core.url("#" + createConfigPidPath($scope, pid, isFactory) + workspace.hash());
} | [
"function createConfigPidPath($scope, pid, isFactory) {\n if (isFactory === void 0) { isFactory = false; }\n var link = pid;\n var versionId = $scope.versionId;\n var profileId = $scope.profileId;\n if (versionId && versionId) {\n var configPage = isFactory ? \"/newConf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets push in to true on the elevio library. See: | enablePushin() {
get(this, '_elevio').pushin = 'true';
} | [
"disablePushin() {\n get(this, '_elevio').pushin = 'false';\n }",
"function handlePusher() {\n setPusher();\n }",
"togglePush() {\n if (this.isPushEnabled) {\n this.unsubscribe()\n } else {\n this.subscribe()\n }\n }",
"function Pushable() {\n this.pushable = 1;\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the form configuration that corresponds with the provided form ID, or returns false if there's no match. | getFormConfig() {
if (!this.hasValidPayload()) {
return false;
}
const formId = this.getFormId();
for (const [id, config] of Object.entries(this.forms)) {
if (id === formId) {
return config;
}
}
return false;
} | [
"getFormId() {\n if (this.payload.form) {\n // return value of `form` field\n return this.payload.form;\n }\n\n /**\n * check request path for `form/{id}`\n * path also availalable at event.requestContext.resourcePath\n */\n\n if (this.event.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that gets the debt agreement start timestamp | function getDebtStartTimestamp(debtAgreement) {
return new Promise(async (resolve, reject) => {
try {
resolve (
await baseLogic.getDebtAgreementTermStartTimestamp(debtAgreement)
)
} catch (error) {
console.log('error in getMyDebtAgreements: ', erro... | [
"get_trace_begin_dt() {\n\n\t}",
"function getDebtEndTimestamp(debtAgreement) {\n return new Promise(async (resolve, reject) => {\n try {\n resolve(\n await baseLogic.getDebtAgreementTermEndTimestamp(debtAgreement)\n )\n } catch (error) {\n console.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function that creates a `` or (``) structure out of given `modelItem` model `listItem` element. Then, it binds created view list item () with model `listItem` element. The function then returns created view list item (). | function generateLiInUl( modelItem, mapper ) {
// const listType = modelItem.getAttribute( 'type' ) == 'numbered' ? 'ol' : 'ul';
// const listType = 'eftouch';
const listType = 'p';
const viewItem = new ViewListItemElement();
const imageUrl = modelItem.getAttribute('imageUrl')
const attrs = { 'imageUrl': i... | [
"createNewItem() {\n let view = new EditableListItem(this.style);\n let controller = new ListItemController(this.itemDao, view);\n controller.createItem();\n FrontController.bindViewWithController(\n this.parentElement,\n view,\n controller\n );\n }",
"itemView(item) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getter & setter of _attributes | get attributes () {
return this._attributes;
} | [
"get attributes() {\n return this._.attributes;\n }",
"readAttributes() {\n this._previousValueState.state = this.getAttribute('value-state')\n ? this.getAttribute('value-state')\n : 'None';\n\n // save the original attribute for later usages, we do this, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to check issue date falls within the eff from & to dates | function chkIssueDtBwnFromTo(strFromDt, strToDt, strIssuDt) {
var blnchkIssueDt = false;
if (strFromDt == "" || strFromDt == undefined || strFromDt == null)
blnchkIssueDt = false;
else if (((new Date(strFromDt.split('/')[1] + '/' + strFromDt.split('/')[0] + '/' + strFromDt.split('/')[2])) <= (ne... | [
"function validate_issueDate(from, to) {\n\tvar from_date = $('#' + from).val();\n\tvar to_date = $('#' + to).val();\n\tvar parts = from_date.split('-');\n\tvar date = new Date();\n\tvar new_month = parseInt(parts[1]) - 1;\n\tdate.setFullYear(parts[2]);\n\tdate.setDate(parts[0]);\n\tdate.setMonth(new_month);\n\n\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert an instance. If provided, this function will ensure that any spot requests which have an id of `srid` are removed safely. The implication here is that any spot request which has an associated instance must have been fulfilled | async insertInstance(instance, client) {
let {
workerType,
region,
az,
id,
instanceType,
state,
srid,
imageId,
launched,
lastevent,
} = assertValidInstance(instance);
let shouldReleaseClient = false;
if (!client) {
shouldReleaseClient = ... | [
"async upsertInstance(instance, client) {\n let {\n workerType,\n region,\n az,\n id,\n instanceType,\n state,\n srid,\n imageId,\n launched,\n lastevent,\n } = assertValidInstance(instance);\n\n let shouldReleaseClient = false;\n if (!client) {\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shows check button not in original | function showCheckButton() {
_myDispatcher.dispatch("iteration.checkbutton", {"state":"visible"});
} | [
"function dothecheck()\r\n\t\t{\r\n\t\tif(makeButton.checked)\r\n\t\t{\r\n\t\t\tinvertCSS();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\trevertCSS();\r\n\t\t}\r\n\t\t}",
"function setCheckButtonToIncorrect() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"incorrect\"});\t\n\t}",
"updateCheckbox... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remueve el titulo del modal de SharePoint | function removeModalSharePointTitle() {
$(".ms-dlgTitleText").css("display", "none");
} | [
"function setModalWindowTitle(title) {\n if (typeof (title) == \"undefined\") title = \"Loading..\";\n el(\"tdmodalwindowtitle\").innerHTML = title;\n}",
"function editTitle(name) {\n $(\"#modal_title\").text(name);\n}",
"function setTitle() {\n var title = $('h1#nyroModalTitle', modal.contentWrapper)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convertion of parameters to string, only allows simple types used by Iconify API | function paramToString(value, nested) {
switch (typeof value) {
case 'boolean':
if (nested) {
throw new Error('Nested boolean items are not allowed');
}
return value ? 'true' : 'false';
case 'number':
... | [
"static stringify(){\n //Step 1. Transform ParamArray into elements (transform null into string rep of null)\n const arg = []; \n for (let index = 0; index < arguments.length; index++) {\n if (arguments[index]) {\n arg.push(arguments[index]);\n }else{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the key of the currently selected node in the diagram. | getSelectedNodeKey() {
var diagram = this.diagram;
var selectedNode = diagram.selection.iterator;
while(selectedNode.next()) {
if (selectedNode.value) {
return selectedNode.value.data.key;
}
}
// no node selected
return null;
} | [
"function Getkey ($this) {\n return $($this).parents(\".kncatshell\").attr(\"id\")\n }",
"getKeyNameNode() {\r\n const param = this.compilerNode.parameters[0];\r\n return this._getNodeFromCompilerNode(param.name);\r\n }",
"function nodeKeyFunction(d) {\n return d.id\n}",
"findKey(edito... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility method that return a Promise that will resolve with the height of the chain | getChainHeight() {
return new Promise((resolve) => {
resolve(this.height);
});
} | [
"getChainHeight(){cov_2n3fs5wc0i.f[2]++;cov_2n3fs5wc0i.s[10]++;return new Promise((resolve,reject)=>{cov_2n3fs5wc0i.f[3]++;cov_2n3fs5wc0i.s[11]++;resolve(this.height);});}",
"getChainHeight(){cov_28ta12smrz.f[2]++;cov_28ta12smrz.s[10]++;return new Promise((resolve,reject)=>{cov_28ta12smrz.f[3]++;cov_28ta12smrz.s[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
VECTOR FUNCTIONS rewrite this as a model! Takes two points and finds the distance between them. | function vectorDist(a, b) {
return Math.sqrt(
Math.pow(a[0]-b[0], 2) +
Math.pow(a[1]-b[1], 2) +
Math.pow(a[2]-b[2], 2)
);
} | [
"distanceBetweenVectors ( v1, v2 ) {\n\n\t var dx = v1.x - v2.x;\n\t var dy = v1.y - v2.y;\n\n\t return Math.sqrt( dx * dx + dy * dy );\n\t}",
"function calcDistance(vectorA, vectorB){\n x1 = vectorA.x\n y1 = vectorA.y\n x2 = vectorB.x\n y2 = vectorB.y\n\n return Math.sqrt((x1 - x2)**2 + (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Registers or releases event listening for keyDown events depending on the value of the flag argument. = Parameters +_state+:: Set the keyDown event listening on/off (true/false) for the component instance. Also supports special mode 'repeat', when listening to key repetitions is needed. = Returns +self+ | setKeyDown(_state) {
this.events.keyDown = _state;
this.setEvents();
return this;
} | [
"setKeyUp(_state) {\n this.events.keyUp = _state;\n this.setEvents();\n return this;\n }",
"function ui_keyStateDown(key)\n{\n for (var j = 0; j < ui_piano_key_section.component.component_list.length; j++)\n {\n var component = ui_piano_key_section.component.component_list[j];\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merges 2 nodes children' into 1 array. | mergeChildren(node1children = [], node2children = []) {
const children1 = (isArray(node1children) ? Array.from(node1children) : [node1children]);
const children2 = (isArray(node2children) ? Array.from(node2children) : [node2children]);
const mergedChildren = [];
each(children1, (child) =... | [
"function mergeChildren(c1, c2) {\n if (!c1 || c1.length === 0) {\n return c2;\n }\n\n if (!c2 || c2.length === 0) {\n return c1;\n }\n\n // make the ref map.\n let children = {};\n c1.map(item => {\n children[item.name] = item;\n });\n\n // Add the children\n c2.map(item => {\n if (children[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to perform a test run and returns the test run ID Fails hard, and exits if no concurrency is subscribed in the account | async attemptTestRunStart() {
// Get concurrency first
// And log it if its currently exceeded
let concurrency = await SpaceAndProjectApi.getProjectConcurrency( this.projectID );
// Plan is not allowed to run test : Fail now - HARD !
if( concurrency.total <= 0 ) {
OutputHandler.fatalError(`No concurrency... | [
"addTestRunCycle(projectKey=this.options.projectKey, testRunName = `Test run ${this.getDateNow()}`, folderId=this.options.testCycleFolder) {\n let requestBody = {\n \"projectKey\": projectKey,\n \"name\": testRunName,\n \"folderId\": folderId\n }\n let response ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Coordinate Distance Functions / haversin Applies the haversin on a given angle. The haversin is defined as: harversin(x) = 1(sin(x/2))^2 This is equivalent to 1cos(x)/2 which is faster, but could possibly lead to floating point rounding from what I've read Input 'theta' is an angle in degrees (use 'radian' function to ... | function haversin(theta) {
//return Math.sin(theta/2.0)*Math.sin(theta/2.0);
return (1-Math.cos(theta))/2.0;
} | [
"waveform (theta) {\n const cth = Math.cos(theta)\n const sth = Math.sin(theta)\n const phase = this.phases[this.phase]\n\n return (Math.cos((cth * this.x) + (sth * this.y) + phase) + 1) / 2\n }",
"function getTheta( h, l ) {\r\n\treturn TRIG.radiansToDegrees( Math.asin( h / l ) );\r\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Focus the video. Enters full screen in larger screens. Sets the focused video element in mobile screens | function focusVideo(e){
e.preventDefault();
if(window.innerWidth > 640){
e.target.requestFullscreen();
return;
}
if($('#focused-video>div').length){
$('#video-wrapper')[0].appendChild($('#focused-video>div')[0]);
}
$('#focused-video').html("");
$('#focused-video')[0].... | [
"function focusPlayer() { video.focus(); }",
"function installPlayerInputAutoFocus() {\n\tfunction autoFocusIfNeeded() {\n\t\tif (inWatchPage() && !topBarIsVisible()) {\n\t\t\tgetVideoContainer().focus();\n\t\t}\n\n\t\tsetTimeout(autoFocusIfNeeded, 20);\n\t}\n\n\tautoFocusIfNeeded();\n}",
"function oet_checkFoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves the given node's type. Will resolve to the type's generic constraint, if it has one. | function getConstrainedTypeAtLocation(services, node) {
const nodeType = services.getTypeAtLocation(node);
const constrained = services.program
.getTypeChecker()
.getBaseConstraintOfType(nodeType);
return constrained ?? nodeType;
} | [
"function getNodeType(node) {\n const tsNode = service.esTreeNodeToTSNodeMap.get(node);\n const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode);\n return getBaseTypeOfLiteralType(type);\n }",
"function checkNodeType(node, type) {\n if (node && node.type ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for Storage to do auto value [de]serialization | function storageWrapper(type) {
var storage = window[type];
return {
get: function (key) {
let val = storage.getItem(key);
try {
val = JSON.parse(val);
} catch (e) {
//Do... | [
"set storage(value) { this._storage = value; }",
"static save( keyName , obj = false , storageValue ){\n\n\n /* if obj = false meaning edit and save direct \n if = obj not false meaning add new value with array in storage */\n if(!obj){\n\n }else if(this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reading in from the JSOn file with all the pokemon | readInFile() {
//Goes through the json files and populate the pokemon list
for (var i = 0; i < pokemon.length; ++i) {
var currentPokemon = pokemon[i];
var id = currentPokemon.id
var name = currentPokemon.name;
var type = currentPokemon.type;
v... | [
"function loadPokemonData() {\n const jsonString = fs.readFileSync(\"./data/pokemon-db.json\", \"utf-8\");\n return JSON.parse(jsonString);\n}",
"function preload() {\n //get the JSON pokedex file\n pokedex = loadJSON(\"https://raw.githubusercontent.com/fanzeyi/pokemon.json/master/pokedex.json\")\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display a number on the flipper | function _showNumber(flipper, n) {
n = n.toString();
if(n < 10) n = '000'+n;
else if(n < 100 && n > 9) n = '00'+n;
else if(n < 1000 && n > 99) n = '0'+n;
var selectors = ['thousands', 'hundreds', 'tens', 'ones'];
for(var i = 0; i < selectors.length; i++) {
var sel = '#'+ flipper +' .'+ selectors[i];
... | [
"function flipNumbers() {\n numberOfFlips++;\n flipCounter.innerText = numberOfFlips;\n}",
"function flipper(num) {\n const str = num.toString();\n let joined = '';\n for (let i=str.length-1; i>=0; i--) {\n joined += str[i];\n }\n return Number(joined);\n}",
"function flipSign() {\n // if remaini... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Hearth to Inventory | addHearthToInventory(brand, item) {
this.inventory.push({ brand, item });
} | [
"addInventory(inventory) {\n this.inventories.push(inventory);\n }",
"function add(data) {\n const inventoryArr = inventoriesList();\n const newInventory = new Inventory(\n data.warehouseId,\n data.warehouseName,\n data.itemName,\n data.description,\n data.category,\n data.status,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Content form show button click handling | function showContentAdd() {
var contentAddForm = document.querySelector('#add-contents-form');
contentAddForm.style.visibility = 'visible';
showContentAddFormButton.style.visibility = 'hidden';
} | [
"static showForm() {\r\n document.querySelector(DOMstrings.newBook).addEventListener('click', () => {\r\n let form = document.querySelector(DOMstrings.form);\r\n form.style.display = 'block';\r\n document.querySelector(DOMstrings.newBook).style.display = 'none';\r\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns list of all name, value measurements in the first size table | get_measurements(size) {
var measurements = [];
var sizeHeaders = document.querySelectorAll('.sizechart:first-of-type > tbody > tr > th + th');
var position = 0;
for (let i = 0; i < sizeHeaders.length; i++) {
var headerText = sizeHeaders[i].innerText.split('\n')[0].trim().toL... | [
"function printDims(){\n var ret = [];\n dataDims.forEach(function(e,i,a){\n ret.push( {'name' : e, 'value' : i} );\n });\n return ret;\n }",
"allSizes() {\n return _.chain(this.poms).pluck('sizes').first().value();\n }",
"definedSizes() {\n const { infoRes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Super hacky and likely unsafe sanitization function Still looking for the best way to sanitize strings in node.js | function sanitize(string) {
return string.replace(/[&<>]/g, '');
} | [
"static sanitize(string){\n return string.replace(/[^A-Za-z0-9- ']+/g, '')\n }",
"static sanitize(str){\n \n \treturn str.replace(/[^\\w\\s\\-\\']/gi, '')\n\n }",
"static sanitize(value) {\n return (value || '').toString().replace(/[^a-zA-Z0-9\\-_. @$!%^&()+=,]/g, '');\n }",
"static sanitize(string... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets data from the user input, and then sends it in the employee/truck/create POST request. If successful, then adds new truck to the DB and redirects to the homepage.jsp, otherwise prints the errors. | function add_truck(pageContext) {
let incorrect = false;
// check if capacity is a number
if (isNaN($("#capacityInput").val())) {
$("#capacityError").text("Must be a number!").show();
incorrect = true;
}
// check if shift size is a number
if (isNaN($("#shiftInput").val())) {
... | [
"function add() {\n\tevent.preventDefault();\n\tlet url = \"AddEmployeeServlet\";\n\tlet name = document.querySelector(\"#name\").value;\n\tlet employeeId = document.querySelector(\"#employeeId\").value;\n\tlet mobileNumber = document.querySelector(\"#mobileNumber\").value;\n\tlet email = document.querySelector(\"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Paylike order statuses from settings | getPaylikeOrderStatuses() {
/** Get order status for capture. */
cy.get('#PAYLIKE_ORDER_STATUS > option[selected=selected]').then($captureStatus => {
this.OrderStatusForCapture = $captureStatus.text();
});
} | [
"getPaylikeOrderStatuses() {\n /** Go to paylike method. */\n this.goToAdminPage(this.PaymentMethodsAdminUrl);\n\n /** Select advanced tab. */\n cy.get('a[href=\"#tab-advanced_settings\"]').click();\n\n /** Get order statuses for capture, refund & void. */\n cy.get('#input_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enqueue(animal): adds animal to the shelter, animal can be either cat or dog | animalShelterEnqueue(animal) {
//if cat - enqueue into cat queue
//if dog - enqueue into dog queue
if (animal.value === 'cat') {
this.cat.enqueue(animal);
} else {
this.dog.enqueue(animal);
}
} | [
"enqueue(animal){\n console.log(animal);\n // adds animal to the shelter, can be DOG or CAT\n if(animal.type !== 'dog' && animal.type !== 'cat') return null;\n if(animal.type === 'dog'){\n this.dog.enqueue(animal);\n return this;\n }\n if(animal.type === 'cat'){\n this.cat.enqueue(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
click image pop up function | function clickImage (data){
/*click function on each image*/
delegate("body","click",".clickMe",(event) => {
event.preventDefault();
var dataCaptionId=getKeyFromClosestElement(event.delegateTarget);
var dataCaption = data.caption;
dataCaption = dataCaption.replace(/\s+/g, "");
//match the ... | [
"function _openPopup() {\n var $img = $('.starting-XI-image img');\n $img.on('load', function(){\n $('.starting-XI__form--submit .btn').show();\n $('.js-starting-XI-loading').hide();\n $('.starting-XI-image').trigger('click');\n });\n }",
"function showpopu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /api/styles/:styleId delete a style controllers.styles.destroy | function destroy(req, res) {
console.log("Entering style destroy(): style id = ${req.params.styleId");
db.Style.findById(req.params.styleId, function(err, style) {
if (err) {
console.log(`failed to find style ${req.params.styleId} from db`);
res.sendstatus(404);
}
console.log(`found style ... | [
"deleteStyle() {\n const sql = 'DELETE FROM public.\"Style\" WHERE id =$1';\n return queryDB(sql, [this.id])\n }",
"handleStyleDelete(id){\n const request = new Request();\n request.delete('/api/styles/'+id).then(()=>{\n window.location = '/styles'\n })\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set args from config object. it recursively checks nested objects. | function setConfigObject (config, prev) {
Object.keys(config).forEach(function (key) {
var value = config[key]
var fullKey = prev ? prev + '.' + key : key
// if the value is an inner object and we have dot-notation
// enabled, treat inner objects in config the same a... | [
"function setConfigObject (config, prev) {\n Object.keys(config).forEach(function (key) {\n var value = config[key]\n var fullKey = prev ? prev + '.' + key : key\n\n // if the value is an inner object and we have dot-notation\n // enabled, treat inner objects in config the same as\n // h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the next period that has no conflict with the current period | function getNextNoConflict(sorted, period) {
let index = sorted.indexOf(period);
// Don't go past end of array
if (index === sorted.length) {
return null;
}
// Iterate from current position
for (let i = index; i < sorted.length - 1; i++) {
if (!checkConflict(period, sorted[i + 1])) {
return i ... | [
"function findNextPayPeriod () {\n\t\tvar currentDate = Date.now();\n\t\tvar dates = getRanges(2);\n\t\tvar nextPayPeriod = null;\n\n\t\tfor(var i = 0; i < dates.length; i++) {\n\t\t\tif(moment(currentDate).isBefore(dates[i][1])){\n\t\t\t\tnextPayPeriod = dates[i][1];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates a response function sending back to user the specified req[key] | function respondWith (key) {
return function (req, res) {
res.json(req[key]);
};
} | [
"function respond(req, res, next){\n\tres.json(\n\t\thandler(req.body.payload)\n\t)\n}",
"async hardkeyReq(_action, _keyid, _keyboardid, channel ) {\n let keyevent\n if (_action.toLowerCase() === 'exe' || _action.toLowerCase() === 'ret') {\n switch(_keyboardid.toLowerCase()) {\n case 'mib1':\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EXEC MAIN END Created: 22/08/2014 | Developer: reyro | Description: Function create transition | Request:Ajax | function fnCreateTransition() {
jQuery.ajax({
type: 'POST',
url: bittionUrlProjectAndController + 'fnCreateTransition',
// async: false,
dataType: 'json',
data: {
data: jQuery('#AdmTransitionIndexForm').bittionSerializeObjectJson()},
... | [
"function pageTransition() {\r\n\r\n var tl = gsap.timeline();\r\n tl.set('.loading-screen', { transformOrigin: \"bottom left\"});\r\n tl.to('.loading-screen', { duration: .5, scaleY: 1});\r\n tl.to('.loading-screen', { duration: .5, scaleY: 0, skewX: 0, transformOrigin: \"top left\", ease: \"power1.out... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION getAfricanPolePath Description: gets the APWP of the African continent for three reference frames. Input: type (reference frame) Output: Object containing data for pole position (age, error, latitude, and longitude) | function getAfricanPolePath(type) {
var refFrame = referenceFrames[type];
return {
'age': refFrame.age,
'A95': refFrame.A95,
'plong': refFrame.plong,
'plat': refFrame.plat
}
} | [
"function getRotatedPole (APWP, i) {\n\t\t\n // Find co-latitudes and do conversions to radians\n var coLatEuler = (90 - APWP.lat[i]);\n var phiEuler = APWP.lon[i] * RADIANS;\n\t\n var coLatPole = (90 - APWP.africanPolePath.plat[i]);\n var thetaEuler = coLatEuler * RADIANS;\n \n var rotationAngle = APWP.rot[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all post modals to keep them from accumulating at the top of the DOM | function flushPostModals(){
existingModals = $('body>.post-modal');
existingModals.each(function(oldModal){
$(this).remove();
});
} | [
"function cleanupModals() {\n var maximumModals = window.SimpleModalOptions.maximumModals;\n if(typeof maximumModals === 'number') {\n maximumModals = parseInt(maximumModals);\n if(maximumModals > 0) {\n var allModals = document.getElementsByClassName('simple-modal');\n var allModalBac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines whether or not the given string is a property metadata string. See storeBindingMetadata(). | function isPropMetadataString(str) {
return str.indexOf(INTERPOLATION_DELIMITER) >= 0;
} | [
"function isProperty(str) {\r\n\tpropertyStrings=str.match(propertyPattern);\r\n\tif (propertyStrings==null || propertyStrings.length==0) {\r\n\t\treturn false;\r\n\t} else {\r\n\t\tpropertyIndex=str.indexOf(propertyStrings[0]);\r\n\t\tfor (strIndex=0;strIndex<propertyIndex;strIndex++) {\r\n\t\t\tif (str.charAt(str... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function send fetch request to get Email template for StockMailDistributionTask | function fetchEmailTemplate() {
fetch(apiCommonSettingsUrl + '/stock_email_distribution_template').then(function (response) {
if (response.status === 200) {
response.json()
.then(emailTemplate => $('#editTemplateSummernote').summernote('code', emailTemplate.textValue))
}
... | [
"function getEmail() {\n\tif(window.DEBUG) {\n\t\tinitEmails(getTestData());\n\t}\n\telse {\n \n emailModule.fetchingEmails = true;\n var emailAction=\"getEmail\";\n \n if(window.DEMO) \n emailAction=\"getDemoEmail\";\n //console.log(emailAction);\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sync the reviews periodically | syncReviews() {
let self = this;
if (navigator.onLine) {
self._syncReviews();
}
window.setTimeout(self.syncReviews, self.SYNC_TIMEOUT);
} | [
"static async syncReviews () {\r\n try {\r\n // Ping server to check for connection\r\n const ping = fetch(DBHelper.DATABASE_URL_REVIEWS)\r\n const pong = await (await ping)\r\n if (pong.ok === true) {\r\n // Fetch data from server\r\n const serverReviews = await (await ping).js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SCROLLSPY PLUGIN DEFINITION =========================== | function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.scrollspy');var options=(typeof option==='undefined'?'undefined':_typeof(option))=='object'&&option;if(!data)$this.data('bs.scrollspy',data=new ScrollSpy(this,options));if(typeof option=='string')data[option]();});} | [
"function scrollbarResponsive() {\n\n // Calls in the smooth scroll plugin\n class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {\n static pluginName = \"horizontalScroll\";\n\n// Converts vertical to horizontal\n transformDelta(delta, fromEvent) {\n if (!/wh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw normal view gene for specified member and protein id | function dispGenesForMember_id(div, cigar, member_id, protein_id, ref_cigar) {
var gene;
if (ref_cigar) {
gene = syntenic_data.member[member_id];
} else {
gene = syntenic_data.member[member_id];
}
var svg = jQuery(div).svg("get")
var maxLentemp = jQuery(window).width() * 0.6;
... | [
"function draw_genomebev_1(key)\n{\n// show genome location of one subfam\n var clst=apps.gg.chrlst;\n var vobj=apps.gg.view[key];\n var chr2xpos={};\n for(var i=0; i<clst.length; i++) {\n var c=vobj.bev.chr2canvas[clst[i]];\n var ctx=c.getContext('2d');\n ctx.clearRect(0,0,c.width,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create graticule as a polyline dataset | function createGraticule(P, outlined, opts) {
var interval = opts.interval || 10;
if (![5,10,15,30,45].includes(interval)) stop('Invalid interval:', interval);
var lon0 = P.lam0 * 180 / Math.PI;
var precision = interval > 10 ? 1 : 0.5; // degrees between each vertex
var xstep = interval;
var yst... | [
"initDrawing() {\n\n var puntos = []; //Crea un array de elementos LatLng\n //Formato coordenada geoJSON es (lng,lat): -6.069794,43.389283,55 \n this.coordinates.forEach(coordinate => {\n puntos.push(new google.maps.LatLng(coordinate[1], coordinate[0])) //Cogemos el primer y segundo elemento que corre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
d3.xhr = function(url, mimeType, callback) | function d3_json(request) {
return JSON.parse(request.responseText);
} | [
"function xhr( type, url, callback, error ) {\r\n\r\n $.ajax({\r\n type: type,\r\n url: url,\r\n success: function(data) { callback(data); },\r\n error: error\r\n });\r\n}",
"function xhr( type, url, callback, error ) {\n\n $.ajax({\n type: type,\n url: url,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
jslint white: false split a Klingon word into syllables | function splitSyllable(word) {
var type = Object.prototype.toString.call(word).slice(8, -1);
if (type !== "String") {
throw new TypeError("Function splitSyllable must be called " +
"on string (not " + type.toLowerCase() + ")");
}
return word.split(/(?=(?:[bDHj... | [
"function splitSyllable(word) {\n var type = Object.prototype.toString.call(word).slice(8, -1);\n if (type !== \"String\") {\n throw new TypeError(\"Function splitSyllable must be called \" +\n \"on string (not \" + type.toLowerCase() + \")\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when the modal is closed, we check if the user has filled out anything on the form if they have, we render a confirmation modal to make sure they do not accidentally abandon their changes | onModalClose() {
let isFormDirty = false;
forOwn(this.props.newReview, (value, key) => {
if (key === 'companyId') return;
if (key === 'tagIds' && !this.props.newReview['tagIds'].length) return;
if (value !== newReviewTemplate[key]) {
isFormDirty = true;
return;
}
});
... | [
"closeConfirmationModal() {\n this.showActionModal = false;\n this.errors = new Errors()\n }",
"cancelFormConfirm() {\n $('#deletePasswordConfirm').modal('hide');\n }",
"closeBorrowingCreationModal() {\n if (!this.borrowingCreationRequest.isProcessin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolve the chunk (a slice of block inventory) by using the given peer. You should also pass the block inventory to which the chunk belongs. | _resolveChunk(chunk, peer, blockInv) {
peer.sendJson(
getDataPartial({
merkleDigest: blockInv.merkleDigest,
blocks: chunk.ids
})
);
chunk.timestamp = getCurTimestamp();
chunk.peer = peer;
} | [
"function resolve (ipfsBlock, path, callback) {\n waterfall([\n (cb) => util.deserialize(ipfsBlock.data, cb),\n (ethObj, cb) => resolveFromEthObject(ethObj, path, cb)\n ], callback)\n }",
"async fetchBlock (cid) {\n // found is either the block or a promise of the block.\n const found = thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the lowercase value of the input string | function lowercase(input) {} | [
"function lower_case(input_string) { return input_string.toLowerCase(); }",
"function makeLowerCase(str) {\n // implement\n}",
"function lowercase(string) {\n\t return string.toLowerCase();\n\t }",
"function lowerCase() {\n var userInputLowerCase = userInput.toLowerCase()\n return userInputLo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. create a variable named score and set it to 0. 3. iterate throw the throw keys, and add compute(throwkey, throwvaue) at each step, to sum. 4. return score. see dices2.js for alternative solution | function score(dices) {
var diceCount = getCount(dices);
var score = 0;
dices = Object.keys(diceCount).map(Number);
var i;
var dice;
for (i = 0; i < dices.length; i++) {
dice = dices[i];
score += computeScore(dice, diceCount[dice]);
}
return score;
} | [
"function evaluateScore( ) {\r\n\r\n\t// Set total score to 0\r\n\tvar score = 0;\r\n\r\n\t// Loop over all dices in the yahtzeeModel\r\n\tyahtzeeModel.dices.forEach( function( value ) {\r\n\r\n\t\t// When a new dice is created, it hasn't got a value yet\r\n\t\t// Check if the dice has a value, if so add value to t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a user first logins in, update the navbar to reflect that. | function updateNavOnLogin() {
console.debug("updateNavOnLogin");
$navMainLinks.show();
$navLogin.hide();
$navLogOut.show();
$navUserProfile.text(`${currentUser.username}`).show();
} | [
"function updateNavOnLogin() {\n\tconsole.debug('updateNavOnLogin');\n\t$('.main-nav-links').show();\n\t$navLogin.hide();\n\t$navLogOut.show();\n\t$navUserProfile.text(`${currentUser.username}`).show();\n}",
"function updateNavOnLogin() {\n\tconsole.debug('updateNavOnLogin');\n\t$('.main-nav-links').show();\n\t$n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is called when the user visits the watchlist page and it shows the films image and title which can be clicked on | function showWatchlist(films) {
var localWatch = JSON.parse(localStorage.getItem("watchlist"));
for (var i=0;i<localWatch.length;i++) {
document.getElementById("ListWatch").innerHTML+="<a href='filmdetails.html#"+localWatch[i]+"'><div class='one large-6 columns'><img class='watchImg' src='../img/"+films[localWatc... | [
"function ShowMovie(element, e) {\n var newPageHtml =\n '<p><img src=\"' +\n imageBaseUrl +\n element.poster_path +\n '\" alt=\"' +\n element.original_title +\n '\"/></p>';\n newPageHtml += \"<p><h1>\" + element.original_title + \"</h1></p>\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a Slate point from a DOM selection's `domNode` and `domOffset`. | toSlatePoint(editor, domPoint) {
var [nearestNode, nearestOffset] = normalizeDOMPoint(domPoint);
var parentNode = nearestNode.parentNode;
var textNode = null;
var offset = 0;
if (parentNode) {
var voidNode = parentNode.closest('[data-slate-void="true"]');
var leafNode = parentNode.close... | [
"toSlatePoint(editor, domPoint, options) {\n var {\n exactMatch,\n suppressThrow\n } = options;\n var [nearestNode, nearestOffset] = exactMatch ? domPoint : normalizeDOMPoint(domPoint);\n var parentNode = nearestNode.parentNode;\n var textNode = null;\n var offset = 0;\n\n if (parentN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exported HTMLGenerator / Hardcoded badge width | static get BADGE_WIDTH() { return 18; } | [
"function fox_badge_width(){\n\tmid_width = $('.mid_width').width();\n\t$('.text').width(mid_width);\n}",
"function bsBadge(){return _callWithEmphasis(this, oj.span, 'badge', 'default', arguments)}",
"generateHandlerLengthStyle () {\n const { handleHeight } = this.props;\n\n return this.generatePercentStr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the impact of a bullet velocityVelocity of bullet in order to calculate push back hitBodyPartsList of hit body parts (childobjects of zombieGameObject) | function impact(impactObject : GameObject, power : float, velocity : Vector2, hitBodyParts : List.<GameObject>) {
if (impactObject != null) {
if (impactObject.CompareTag("zed")) {
zedStrike.incrementBulletsHit();
}
}
damage(power);
//slowBloodSpawner.transform.position = transform.position;
//slowBloo... | [
"handleBullet() {\n //if the bullet is active, run the code\n if (this.bulletIsActive === true) {\n //create variable for finding distance to target\n let bulletToTarget = dist(this.bullet.x, this.bullet.y, this.targetX, this.targetY);\n //If the bullet is close enough to the target, reset it a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a frisby POST test. contains the following fields: testname Test name testFilename Filename containing test url Request URL jsonBody Request body headers Request headers expectStatus Expected response code | function PostJson(params) {
function dumpRequest(params) {
console.log("------------------------------------------------------");
console.log(params.testname);
if (params.testFilename) {
console.log("(FROM " + params.testFilename + ")");
}
console.log("-----------... | [
"function test1(json) {\n\n\t// Add to ID so we can PATCH later\n\tform.append('PlaylistId', json.PlaylistId);\n form.append('PlaylistUploadToken', json.PlaylistUploadToken);\n\n\tfrisby.create('Log/Hashtag Test Part 1: POST Audio to Clyp.it upload staging')\n\t .post(POST_URL,\n\t form,\n\t {\n\t json: fa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ProposedMicroformat extends Microformat / Constructor | function ProposedMicroformat(id,name,microformatsManager) {
this.id = id;
this.name = name;
this.type = 'proposed';
this.microformatGroups = [];
this.microformatsManager = microformatsManager;
this.pluginContext = microformatsManager.getPluginContext();
this.webPageDomContext = microformatsManager.getWebPa... | [
"function AdoptedMicroformat(id,name,microformatsManager) {\n\tthis.id = id;\n\tthis.name = name;\n\tthis.type = 'adopted';\n this.microformatGroups = [];\n\tthis.microformatsManager = microformatsManager;\n\tthis.pluginContext = microformatsManager.getPluginContext();\n this.webPageDomContext = microformatsM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sliceBuffer take the first x items out of array and returns them for your use | function _sliceBuffer(amount) {
var newBuffer = _itemsWaitingToBeRendered.slice(amount, _itemsWaitingToBeRendered.length);
var returnedObjArray = _itemsWaitingToBeRendered.slice(0, amount);
_itemsWaitingToBeRendered = newBuffer;
return returnedObjArray;
} | [
"function BufferSlice(start,end){var len=this.length;return start=clamp(start,len,0),end=clamp(end,len,len),augment(this.subarray(start,end))}",
"slice(n=1) {\r\n\t\treturn this.buffer.slice(this.skip(n), this.i);\r\n\t}",
"getSlice (start, length) {\n return new SliceBuffer(start, length, this)\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take Emulated Retina Screenshot | function takeEmulatedRetinaScreenshot({
resolution, image, driver, shouldEmulateRetina, scrollWait
}) {
if (!shouldEmulateRetina) { return image }
let gImage2
let gImage1Metadata
return Promise.resolve()
.then(() => {
sharp(image)
.metadata()
.then(metadata => { gImage1Metadata = m... | [
"function retinaEnable () {\n\tif (window.devicePixelRatio) {\n\t\t$(canvas).attr('width', canvasWidth * window.devicePixelRatio);\n\t\t$(canvas).attr('height', canvasHeight * window.devicePixelRatio);\n\t\t$(canvas).css('width', canvasWidth);\n\t\t$(canvas).css('height', canvasHeight);\n\n\t\tcanvasWidth *= window... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get base type of node | function getNodeType(node) {
const tsNode = service.esTreeNodeToTSNodeMap.get(node);
const type = typeChecker.getTypeAtLocation(tsNode);
return getBaseType(type);
} | [
"function getCurrentNodetype()\n{\n var nodetypeobj = get_object(\"atknodeuri\");\n if (nodetypeobj)\n {\n // IE works with .value, while the Gecko engine uses .innerHTML\n if (nodetypeobj.value)\n {\n var nodetype = nodetypeobj.value;\n }\n else if (nodetypeob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a card associated with a label having an issue number | function removeCard(fromLabel, issueNumber) {
var card = '#'+ fromLabel + '-' + issueNumber;
$(card).remove();
} | [
"function removeLabel( label, issue, authenticity_token ) {\n var data = {};\n data.issue = issue;\n data.comment = { body: 'Removed label \"' + label +'\"' };\n data.authenticity_token = authenticity_token;\n $.post( WWW+'/issue_comments', data );\n }",
"function removeLabelToCard( cardId, labelI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves a variable with the given name at the specified line to its value. If null is returned, then the variable has been defined but no value was given. If undefined is returned, then a variable with the given name has not been defined yet as of the given line. | resolveVariable(variable, line) {
let envs = this.getENVs();
for (let i = envs.length - 1; i >= 0; i--) {
if (envs[i].isBefore(line)) {
for (let property of envs[i].getProperties()) {
if (property.getName() === variable) {
return pr... | [
"function lookupVariable(name,index) {\n if (typeof locals[name] == \"undefined\") {\n if (block != null)\n return block.lookupVariable(name,index);\n\n return null;\n }\n\n if (typeof index != 'undefined')\n return locals[name][index];\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch betwwen concordance and KWIC reports | function concordance_kwic_switch(db_url) {
$("#report_switch").on("change", function() {
$('.highlight_options').remove();
var switchto = $('input[name=report_switch]:checked').val();
var width = $(window).width() / 3;
$("#waiting").css("margin-left", width).show();
$("#waiti... | [
"function status(res,type) {\n let dataEntries = []\n // Recursively call Desk until there are no more pages of results\n let i = 1\n function getOpenCases() {\n desk.cases({\n labels:['Priority publisher,SaaS Ads,Direct publisher,Community publisher,Home,Community commenter'], \n sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unsubscribe an event handler from a particular event. | _unsubscribe(eventType, eventHandler) {
if (this.handlersMap[eventType] && eventHandler) {
this.handlersMap[eventType].delete(eventHandler);
}
if (!eventHandler || this.handlersMap[eventType].size === 0) {
delete this.handlersMap[eventType];
}
if (O... | [
"unsubscribe (event, handler) {\n if(event in EventBus.instance.listeners) {\n let index = this.findHandler(event, handler);\n\n // We are going to find the handler and remove it from the array.\n if(index !== -1) {\n EventBus.instance.listeners[event].splice(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the collection of comments associated with this list item | get comments() {
return new Comments(this);
} | [
"get comments() {\n this._logger.debug(\"comments[get]\");\n return this._comments;\n }",
"get comments() {\n this._logService.debug(\"gsDiggStoryDTO.comments[get]\");\n return this._comments;\n }",
"get comments() {\n return splitComments(this._comments)\n }",
"function getComments() {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
minimize_fundamental2homography returns the matrix M as bellow which minimizes the norm || M_3x3 . R_3x3 Id_3x3 ||^2 ( a b c ) M_3x3 = ( 0 e f ) ( 0 h i ) ( R00 R10 R20 0 0 0 0 ) ( 1 ) ( R01 R11 R21 0 0 0 0 ) ( a ) ( 0 ) ( R02 R12 R22 0 0 0 0 ) ( b ) ( 0 ) ( 0 0 0 R10 R20 0 0 ) ( c ) ( 0 ) ( 0 0 0 R11 R21 0 0 ) ( e ) (... | function minimize_fundamental2homography_right(R){
require(rows(R)==3 && cols(R)==3, "minimize_fundamental2homography_right expects a 3x3 matrix");
var A = mtx_make(9,7);
mtx_set_slice(A,0,0,mtx_trsp(R));
mtx_set_slice(A,3,3,mtx_trsp(mtx_get_slice(R,1,0,2,3)));
mtx_set_slice(A,6,5,mtx_trsp(mtx_get_slice(R,1,0,... | [
"function minimize_fundamental2homography_left(RL, MR) {\n\tvar x1=100, y1=100, x0=0, y0=0;\n\trequire(rows(RL)==3 && cols(RL)==3 && rows(MR)==3 && cols(MR)==3, \"minimize_fundamental2homography_left expects 3x3 matrices\");\n\t\n\tvar M3 = mtx_2_vec(mtx_get_slice(MR, 2,0, 1,3)); // third line of MR ie ( 0 h i )\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct the string that will be signed. | function buildStringToSign(self, ws) {
ws.credentialScope = [
amzDate(ws.signDate, true),
self.config.region,
self.config.service,
'aws4_request'
].join('/')
ws.stringToSign = [
'AWS4-HMAC-SHA256',
amzDate(ws.signDate),
ws.credentialScope,
self... | [
"function compileStringToSign () {\n var s = \n verb + '\\n'\n (md5 || '') + '\\n'\n (contenttype || '') + '\\n'\n date.toUTCString() + '\\n'\n canonicalizeAmzHeaders(amzheaders) + \n canonicalizeResource()\n return s\n }",
"function buildStringToSign(self, ws) {\n ws.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the going to upload document | function removeUploadingDocument(cancel) {
if (cancel == 1) {
if (self.isGlobal)
$state.go('intakedocuments');
else
$state.go('intake-documents', { intakeId: matterId });
}
if (self.dropzoneObj) {
... | [
"function removeUploadingDocument(cancel) {\n if (globalConstants.webSocketServiceEnable == true) {\n connectionCloseForSocket();\n }\n if (self.editdropzoneObj) {\n fileCount = 1;\n self.editdropzoneObj.removeAllFiles();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expected Result: Mean: 34.928571428571 Median:5.5 Mode: 2 | function mmm(arr) {
var n = arr.length;
var sum = 0;
var mean = [];
var median = [];
var mode = [];
var arrOfFrequencies = [];
// ----------------------------
// finding the mean -- start --
// handle mean calc
for (i of arr) {
sum += i;
}
// finding the mean -- end --
// ---------------... | [
"function meanmedianmode(arr) {\n sum = 0;\n var mean;\n var mode;\n n = arr.length;\n var median, k;\n var m = 3;\n for (var i = 0; i < arr.length; i++) {\n sum = sum + arr[i];\n mean = sum / arr.length;\n }\n console.log(\"mean = \" + mean);////\n {\n k = parseIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
now we require the constructor logic for the enemies missile how would they attack? | function AttackMissile( targets ){
var startX = random(CANVAS_W, 0),
startY = 0, //because the attacking missiles will always start at the top of the page
//we then want to add a bit of variation in missiles so we'll add speed variation
changeSpeed = random(80, 120) / 100,
//since we're adding va... | [
"attack(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y);\n // if within range, no target acquired, not dead, and the enemy is alive\n // TARGET THE ENEMY\n if (d < 300 && this.targetId < 0 && !this.dead && !enemy.dead) {\n this.targetId = enemy.uniqueId;\n this.obtainedTarget = true;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions // ////////////////////////// This function creates a random date to be passed to the NASA APOD archive via the API when the grabImage function is run. | function imageAdvance(){
var YYYY = Math.floor(Math.random() * (2016 - 2000 + 1) + 2000);
var MM = Math.floor((Math.random() * 10) + 1);
if (MM < 10) {
MM = "0" + MM;
} else {
MM = MM;
}
var DD = Math.floor((Math.random() * 28) + 1);
if (DD... | [
"function randomDateString(){\n\n //Create data objects for yesterday, and APOD start date\n var today = moment().subtract(1, 'days');\n var APODstart = moment('1995-06-16');\n\n //Convert to Unix time - milliseconds since Jan 1, 1970\n var todayUnix = today.valueOf();\n var APODstartUnix = APODstart.valueOf(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Best Practice: Constructor functions are the only variables that start with an uppercase letter The keyword this refers to a single instance When calling or invoking a constructor function you must use the new keyword Write a CellPhone constructor function that accepts the following arguments (string: brand, number: sc... | function CellPhone(brand, sc, c) {
this.brand = brand
this.screensize = sc
this.carrier = c
} | [
"function CellPhone(brand, screenSize, carrier) {\n this.Brand = brand\n this.ScreenSize = screenSize\n this.Carrier = carrier\n}",
"function CellPhone(manufacturer, model, color, price)\n{\n this.manufacturer = manufacturer;\n this.model = model;\n this.color = color;\n this.price = price;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show/hide all controls on page (to make a screenshot without editor buttons) | function showEditorControls(show) {
let controls_collection = document.getElementsByClassName('editor-controls');
for(let i = 0; i < controls_collection.length; i++)
{
if(show === false) {
controls_collection[i].style.display = 'none';
}
else {
controls_colle... | [
"enableControls()\n\t{\n\t\tDom.removeClass(document.body, 'landing-ui-hide-controls');\n\t}",
"function toggleControls(){\n\t\t\t\t\t\t\t\t\n\t\tif(g_temp.isControlsVisible == false)\n\t\t\tshowControls();\n\t\telse\n\t\t\thideControls();\n\t}",
"hideControls() {\n this.showControlPrevious(false);\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make request for docker build API | async build(path) {
try {
let response = await httpGitRequest('/docker/build', 'POST', {
top_repo_path: path
});
if (response.status !== 200) {
const data = await response.json();
throw new ServerConnection.ResponseError(respons... | [
"function DockerBuildWithContainer() {\n var build = \"sudo docker build -t dotnetapp-dev .\";\n var run = \"sudo docker run --rm dotnetapp-dev Hello from Docker\";\n}",
"buildImage(buildInfo, volumeMapping) {\n const method = 'buildImage'\n const registryConfig = global.REGISTRY_CONFIG\n assert(buildI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get's all values from passed sheet (worksheet, not spreadsheet which contains worksheets). Returns 2dimensional array | function getValuesFromSheet(sheet) {
var range = sheet.getDataRange();
var values = range.getValues();
Logger.log('Read sheet "' + sheet.getName() + '": rows=' + values.length + ' cols=' + values[0].length);
return values;
} | [
"function getValuesFromSheet(sheet) {\n var range = sheet.getDataRange();\n var values = range.getValues();\n Logger.log('Read sheet: ' + sheet.getName() + ' rows=' + values.length + ' cols=' + values[0].length);\n return values;\n}",
"function getSheet_(sheet, startOffsetX, startOffsetY, endOffsetX, endOffse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exercise 5 Create a function `getOppositeNumber` that takes a number as a param and returns an opposite number | function getOppositeNumber(number){
return(-number);
} | [
"function opposite(number) {\n return (number - (number * 2))\n}",
"function opposite(number) {\n return number * -1\n}",
"function opposite(number) {\n return (-number)\n}",
"function opposite(number) {\n return - number\n}",
"function oppositeTo(inputNumber, numberToBeOppositeTo) {\n \n \"use strict... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set state of Save and Run Now buttons based on hasUnsavedChanges | function setButtonStates() {
var $scanButton = $(instancePage.onDemandScanBtn);
var $butrButton = $(instancePage.onDemandButrBtn);
var $saveButton = $('.save-btn');
var tooltip = "Save changes to enable";
$scanButton.removeClass('inactive').prop('disabled', false).removeAttr('title');
... | [
"function setButtonStates() {\n var $saveButton = $('.save-btn');\n\n if (AlmCommon.getHasUnsavedChanges()) {\n $saveButton.removeClass('inactive').prop('disabled', false);\n } else {\n $saveButton.addClass('inactive').prop('disabled', true);\n }\n }",
"function checkSaveStatu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach mouse events to example choices for allowing clippy button to display on hover and otherwise return to intial hidden state | function handleChoiceHover() {
for (let i = 0, l = exampleChoices.length; i < l; i++) {
const choice = exampleChoices[i];
const copyBtn = choice.querySelector(".copy");
copyBtn.setAttribute("aria-label", "Copy to clipboard");
choice.addEventListener("mouseover", () => {
copyBtn.setA... | [
"function addAcceptState()\n{\n document.getElementById(\"addState\").disabled = true;\n document.getElementById(\"addAcceptState\").disabled = true;\n document.body.style.cursor = \"pointer\";\n\n canvas.on('mouse:down', function(options) {\n drawAcceptState(options);\n\n });\n document.bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scales the tip text to fit within the box | function scaleTipText(){
var length = tip.node().getComputedTextLength();
// rescale text accordingly
if (length > donutWidth){
tip.style("font-size", Math.round(length/30))
} else {
tip.style("font-size", 11)
}
} | [
"function scaleText(self) {\n d3.select(self).selectAll('.node-label')\n .each(function(d) {\n // Available width depends on size of icon\n var iconNode = this.parentNode.querySelector('.node-icon:not(.hide)'),\n iconWidth = iconNode ? iconNode.getB... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
variables to modify per level: gameState.bulletsRemaining, gameState.numOfBarriers, gameState.blocks, gameState.barriers | create() {
//IMPORTANT LEVEL VARIABLES (change for each level if needed)
//bulletsRemaining tracks how many bullets the player has in this level
gameState.bulletsRemaining = 5;
//numOfBarriers specifies how many barriers there are to activate to complete the level
gameState.numOfBarriers = 3;
//INITIAL... | [
"updateLevel() {\n this.level = this.computeLevel()\n this.maxEnergy = this.computeMaxEnergy()\n\n // check to see if any stats are unlocked\n if (this.getStat(STATS.LEG) < 1 && this.level >= LEG_UNLOCK_LEVEL) this.setStat(STATS.LEG, 1)\n if (this.getStat(STATS.ARM) < 1 && this.level >= ARM_UNLOCK_LE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method that sets the hover property to false | hideDescription() {
this.hover = false;
} | [
"onunhover() {\n this.hover = false;\n }",
"unhover() {\n if (!this._isHovering) {\n return;\n }\n\n this._isHovering = false;\n }",
"function hoverHide() {\r\n\t\t\thover.style.visibility = \"hidden\";\r\n\t\t}",
"invalidateHovering() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called by looper timer in order to track gamepad's buttons. | function trackButtons () {
var gamepad = navigator.getGamepads()[ index ];
var total = gamepad.buttons.length;
var i, pressed;
for (i = 0; i < total; i++) {
pressed = self.isButtonPressed(gamepad.buttons[ i ]);
if (pressed != self.isButtonPressed(buttonsLastState[ i ])) {
... | [
"function button4pressed(){\n time_offset -= DateUtils.HOUR_MILLIS/4;\n draw_clock();\n setTimeout(()=>{\n if(BTN4.read()){\n button4pressed();\n }\n },\n 50\n )\n}",
"function ButtonTimerAll() { }",
"function EndOfHandUpdateButtons()\n{\n DRAW_BUTTON.disabled = true\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replaces the given row and column of the array with zeros | function zero(arr, row, col) {
for (let i = 0; i < arr[row].length; i++) {
arr[row][i] = 0;
}
for (let j = 0; j < arr.length; j++) {
arr[j][col] = 0;
}
} | [
"function setZeros(matrix) {\n var rows = new Array(matrix.length);\n var column = new Array(matrix[0].length);\n\n for (var i = 0; i < rows.length; ++i) {\n for(var j = 0; j < column.length; ++j) {\n if(matrix[i][j] === 0) {\n rows[i] = true;\n column[j] = true;\n }\n }\n }\n for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add puppy validation check function, check to see if array is full, | function puppyValidationCheck(puppyName, puppyID) {
var errorArray = [];
var puppyNameTrimmed = puppyName.trim();
var puppyIDTrimmed = puppyID.trim();
//puppy name validations
if (puppyNameTrimmed === '') {
errorArray.push("Name cannot be blank.");
}
//puppy ID validations
if (puppyIDTrimmed === '') ... | [
"validateArraySize (req, array) {\n const FREEMIUM_INPUT_SIZE = 20\n const PRO_INPUT_SIZE = 20\n\n if (req.locals && req.locals.proLimit) {\n if (array.length <= PRO_INPUT_SIZE) return true\n } else if (array.length <= FREEMIUM_INPUT_SIZE) {\n return true\n }\n\n return false\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds class to parent element so that styles are applied correctly Adds ngapp attribute. This is the same module name provided in the assetcache.js | function applyAngularAttributesToParentElement(html, demo) {
var tmp;
// Grab only the DIV for the demo...
angular.forEach(angular.element(html), function(it,key){
if ((it.nodeName !== 'SCRIPT') && (it.nodeName !== '#text')) {
tmp = angular.element(it);
}
});
tmp.addCla... | [
"function applyAngularAttributesToParentElement(html, demo) {\n var tmp;\n\n // Grab only the DIV for the demo...\n angular.forEach(angular.element(html), function(it,key){\n if ((it.nodeName != \"SCRIPT\") || (it.nodeName != \"#text\")) {\n tmp = angular.element(it);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sorts terminal list by title and resets distance | function resetList() {
settings.terminals.sort(function (a, b) {
a.distance = false;
b.distance = false;
return a[0].localeCompare(b[0]);
});
} | [
"sortTwitsByText( ) {\n this.twits.sort( (a, b) => {\n \n if (this.switchPosition == \"normal\");\n if (a.text > b.text) {\n return 1;\n }\n if (a.text < b.text) {\n return -1;\n }\n if (this.switchPosition == \"rever... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resolveTodo :: Generator Todo?> | *resolveTodo(todoID) {
return this.todos[todoID];
} | [
"function givenTodo(todo) {\n const data = Object.assign({\n title: 'do a thing',\n desc: 'There are some things that need doing',\n isComplete: false,\n todoListId: 999,\n }, todo);\n return new models_1.Todo(data);\n}",
"createNewTodo(post) {\n let self = this;\n self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rejection sample a result from computation that satisfies all conditioning expressions. Note: doesn't work if the desired log probability is higher than the probability of generating the state by running the program forwards (such as with a factor statement) | function rejectionSample(computation)
{
var tr = trace.newTrace(computation)
while (Math.log(Math.random()) > tr.logprob - tr.genlogprob) {
tr = trace.newTrace(computation)
}
return tr.returnValue
} | [
"function randMissOrGoal() {\n return Math.random() > 0.2;\n}",
"function generatePracticeCondition() {\n return _.sample(jsSART.CONDITIONS.PRACTICE);\n}",
"function rejectionSample(nSamples, poolSize, random) {\n var result = zeros(nSamples);\n\n for (var i = 0; i < nSamples; i++) {\n var rejectSample... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if input is permutation of a palindrome For definition of a palindrome, see: | function isPalindromePermutation(str){
//Track even-ness of letters
var bits = 0;
//For every character in the input string
//Get the character's ASCII code and update bits
var strLen = str.length;
for(var i = 0; i < strLen; bits = bits ^ (1 << (str.charCodeAt(i++) - 97))){}
//Check if palindrome... | [
"function isPermPalendrome(string) {\n\tlet s = string.replace(/\\s/g, '');\n\tlet outcome = allPermutations('', s).some((perm) => {\n\t\tif (isPalendrome(perm)) {\n\t\t\treturn true;\n\t\t}\n\t});\n\treturn outcome ? outcome : false;\n}",
"function hasPalindromePermutation(theString) {\n\n // Check if any permu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set new contents for the infobox. This will replace the HTML of the infobox element and then cause :js:meth:`render` to be called. Args: html (string): The new HTML to set. | setContents(html) {
this.$el.html(html);
this.render();
} | [
"function setContent(html) {\r\n modalContent.innerHTML = html;\r\n }",
"function setHTML(id, html) {\n getEl(id).innerHTML = html;\n }",
"setHTML(html) {\n this.html = html;\n document.body.innerHTML = this.html;\n }",
"function updateHtmlView(html) {\n\tdocument.getElementById (\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
highlight clicked parking facility | function highlightParking(e) {
var layer = e.target;
if (Temp != null) ClearHighlight();
Temp = e.target;
layer.setStyle({color: "#C9C8C7", fillOpacity : 0.7});
if (!L.Browser.ie && !L.Browser.opera) { layer.bringToFront(); }
} | [
"function highlight(selectedTower){\n var location = selectedTower.location + \" \" + selectedTower.topDisk;\n if (selectedTower.highlighted){\n $(location).removeClass(\"highlight\");\n selectedTower.highlighted=false;\n }\n else{\n $(location).addClass(\"highlight\");\n selectedTower.highlighted=t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the wish list buttons section in HTML with the current courses in the wish list | updateButtons(){
// Checks if the wish list is empty and then hides and shows the appropriate sections.
// Adds wish list buttons if applicable
if (Object.keys(this.wish_list).length === 0){
$('#empty_wish_list').show();
$('#wish_list').hide();
} else {
... | [
"function setWishlist() {\n for (let i = 0; i < wishlist.length; i++) {\n // to see if the wish is met\n let checked = wishlist[i].done === true ? 'checked': '';\n $('#wishlist-inner').append(`<p class=\"wish-labels\">${wishlist[i].description}</p>`);\n }\n}",
"function wishlist_ui_edit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a BLAKE2b hashing context Requires an output length between 1 and 64 bytes Takes an optional Uint8Array key | function blake2bInit (outlen, key) {
if (outlen === 0 || outlen > 64) {
throw new Error('Illegal output length, expected 0 < length <= 64')
}
if (key && key.length > 64) {
throw new Error('Illegal key, expected Uint8Array with 0 < length <= 64')
}
// state, 'param block'
const ctx = {
b: new Ui... | [
"function blake2bInit (outlen, key) {\n if (outlen === 0 || outlen > 64) {\n throw new Error('Illegal output length, expected 0 < length <= 64')\n }\n if (key && key.length > 64) {\n throw new Error('Illegal key, expected Uint8Array with 0 < length <= 64')\n }\n\n // state, 'param block'\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List the cluster.hadoop.NetworkAcl objects [PRODUCTION] [See on api.ovh.com]( | NetworkACLAssociatedWithThisHadoopCluster(serviceName) {
let url = `/cluster/hadoop/${serviceName}/networkAcl`;
return this.client.request('GET', url);
} | [
"function NetworkAcl() {\n _classCallCheck(this, NetworkAcl);\n\n NetworkAcl.initialize(this);\n }",
"getAcl() {\n return this.acl;\n }",
"async function getClustersList() {\n\tsearch_url = '/vmturbo/rest/search?types=Cluster'\n\tresponse = await fetch(search_url)\n\tclusters = await response.json()\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ ajax_populate_forms() / called on page load. send request for / list of forms | function ajax_populate_forms(){
create_http_request();
var post_params = "ajax_action=get_form_list";
// call method to sent the request
send_http_request(handler_ajax_populate_forms, "POST", target_url, post_params);
} | [
"function handler_ajax_populate_forms(){\n\tif(xmlHttp.readyState == 4 && xmlHttp.status == 200){\n\t\tpopulate_list_from_xml(xmlHttp.responseText, 'form_list');\n\t}\n}",
"function ajax_get_forms(){\t \n\tvar post_params = \"ajax_action=get_forms\";\n\tcreate_http_request();\n\tsend_http_request(handler_get_form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to format a number as a currency | function formatCurrency(num) {
return 'PKR ' + (num).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
} | [
"function formatCurrency (num) {\n return (num).toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}",
"formatCurrency(number) {\n return accounting.formatNumber(number, 2, ' ');\n }",
"function formatCurrency(num) {\n return 'PKR ' + (num).toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when the value of the component changes. Will update the aria visibility. / private | function valueChanged()/*:void*/ {
var value/*:**/ = this.bindTo$eT8d.getValue();
var hidden/*:Boolean*/ = !value || value.length === 0;
if (this.component$eT8d.getEl()) {
this.setAriaHidden$eT8d(hidden);
}
} | [
"updateValue() {\n this.value = this.node.wasVisuallyDisplayed( this.display );\n\n // TODO support pdom visibility, https://github.com/phetsims/scenery/issues/1167\n // this.value = this.node.wasVisuallyDisplayed( this.display ) || this.node.isPDOMDisplayed();\n }",
"_initializeAriaValueText() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |