query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
render the best product | function renderBestProduct() {
var bestProduct;
var temp = 0;
for (var i = 0; i < allItems.length; i++){
if (allItems[i].votes > temp) {
temp = allItems[i].votes;
console.log('the best', temp);
bestProduct = allItems[i];
console.log ('the best product', bestProduct);
}
... | [
"function renderProduct() {\n productGenerator();\n var productOne = selectedProductArray[0];\n var productTwo = selectedProductArray[1];\n var productThree = selectedProductArray[2];\n\n productImgOneEl.src = productsArray[productOne].src;\n productImgOneEl.alt = productsArray[productOne].name;\n productsAr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function stater that sets the price, quantity, and name | constructor(price, quantity, name)
{
this.price=price;
this.quantity=quantity;
this.name=name;
} | [
"function setItemPrice(iPrice) {\n\t\n}",
"function createShopItem(name, price){\n this.name = name;\n this.price = price * 10;\n this.value = price;\n return this\n}",
"function updateProduct(quantity) {\n}",
"constructor(name, price) {\n\t\tthis.name = name;\n\t\tthis.price = price;\n\t}",
"function n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run when a graph tab is deleted. Also checks and sets the edit graph button and global variable | function removeTab(evt){ //accept either the span event object or the panel
var $span = $(evt.target);
var panelRef = $span.parent().children("a").attr("href");
var panelId = panelRef.substr(1);
destroyChartMap(panelId);
$(panelRef).remove();
$span.parent().remove();
delete panelGraphs[panel... | [
"function graph_tab_clicked() {\n // Deselect other tabs\n $('#sim-tab').removeClass(\"active\");\n $('#editor-tab').removeClass(\"active\");\n $('#sim-tools').hide();\n $('#editor-tools').hide();\n // Select graph tab\n $('#graph-tab').addClass(\"active\");\n $('#graph-settings').show();\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
command friendly soldiers to attack selective enemy | function commandSoldiersAttck() {
var enemy = hero.findNearestEnemy();
var soldiers = hero.findByType("soldier", hero.findFriends());
// Loop over all your soldiers and order them to attack.
for (var i = 0; i < soldiers.length; i++) {
var soldier = soldiers[i];
if (enemy && enemy.health ... | [
"function attackEnemy() {\n\tvar enemy = hero.findNearestEnemy();\n\tif (enemy) {\n\t\thero.attack(enemy);\n\t}\n}",
"function RunAI(enemy) {\n\t//attack AI\n\tif (enemy.attackAI == 'calm') {\n\t\tif (enemy.weapon.type == 'charger' && menu == false) {\n\t\t\tif (enemy.charge < enemy.weapon.max_charge) {\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the total stake for a given staker. | getTotalStake(staker) {
const self = this;
assert_1.assert.isString('staker', staker);
const functionSignature = 'getTotalStake(address)';
return {
callAsync(callData = {}, defaultBlock) {
return __awaiter(this, void 0, void 0, function* () {
... | [
"getSelfStake(){\n if(this._self_stake!= undefined){\n return parseFloat((this._self_stake/1000000000000)).toFixed(2);\n }else{\n return 0;\n }\n }",
"function cal_win_stake()\n {\n total = 1;\n $('.match-slip .match').each(function(){\n od... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to extend an array and copy it. This is used to propagate paths recursively. | function copyAndExtendArray(arr, newValue) {
var _context4;
return concat$2(_context4 = []).call(_context4, toConsumableArray(arr), [newValue]);
} | [
"function copyAndExtendArray(arr, newValue) {\n var _context2;\n\n return concat$2(_context2 = []).call(_context2, toConsumableArray(arr), [newValue]);\n}",
"extendTypedArray (array, deltaSize) {\n const ta = new array.constructor(array.length + deltaSize) // make new array\n ta.set(array) // fill it with... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NewtonRaphsonRootFind : Use NewtonRaphson iteration to find better root. | function NewtonRaphsonRootFind(Q, P, u)
{
var numerator;
var denominator;
var Q1 = []; // Q'
var Q2 = []; // Q''
var Q_u;
var Q1_u;
var Q2_u; /*u evaluated at Q, Q', & Q'' */
var uPrime; /* Improved u */
var i;
/* Compute Q(u) */
Q_u = Bezier(3, Q, u);
/* Generate control verti... | [
"function newtonRaphsonRootFind(Q, P, u) {\n var Q1 = new BezierCurve; // Q'\n var Q2 = new BezierCurve; // Q''\n\n // Compute Q(u)\n var Q_u = bezier(3, Q, u);\n\n // Generate control vertices for Q'\n for (var i = 0; i <= 2; i++) {\n Q1[i].x = (Q[i+1].x - Q[i].x) * 3.0;\n Q1[i].y = (Q[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eslintdisable noloopfunc / You're given a list of edges representing an unweighted, directed graph with at least one node. Write a function that returns a boolean representing whether the given graph contains a cycle. For the purpose of this question, a cycle is defined as any number of vertices, including just one ver... | function cycleInGraphDFS(edges) {
const visited = Array(edges.length).fill(false);
const inStack = Array(edges.length).fill(false);
for (let node = 0; node < edges.length; node++) {
if (visited[node]) continue;
const containsCycle = isCyclic(node, edges, visited, inStack);
if (containsCycle) ret... | [
"function cycleInGraph(edges) {\n\tlet visited = new Set();\n\tlet visiting = new Set();\n\tlet found = dfs(0, edges, visited, visiting);\n\tif (found) return true;\n return false;\n}",
"function detectCycleDFS(graph) {\n if (!graph) return false\n const vertices = graph.getVerticeCount()\n const visite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when making a new list Finds specific Lat/Longitude and detailed address | listPlace(){
let google=this.google;
let map=this.map
var service;
// Create the search box and link it to the UI element.
var input = document.getElementById('address');
var searchBox = new google.maps.places.SearchBox(input);
// Bias the SearchBox results towar... | [
"function showAddressSearchBox(){ \n\tvar place = autocomplete.getPlace();\n\tvar point = place.geometry.location;\n\t\n\tnewRideInfo = {};\n\tnewRideInfo.lat = point.lat();\n\tnewRideInfo.lng = point.lng();\n\tnewRideInfo.address = place.formatted_address;\n\tbeginRideCreationPopup(); \n}",
"function search(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2Select a random number from checkNum's items | function numFromCheckNum (){
let index = Math.floor(Math.random()*checkNum.length);
let randomNum = checkNum[index];
checkNum.splice(index,1); //remove selected item from checkNum array
return randomNum;
} | [
"function randomIndexSelector() {\n return Math.floor(Math.random() * (totalItems.length));\n}",
"function pickRandom () {\n $randomSquare = $($li[Math.floor($li.length * Math.random())]).addClass('selected');\n timeOut();\n }",
"function random(itemCount, arraySelectedFrom){\n\n// need to build this whe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the date for the last day of the week based on the given date assuming the specified first day of the week. | function getEndDateOfWeek(date, firstDayOfWeek) {
var lastDayOfWeek = firstDayOfWeek - 1 >= 0 ? firstDayOfWeek - 1 : _dateValues_timeConstants__WEBPACK_IMPORTED_MODULE_0__.TimeConstants.DaysInOneWeek - 1;
var daysOffset = lastDayOfWeek - date.getDay();
if (daysOffset < 0) {
// If last day of week is... | [
"function endOfWeek(date)\r\n {\r\n\r\n var lastday = date.getDate() - (date.getDay() - 1) + 6;\r\n return new Date(date.setDate(lastday));\r\n\r\n }",
"function getLastDateOfWeek(theDate) {\r\n var lastDateOfWeek;\r\n theDate.setDate(theDate.getDate() + 6 - theDate.getDay()+1); //\t \r\n lastDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns token endpoint middleware Used by the client to exchange authorization grant for access token | token() {
logger.debug('Creating token endpoint middleware')
return async (ctx, next) => {
logger.debug('Running token endpoint middleware')
const { request, response } = build(ctx)
await this.server
.token(request, response)
.then(token => {
return this.saveTokenMet... | [
"token() {\n return async (ctx, next) => {\n debug('Running token endpoint middleware');\n const request = new Request(ctx.request);\n const response = new Response(ctx.response);\n\n return this.server.token(request, response)\n .then(token => this.saveTokenMetadata(token, ctx.request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: The transform method should .split("F").join("FXA") instead of use a switch for every character. Would be 3x as fast Update: That maynot be possible if multiple Rules are applied, since the second Rule may transform stuff that was just added by the first rule Recursive function to transform the Axiom character by... | function transform(axiom, rules) {
if (axiom.length >= 1) {
return exchange(axiom.slice(0, 1), rules) + transform(axiom.substring(1, axiom.length), rules);
} else {
return "";
}
} | [
"function transform2(axiom, rules, it) {\n for (let i = 0; i < it; i++) {\n let aux = \"\";\n for (let j = 0; j < axiom.length; j++) {\n aux = aux.concat(exchange(axiom.charAt(j, j + 1), rules));\n }\n axiom = aux;\n // return + transform(axiom.substring(1, axiom.length), rules);\n }\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
perforance credit card pattern detecting and notify | function checkAndNotifyCCMasking(data, question, fieldVal){
if (fieldVal != "" && question && question.type == dataTypes.TEXT || question.type == dataTypes.TEXT_AREA){
var valAfterCCMasking = ccMasking(fieldVal);
if(valAfterCCMasking != fieldVal){
notificationDialog.open(lpCWTagConst.lpMsg_CreditCa... | [
"async function cardDetect() {\n // use the cardPresent() method to detect if one or more cards are in the PCD field\n if (!(await mfrc522.cardPresent())) {\n console.log('No card')\n return reLoop();\n }\n // use the antiCollision() method to detect if only one card is present and return the cards UID\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compute euclidian modulo of m % n | static euclideanModulo (n, m) {
return ( ( n % m ) + m ) % m;
} | [
"function euclideanModulo(n, m) {\n return (n % m + m) % m;\n}",
"euclideanModulo(n, m) {\n\n return ((n % m) + m) % m;\n\n }",
"euclideanModulo(n, m) {\n\n return ((n % m) + m) % m;\n\n }",
"function euclideanModulo(n, m) {\n return ((n % m) + m) % m;\n }",
"function euclideanMod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get for the imaginary z component | get z() {return this._z;} | [
"getZ(i,j) {\r\n var vid = 3*(i*(this.div+1) + j);\r\n return this.vBuffer[vid+2];\r\n \r\n }",
"getZ() {\n return this.n >= 3 ? this.get(2) : 0;\n }",
"get Z() {\n return this.z;\n }",
"bitmapToComplexImaginary(y) {\n\t\treturn this.y1 - this.cheight * y / ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
First function called when the page finishes loading / At first we get the coordinates and the actual city. Then the screen is filled with the 5 most recent posts. / Once the posts are loaded, the Websocket is started, and then we start the Infinite Scroll. | async componentDidMount() {
this.loading = true
try {
await this.TrendingController.getCurrentCity()
const nearbyPosts = await this.TrendingController.getNearbyPosts(
this.coords,
null
)
this.posts = nearbyPosts.data.statuses.map(status =>
this.TrendingController.... | [
"function loadedPosts(e) {\n //don't clear if the url's got a timestamp marker in it, indicating \"load more posts\"\n if (e.target.responseURL.search(\"&before=\") < 0) postgrid.innerHTML = \"\";\n //console.log(e.target.response);\n let json = JSON.parse(e.target.response);\n let postdelay = 0;\n for (const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Routed component allowing to display, create and update products | function ProductsPage({ actions }) {
return (
<WithActions
actions={actions}
title="Products"
itemName="product"
fetchItems={fetchProducts}
saveItem={saveProduct}
renderList={(items, startEdit) => {
return <ProductsList products={items} onStartEdit={startEdit} />;
... | [
"function viewAddedProduct(req, res) {\n res.redirect('/products');\n}",
"OnClick(products){\n console.log(\"product selected\")\n BuySdkManager.presentProductwithId(String(products.product_id));\n console.log(\"product view displayed succesfully\");\n }",
"static getProductAddHandler(req, re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The function is the modified version of the source code of the following Source: Ridgeline plot template in d3.js (D3.js Graph Gallery) URL: Author: Andrew Mollica Date: 2018 | function ridge(regional, CTind, plotnum){
const margin = {top: 60, left: 100, right: 100, bottom: 60};
const height = 500
const width = 450
const svg = select("body")
.append("svg")
.attr("class", "ridge-part" + plotnum)
.attr("align", "right")
.... | [
"function ridgelinePlot(responses) {\n // accessors and pre-processed data\n const data = responses.children;\n const accessorName = d => d.name;\n const accesorValue = d => d.value;\n const overlap = 1.5;\n\n const allValues = data.map(d => { return d.children.map(accesorValue); })\n .redu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return depth range, for selected by idx, mix array. Only two min max number for CCR | function ret_mix_range_ccr(idx , tmp_mix_arr){
//get from setpoint bottom option
var ppo2_bottom = document.getElementById("opt_setpoint_bottom");
//ppn max get from bailout settings
var ppn2_max = document.getElementById("opt_ppn2_max");
var ppo2_bottom_idx = ppo2_bottom.options[ppo2_bottom.sele... | [
"sharedDepth(pos) {\n for (let depth = this.depth; depth > 0; depth--)\n if (this.start(depth) <= pos && this.end(depth) >= pos)\n return depth;\n return 0;\n }",
"numLevels() {\n let maxDimension = Math.max(this.width, this.height);\n let boundary = this.type === 'dzi' ? ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the extension of a path | function changeExtension(path, extension){
return (path.substr(0, path.lastIndexOf(".")) + '.' + extension);
} | [
"function changeExtension(path) {\n const split = path.split('.');\n const extension = split[split.length-1];\n return path.substring(0,path.length-extension.length)+'json';\n}",
"function changeFileExt(filename, ext)\r\n{\r\n var arr = filename.split(\".\");\r\n arr[arr.length - 1] = ext;\r\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST end points end PATCH end points end sanitaization and validation | function san_val_patch_company(req, res, next) {
let errors = [];
// checking if request contains body and all necessary paramters
if (
req.body &&
req.body.COMPANY_ID &&
(req.body.COMPANY_NAME || req.body.COMPANY_CITY)
) {
//checking if COMPANY_ID is number
let ... | [
"postReqValidation() {\n this.server.route({\n method: 'POST',\n path: '/requestValidation',\n handler: (request, h) => {\n var payload = request.payload \n if(payload == null){ return \"Please include address info\"};\n if(paylo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if we're leaving a node that created a new scope, update the scopeChain so that the current scope is always represented by the last item in the scopeChain array. | function leave(node) {
if (createsNewScope(node)) {
let currentScope = scopeChain.pop();
printScope(currentScope, node);
programScopes.push(currentScope);
}
} | [
"leaveScope() {\n this.scope = this.scope.getParent();\n }",
"exitScope() {\n // Free up all the identifiers used in the previous scope\n this.scopes.pop().free(this.context);\n this.scope = this.scopes[this.scopes.length - 1];\n }",
"_exitScope() {\n\t\tthis.scope = this.scope.paren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the form ID where a field is dropped | function getFormIdForFieldPlacement( section ) {
var form_id = '';
if ( typeof section[0] !== 'undefined' ) {
var sDivide = section.children( '.start_divider' );
sDivide.children( '.edit_field_type_end_divider' ).appendTo( sDivide );
if ( typeof section.attr( 'data-formid' ) !== 'undefined' ) {
var fi... | [
"form_id()\n\t\t\t{\n\t\t\t\treturn form_id(this.props)\n\t\t\t}",
"function getFormIdForFieldPlacement( section ) {\n\t\tvar formId = '';\n\n\t\tif ( typeof section[0] !== 'undefined' ) {\n\t\t\tvar sDivide = section.children( '.start_divider' );\n\t\t\tsDivide.children( '.edit_field_type_end_divider' ).appendTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
start off by hiding the payment divs | function hidePaymentDivs (elems){
for( i = 0; i < elems.length; i++){
elems[i].style.display = "none";
};
} | [
"function hidePayments() {\n creditCard.hide();\n paypal.hide();\n bitcoin.hide();\n}",
"function hidePayment() {\n document.getElementById(\"credit-card\").style.display = \"none\";\n document.getElementById(\"paypal\").style.display = \"none\";\n document.getElementById(\"bitcoin\").style.disp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the distance between two squares | function squareDistance(s1, s2) {
s1 = s1.split('');
var s1x = COLUMNS.indexOf(s1[0]) + 1;
var s1y = parseInt(s1[1], 10);
s2 = s2.split('');
var s2x = COLUMNS.indexOf(s2[0]) + 1;
var s2y = parseInt(s2[1], 10);
var xDelta = Math.abs(s1x - s2x);
var yDelta = Math.abs(s1y - s2y);
if (xDelta >= yDelta)... | [
"function squareDistance(x1, y1, x2, y2) {\n\treturn Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2);\n}",
"function squareDistance (squareA, squareB) {\n var squareAArray = squareA.split('')\n var squareAx = COLUMN_IDS.indexOf(squareAArray[0]) + 1\n var squareAy = parseInt(squareAArray[1], 10)\n\n var sq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response listener for the Ajax call for getting the shippign cost results | function shippingCostsResponse() {
var responseDiv = document.getElementById('ServerResponse');
var responseHTML;
// 200 is the response code for a successful GET request
if (this.status === 200) {
// Use materialize's collection class to display the shipping results
responseHTML = "<ul... | [
"function PostCalc(data){\r\n $.ajax({\r\n type: \"POST\",\r\n url: \"https://stormy-lowlands-53016.herokuapp.com/quoteform\",\r\n contentType: \"application/json\",\r\n data: data,\r\n dataType: \"json\",\r\n success: function(res, status){\r\n if (status != ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check current tab and... update chrome.storage.local.[url, isMatch], update notification badge | function checkCurrentTab() {
chrome.tabs.query({"active": true, "currentWindow": true, "windowType": "normal"}, tabs => {
var tab = tabs[0];
// popup/devTools windows ran result in null tab variable
if (!tab) { return; }
// get current URL
var currentURL = tab.url;
console.log('Updating state from URL: ... | [
"function updateCurrentBadge() {\n browser.tabs.query({\"active\": true, \"currentWindow\": true}).then(function(tabs) {\n updateTabPasswords(tabs[0].url, tabs[0].id); // Should only ever be one\n }).catch(function(err) {\n // TODO: Display error to user?\n });\n}",
"function updateCurrentT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
android back pressed event handler if component has onBack method, then call onBack first otherwise check current scene type, exit app on root; pop on others | handleAndroidBackPressed() {
if (this.unmounted)
return false;
let routeName = this.props.navigation && this.props.navigation.state && this.props.navigation.state.routeName;
// check siblings
if (Siblings.siblings && Siblings.siblings.length > 0) {
Siblings.destroy();
return true;
... | [
"function onBackKeyDown() {\n \tif($.mobile.activePage.is(\"#start\")) {\n \t\tnavigator.app.exitApp(); // Exit app if current page is start Page\n \t} else {\n \t\tnavigator.app.backHistory(); // Go back in history in any other case\n \t}\n }",
"function onBackPressed() {\n if (typeof _b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace the fulfil hash input with a dropdown selection of fulfils. | function fulfilchoice(){
$('input.fulfilhash').replaceWith(
$('<select>').addClass('fulfilhash').append(
'<option value="" disabled="disabled" selected="selected">select a fulfil</option>'
// Update form when fulfil is selected.
).change(function(e){
var select = $(e.... | [
"function showfulfil(fulfil){\n var hash = $.sha256(JSON.stringify(fulfil));\n var proposal = proposals[fulfil.proposalhash];\n if('undefined' === typeof(proposal)) return;\n\n proposal.row.css('background-color', '#FF9999');\n\n // Add fulfil hash to the accept form.\n $('select.fulfilhash').appe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a table of objects, each column in this table is an objectList this table behaves just like an objectList, except there are multiple named columns | function objectTable(configuration) {
this.configuration = this.mergeConfigWithDefault(configuration);
this.parentGraphics = game.add.graphics(this.configuration.x, this.configuration.y);
this.columns = {};
} | [
"function createObjectTable(obj) {\n var heads = [], colWidths = [], vals = [];\n _.each(obj, function(v, k) {\n v = String(v);\n heads.push(k.replace(/(^|\\s)([a-z])/g, uppercaseRegexMatch));\n vals.push(v);\n var width = Math.max(strlen(k), strlen(v)) + 2;\n if (width > exports.maxTableCell) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/interpreted/optimise/stack/Stack_A_A_A.java =================================================================== Needed early: StackFunctionSupport PORT NOTE: We've changed all original uses of the constructor (which were only reflection ... | function Stack_A_A_A() {
} | [
"function Stack_A_A() {\r\n}",
"function Stack() {}",
"function Stack_A() {\r\n}",
"function Stack_A_A_R() {\r\n}",
"function Stack_A_R() {\r\n}",
"static of(construct) {\n // we want this to be as cheap as possible. cache this result by mutating\n // the object. anecdotally, at the time of ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles shift down key. | handleShiftDownKey() {
this.extendToNextLine();
this.checkForCursorVisibility();
} | [
"function shiftDown() {\n keyStates.shiftDown = true\n Mouse.forceTriggerMouseMove()\n }",
"onKeydown(event) {\n if (event.shiftKey) {\n this.shiftPressed = true;\n }\n }",
"function key_down(event) {\n if (event.shiftKey) {\n shift_key_pressed = true;\n }\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renders data properties needs in path: id, the individual mapping id | function renderDataProps (req, res, next) {
debug('GET /map/individual/:id/properties/data/view')
let id = req.params.id
service.renderDataProperties(id, (err, props) => {
if (err) return next(err)
const ctx = {layout: false, _id: id}
Object.assign(ctx, props)
res.render('partials/individualMapDat... | [
"function renderDataProperties (req, res, next) {\n debug('GET /individual/:id/properties/data/view')\n let id = req.params.id\n service.renderDataProperties(id, (err, props) => {\n if (err) return next(err)\n const ctx = {layout: false, _id: id}\n Object.assign(ctx, props)\n res.render('partials/ind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SanitiseWord ( STRING word ): STRING Sanitises a word for training/testing the neural network. Only allows upper case LETTERS. Any word longer than the allowed number of letters will be cut down to that length. Unusually, this is not a truncation from the end but rather the start, since it's presumed that the end of th... | function SanitiseWord(word)
{
let allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
word = word.toUpperCase();
let sanitised = "";
for(let i = 0, l = word.length; i < l; i++)
{
if(allowed.indexOf(word.charAt(i)) != -1)
{
sanitised += word.charAt(i);
}
}
if(sanitised.length > 15)
{
sanitised = sanitised.s... | [
"function cleanWords(dirtyWord) {\n let steralize = dirtyWord.toString().trim().toLowerCase()\n return steralize\n}",
"function sanitizeString(unsafeWord){\n\tvar safeWord = '\\\"'+ unsafeWord + '\\\"';\n\treturn safeWord;\n}",
"function normalize(word) {\n return stem(word.toLowerCase()).replace(/[^a-z]/g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createListModel / createCartView() Creates a view for the whole shopping cart, using TemplateListView as the prototype. It overrides the render() function to update the total price, and register click event handlers for the remove item buttons. | function createCartView(config) {
config.cartModel = config.model;
config.templateView = createCartItemView(config);
var view = createTemplateListView(config);
view.afterRender = function() {
this.subtotalPrice.html(this.model.getSubtotalPrice());
this.taxPrice.html(this.model.getTaxPr... | [
"function createCartItemView(config) {\n var view = createTemplateView(config);\n\n view.afterRender = function(clonedTemplate, model) {\n clonedTemplate.find('.remove-item').click(function(){\n view.cartModel.removeItem(model);\n });\n }; //view.afterRender()\n\n return view;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CENTURY FROM YEAR ========================= Given a year, return the century it is in. The first century spans from the year 1 up to and including the year 100, the second from the year 101 up to and including the year 200, etc. | function centuryFromYear(year) {
// Math.ceil rounds an integer to the nearest whole number. This function divides the given year by 100, then rounds the answer to the nearest whole number. I.e. 1992/100 = 19.92 ==> 20th century.
return Math.ceil(year / 100)
} | [
"function century(year) {\r\n return Math.ceil(year/100); \r\n}",
"function century(year) {\n \n return Math.ceil(year/100);\n }",
"function centuryFromYear(year) {\n \n // if year is divisible by 100 without any remainders, then return that year divided by 100\n // so if 1900 is divisible w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether given location didn't exceed given `maxAge` and fits in the required accuracy. | function isLocationValid(location, options) {
const maxAge = typeof options.maxAge === 'number' ? options.maxAge : Infinity;
const requiredAccuracy = typeof options.requiredAccuracy === 'number' ? options.requiredAccuracy : Infinity;
const locationAccuracy = location.coords.accuracy ?? Infinity;
return ... | [
"function overAge(age)\n{\n\t// The patient's age\n\tvar page = getAge();\n\t// If the patient is 18 or older, return true\n\tif (page >= age)\n\t\treturn true;\n}",
"function validateLocation(lat, lng) {\n return distance(-45.866891, 170.518202, lat, lng) > 50;\n }",
"static allowedAge(birthdate, age... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the plugins load config from the plugins master config. The load config just lists the plugins to be loaded. The master config also provides the locations for external plugins. | function injectPluginsIntoConfig(state) {
// Load plugin config
var root = state.environment.path,
configPath = root.concat(['build', 'client', 'modules', 'config']),
pluginConfigFile = root.concat(['config', 'ui', state.config.targets.ui, 'build.yml']).join('/');
return fs.ensureDi... | [
"function getPluginLoadConfig(plugins) {\n\t\tvar paths = {},\n\t\t entryPoints = [],\n\t\t names = [],\n\t\t baseUrlByName = {},\n\t\t map = {},\n\t\t parts,\n\t\t bundleName,\n\t\t pluginName,\n\t\t basePath = Aloha.settings.basePath || '',\n\t\t bundlePath,\n\t\t bundles = Aloha.set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses a setcookieheader and returns a key/value object. Each key represents the name of a cookie. | function parseSetCookieHeader(header) {
if (!header) return {};
header = Array.isArray(header) ? header : [header];
return header.reduce(function(res, str) {
var cookie = parseSetCookieString(str);
if (cookie) res[cookie.name] = cookie.value;
return res;
}, {});
} | [
"function parseSetCookieHeader(header) {\n header = (header instanceof Array) ? header : [header];\n\n return header.reduce(function(res, str) {\n var cookie = parseSetCookieString(str);\n res[cookie.name] = cookie.value;\n return res;\n }, {});\n}",
"function parseCookies(setCookieHeader) {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find trainers by id | function findById(id) {
return db('trainers').where({ id }).first();
} | [
"getTraining(id, callback) {\n this._trainingsDao.selectById(id, callback);\n }",
"getTrainerByIdold(id) {\n //return _.find(this.trainersData, { id: id });\n return this.store.findOneBy(this.collection, { id: id });\n }",
"getTrainerById(id) {\n return this.store.findOneBy(this.collection, { id: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the numeric Zindex of the given component. | function setZIndex(component, index) {
component.style().zIndex = index ? index.toString() : "";
} | [
"setZindex(valueNew){let t=e.ValueConverter.toNumber(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"Zindex\")),t!==this.__zindex&&(this.__zindex=t,e.EventProvider.raise(this.__id+\".onPropertyChanged\",{propertyName:\"Zindex\"}),this.__processZindex())}",
"function SetZIndex(/*UIElement*/ element,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a QueryList corresponding to the current view or content query. | function ɵɵloadQuery() {
return loadQueryInternal(getLView(), getCurrentQueryIndex());
} | [
"function ɵɵloadContentQuery() {\n return loadQueryInternal(getLView(), getCurrentQueryIndex());\n}",
"function ɵɵloadQuery() {\n return loadQueryInternal(getLView(), getCurrentQueryIndex());\n }",
"function ɵɵloadViewQuery() {\n var index = getCurrentQueryIndex();\n setCurrentQueryIndex(index ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
General //// Create an HTML element with the specified type, id, and classes. | function create_ui_element(type, id, classes) {
var new_elt = $(document.createElement(type));
new_elt.attr("id", id);
new_elt.addClass(classes);
return new_elt;
} | [
"function quickCreateElement(type, cls, id) {\n var ret = document.createElement(type);\n if (cls) { ret.classList.add(cls); }\n if (id) { ret.id = id; }\n return ret\n }",
"function createSimpleElement(p_type,p_id,p_class) {\n element = document.createElement(p_type);\n if (p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a decoded Array with the decoded content of Array _arr | _decodeArr(_arr) {
return _arr.map(_item => {
return this.decodeObject(_item);
});
} | [
"function array2Ab(arr) {\n return new Uint8Array(arr).buffer;\n}",
"function decodeArtifactArray(arr) {\n var result = {};\n for (var i = 0; i < arr.length; i++) {\n // we'll use the type as the key - and store any additional array values as the value\n // tha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate Filetype The purpose of this method is to see if a slide's filetype is valid or not. It compares the passed in filetype with an array of filetypes. If the filetype is found in the array, then it returns true. If not, it returns false. | function validateFiletype(filetypeArray, filetype)
{
var filetypeLowerCase = filetype.toLowerCase();
for (var index = 0; index < filetypeArray.length; index++)
{
if (filetypeLowerCase == filetypeArray[index])
{
return true;
}
}
return false;
} | [
"function isFileTypeValid(file) {\n for(var i = 0; i < fileTypes.length; i++) {\n if(file.type === fileTypes[i]) {\n return true;\n }\n }\n \n return false;\n }",
"function validFileType(file) {\n\tfor (var i = 0; i < fileTypes.length; i++) {\n\t\tif (file.type === fileTypes[i]) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset data common to all submit handlers | function reset(data) {
var btn = data.btn = data.form.find(':input[type="submit"]');
data.wait = data.btn.attr('data-wait') || null;
data.success = false;
btn.prop('disabled', false);
data.label && btn.val(data.label);
} | [
"function reset(data) {\n var btn = data.btn = data.form.find(':input[type=\"submit\"]');\n data.wait = data.btn.attr('data-wait') || null;\n data.success = false;\n btn.prop('disabled', false);\n data.label && btn.val(data.label);\n }",
"function reset(data) {\n var btn = data.btn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic method to translate canvas to battleground | translateToBattleground(): void {
const x = -this.canvasPosition.x + BATTLEGROUND_COORD_X;
const y = -this.canvasPosition.y + BATTLEGROUND_COORD_Y;
this.translate(x, y);
this.canvasPosition = { x: BATTLEGROUND_COORD_X, y: BATTLEGROUND_COORD_Y };
} | [
"function satellite2(x, y) {\r\n ctx.translate(x + 25, y + 25);\r\n ctx.rotate(3*Math.PI/4);\r\n ctx.fillRect(-20, -11, 4, 4);\r\n ctx.fillRect(-15, -11, 4, 4);\r\n ctx.fillRect(-10, -11, 4, 4);\r\n ctx.fillRect(-20, -6, 4, 4);\r\n ctx.fillRect(-15, -6, 4, 4);\r\n ctx.fillRect(-10, -6, 4, 4)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the agent id with the specified type, id and label | function getAgentDiv(type, id, label) {
return "<div class=\"agent\" id='"+id+"'>"+
"<div class=\"container\">"+
"<div class=\"label\">"+label+"</div>"+
"</div>"+
"<div class=\""+type+"\">"+
"<div>"+(type=="remove" ? "-" : "+")+"</div>"+
"</div>"+
"</div>"
} | [
"function getNodeId(label) {\n let id = label\n .toLowerCase()\n .replace(/[^\\w]|_/g, '-')\n .replace(/\\-{2,}/g, '-');\n\n if (idMap.hasOwnProperty(id)) {\n const n = idMap[id] += 1\n id = `${id}_${n}`;\n } else {\n idMap[id] = 0;\n }\n\n return id;\n}",
"function getTargetID(type, target... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
timer for delayed lights | function timeKeep(num,timer){
setTimeout(function(){
lightUp(seq[num]);
}, timer);
} | [
"function updateLights(){\n\tif (seconds==0) {\n\t\tilluminateStopLight();\n\t\t//console.log(\"turning on Red\");\n\t} else if (seconds==1) {\n\t\tilluminateSlowLight();\n\t\t//console.log(\"turning on Yellow\");\n\t} else if (seconds==2) {\n\t\tilluminateGoLight();\n\t\t//console.log(\"turning on Green\");\n\t} e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the integrated gaussian and geodesic curvatures of the input mesh. | computeIntegratedCurvatures() {
this.K = DenseMatrix.zeros(this.nI, 1);
this.k = DenseMatrix.zeros(this.nB, 1);
for (let v of geometry.mesh.vertices) {
let angleDefect = geometry.angleDefect(v);
if (v.onBoundary()) {
// set the integrated geodesic curvature at this boundary vertex
let i = this.bVer... | [
"static gaussian_curvature(v,u,ae,be,m,K,i) { \n const scd4 = jacobi.sn_cn_dn(u + ((1+i)* 4 * K) / 3, m);\n const scd8 = jacobi.sn_cn_dn(u + ((2+i)* 4 * K) / 3, m);\n const [sn4, cn4, dn4] = [scd4.sn, scd4.cn, scd4.dn];\n const [sn8, cn8, dn8] = [scd8.sn, scd8.cn, scd8.dn];\n const sn82 = sn8 * sn8;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds vertex and index arrays needed by colorindexed triangle picking. | buildPickTriangles(positions, indices, compressGeometry) {
const numIndices = indices.length;
const pickPositions = compressGeometry ? new Uint16Array(numIndices * 9) : new Float32Array(numIndices * 9);
const pickColors = new Uint8Array(numIndices * 12);
let primIndex = 0;
let v... | [
"function buildTriangleIndices(indicesList,startVertice){\n\n\t// front face\n\tindicesList[j++]=startVertice+0;\n\tindicesList[j++]=startVertice+2;\n\tindicesList[j++]=startVertice+1; \n\n\t// back face\n\tindicesList[j++]=startVertice+3;\n\tindicesList[j++]=startVertice+4;\n\tindicesList[j++]=startVertice+5; \n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the close out button if the currentUser is hosting the party. | renderCloseout() {
if (this.state.hosting){
return (
<div>Party over?
<button className="btn btn-default closeout-button" onClick={this.closeOutParty}>
<span className="glyphicon glyphicon-check"></span> Close out party!
</button>
</div>
)
... | [
"function toggleJoinNowButtonOnAboutUSPage() {\n var loggedIn = !!getStorageItem(storageKeys.email);;\n if (loggedIn) {\n $(joinNowButtonAboutUSPageSelector).hide();\n return;\n }\n $(joinNowButtonAboutUSPageSelector).show();\n}",
"function SignOut() {\n return auth.currentUser && (\n <button onClic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `AssetPropertyTimestampProperty` | function CfnDetectorModel_AssetPropertyTimestampPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an objec... | [
"function CfnAlarmModel_AssetPropertyTimestampPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that is used tto push new balls to the Balls array whenever called | function pushNewBalls(){
var randomPoint = randomFromArray(randPoints),
randomColor = randomFromArray(colors)
balls.push(
new Ball(
canvas, ctx,
randomPoint.x, randomPoint.y,
globalRadius, randomColor, particles, 0, velocityOfBall, false
)
)
} | [
"function pushNewBalls(){\n var randomPoint = randomFromArray(randPoints),\n randomColor = randomFromArray(colors)\n balls.push(\n new Ball(\n canvas, ctx,\n randomPoint.x, randomPoint.y,\n globalRadius, randomColor, particles, 0, velocityOfBall, false\n )\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts |time|, which must be a unix timestamp in millisecond granularity in UTC, to the target timezone that is to be used by this application. Returns a Date instance. | static toTargetTimezone(time) {
return new Date(time + TARGET_TIMEZONE_OFFSET * 60 * 60 * 1000);
} | [
"function adjust_to_users_timezone (time) {\n var new_time = time * 1000 + utc_offset * 60000; // convert to miliseconds, get\n var new_date = new Date(new_time)\n return new_date.toLocaleString()\n }",
"function convertTimetoUTC (time) {\n\n /* Offset is given as UTC - local time in mi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is for receiving project detail | function recieveProject(json){
const projectDetail = json;
return {
type: RECEIVE_PROJECT,
projectDetail
}
} | [
"function getProject_PROJECT_DATA()\n{\n\tconsole.log(\"IN PROJ DATA\");\n\t\n\tif (projectID)\n\t{\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\turl: 'Project', \n\t\t\tdata: \n\t\t\t{\n\t\t\t\t'domain': 'project',\n\t\t\t\t'action': 'get',\n\t\t\t\t'id': projectID\n\t\t\t},\n\t\t\tsuccess: function(data)\n\t\t\t{\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Number of students above a given GPA | getAboveGPA(num = 0) {
let st = new Set()
for (let s of this.stumap.values())
if (s.gpa > num) st.add(s);
return st
} | [
"function achievement(sede, generation) {\n var array = [];\n var goals = 0;\n var students = data[sede][generation]['students'];\n var numStudets = students.length;\n for (var i = 0; i < numStudets; i++) {\n if (students[i].active) {\n var pointTech = 0;\n var pointHse = 0;\n var studentsSpr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detect colisions between any kind of objects and changes the colision related vectors | function objs_colision_detection(obj_array) {
for (var i=0; i < obj_array.length; i++) {
for (var j=i+1; j < obj_array.length; j++) {
obj_array[i].colision_detect(obj_array[j]);
}
}
} | [
"function colisionCheck(object1, object2) {\n //var obj2width = returnWidth(object2);\n //amount of overlap\n var leftDist = (getX(object2) - object2.offsetWidth / 2) - (getX(object1) + object1.offsetWidth / 2);\n var rightDist = (getX(object1) - object1.offsetWidth / 2) - (getX(object2) + object2.offse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle HTML Click to close Dropdown | function closeOnHTMLClick (e) {
var target = $(e.target);
if (!(target.is(a.input[0]) || a.dropdown && target.parents(a.dropdown[0]).length > 0)) {
a.close();
}
} | [
"function closeDropDown() {\n\tdropdownDom.innerText = '';\n\tdropdownDom.dataset.status = \"closed\";\n}",
"close() {\n this.dropdown.close();\n }",
"function closeOnHTMLClick (e) {\n var target = $(e.target);\n if (!(target.is(a.input[0]) || a.dropdown && target.parents... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activates the Electron CrashReporter. | _installNativeHandler() {
// We are only called by the frontend if the SDK is enabled and a valid DSN
// has been configured. If no DSN is present, this indicates a programming
// error.
const dsnString = this._options.dsn;
if (!dsnString) {
throw new utils_1.SentryEr... | [
"_installNativeHandler() {\n // We will manually submit errors, but CrashReporter requires a submitURL in\n // some versions. Also, provide a productName and companyName, which we will\n // add manually to the event's context during submission.\n electron_1.crashReporter.start({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
turn a string into a template array | function tplArray (str) {
var
callee = arguments.callee,
tpl = str.match(
(new RegExp('^([\\W\\w]*?)'+
escapeRegExp(storage.opener)+
'([\\W\\w]*?)'+
escapeRegExp(storage.closer)+
'([\\W\\w]*?)$'))
),
arr = [];
//
if (tpl !== null) arr = arr.concat([tpl[1]], [[tpl[2].substr(0, 1)... | [
"function parseTemplate( template, data ) {\n var i = 0, len, str='';\n if ( data.constructor === Array ) {\n len = data.length;\n for(; i < len; i++){\n str += replaceValues( template, data[i] );\n }\n } else {\n str = replaceValues( template, data );\n }\n return str;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
metodos de conexion a WebSocket | connect() {
socket = new WebSocket("ws://localhost:4567/profesor");
socket.onopen = this.openWs;
socket.onerror = this.errorWs;
socket.onmessage = this.messageWs;
app.recarga();
} | [
"connect() {\n socket = new WebSocket(\"ws://localhost:4567/profesor\");\n socket.onopen = this.openWs;\n socket.onerror = this.errorWs;\n //socket.onmessage = this.messageWs;\n }",
"connect() {\n this.ws = new WebSocket(this.url, this.protocols);\n this.at... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function use to remove geolocation button Used here to remove the geo UI if there isn't any active network connection | function removeGeolocButton() {
var
geo_button_container = document.querySelector('#address>li:first-child');
if (geo_button_container !== null) {
address_ul_elem.removeChild(geo_button_container);
}
} | [
"function stopLocation() {\n locationMarker.remove();\n locationCircle.remove();\n locationControl.icon.src = 'images/location-nofix.gif';\n navigator.geolocation.clearWatch(watchID);\n disableBackgroundMode();\n }",
"function geolocaterDel() {\n var item = gui.listbox.curre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the worksheet count in the workspace title bar | function updateWorksheetCount(southPanel) {
//@SenchaUpgrade: TODO Is it a Sencha bug that add/remove listeners are called on the Tab not the TabPanel sometimes?
if (southPanel.xtype == 'tabpanel') {
// TODO - localize and create a display key:
southPanel.setTitle... | [
"function updateWorksheetCount(southPanel) {\n if (southPanel.xtype === 'tabpanel') {\n southPanel.setTitle(gw.app.localize('ExtJS.View.Worksheet.Title', southPanel.items.getCount()));\n }\n // PLWEB-5731 splitbar on minimized workspace panel not appearing after logo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Models the memory of an agent of a location it has visited. | function Memory(agentID, age, x, y) {
this.agentID = agentID;
this.age = age;
this.mostRecentVisit = age;
this.visits = 1;
this.x = x;
this.y = y;
this.distanceFromLastUntriedPath = -1;
} | [
"function Memory(agentID, age, x, y) {\r\n this.agentID = agentID;\r\n this.age = age;\r\n this.mostRecentVisit = age;\r\n this.visits = 1;\r\n this.x = x, this.y = y, this.distanceFromLastUntriedPath = -1;\r\n}",
"function MemoryOfAgent(agentID, age, x, y, otherAgentID) {\n this.agentID = agent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines a complete generic visitor for a parse tree produced by RiScriptParser. | function RiScriptVisitor() {
antlr4.tree.ParseTreeVisitor.call(this);
return this;
} | [
"function RitaScriptVisitor() {\n\tantlr4.tree.ParseTreeVisitor.call(this);\n\treturn this;\n}",
"visit(type, iterator) {\n visit(this.ast, type, iterator)\n }",
"function ECMAScriptParserVisitor() {\n\tantlr4.tree.ParseTreeVisitor.call(this);\n\treturn this;\n}",
"function rcVisitor() {\n\tantlr4.tree.Pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Captures the reason for the current status. | get statusReason () {
return this._statusReason;
} | [
"get statusReason() {\n\t\treturn this.__statusReason;\n\t}",
"get statusReason() {\n return this.getStringAttribute('status_reason');\n }",
"get reason () {\n\t\treturn this._reason;\n\t}",
"getStatusString() {\n if (this.shouldSkip() || !this.attempted) {\n return \"skipped\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
waGetQueryString() Captures parameter from query string Can be used outside of the doPlugins section | function waGetQueryString(queryParam) {
fullSubString = window.location.search.substring(1);
splitSubString = fullSubString.split("&");
for (i=0;i<splitSubString.length;i++) {
paramValue = splitSubString[i].split("=");
if (paramValue[0] == queryParam) {
return paramValue[1];
}
}
} | [
"function processQueryString() {\n console.log(\"processQueryString\");\n\n var query_string = {};\n var query = window.location.search.substring(1);\n var vars = query.split(\"&\");\n for (var i = 0; i < vars.length; i++) {\n var pair = vars[i].split(\"=\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the Lights (Directional and Ambient Lights) to the Scene (Atom Representation Scene) | function add_lights_to_scene() {
// Creates a white directional light
var directional_light_1 = new THREE.DirectionalLight(0xffffff);
// Sets the direction/position (x=1, y=1, z=1) of
// the previously created directional light
directional_light_1.position.set(1, 1, 1);
// Adds the previously... | [
"addLights() {\n var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.5);\n directionalLight1.position.set(1, -1, 0);\n this.scene.add(directionalLight1);\n\n var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.8);\n directionalLight2.position.set(0, 1, 0);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
.publish() dispatches a notification to the store which can be subscribed to. Although this api method is public, most of what you need to do can be done with model.set(), model.clear(), model.send() instead of directly here. | function publish (notification) {
_store.dispatch(notification)
} | [
"publish (topic, message) {\n\n this.send({\n action: 'publish',\n payload: {\n topic: topic,\n message: message,\n },\n })\n\n }",
"function publishPropertyChangeEvent(model, propertyPath, value){model.trigger(propertyChangedEvent, {propertyPath: propertyPath, value: value, mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set folder image as per options | function setPanelFolderImg (useAltFldr_option, altFldrImg_option) {
// Retrieve the CSS rules to modify
let a_ss = document.styleSheets;
let ss = a_ss[0];
let cssRules = ss.cssRules;
let cssStyleRule;
let style;
cssStyleRule = getStyleRule(cssRules, ".ffavicon");
style = cssStyleRule.style; // A CSSSty... | [
"function setPanelFolderImg (useAltFldr_option, altFldrImg_option) {\r\n // Retrieve the CSS rules to modify\r\n let a_ss = document.styleSheets;\r\n let ss = a_ss[0];\r\n let cssRules = ss.cssRules;\r\n let cssStyleRule;\r\n let style;\r\n\r\n cssStyleRule = getStyleRule(cssRules, \".ffavicon\");\r\n style... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a file from the template that matches the given `pattern` | function template(pattern) {
return app.src(pattern, { cwd: path.join(__dirname, 'templates') })
.pipe(app.renderFile('*')).on('error', console.error)
.pipe(app.conflicts(app.cwd))
.pipe(app.dest(app.options.dest || app.cwd));
} | [
"function genfile(template) {\n if (!loaded) {\n setTimeout(function() { genfile(template); ++loaded;}, 250);\n console.warn(\"File not loaded yet, waiting 250ms\");\n return;\n }\n // console.log(util.inspect(template, false, 1, true))\n var safename = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is main interpreter entry point. It accepts program text and returns result code, stdout, stderr. | function InterpreterCompileAndRun( program_text )
{
// Clear contents.
interpreter_stdout = '';
interpreter_stderr = '';
var file_name = 'test.u';
FS.writeFile( file_name, program_text );
var call_result = callMain( [file_name, '--entry', 'main'] );
return [ call_result, interpreter_stdout, interpreter_stderr ... | [
"function run() {\n var env = Object.create(topEnv);\n var program = Array.prototype.slice.call(arguments, 0).join(\"\\n\");\n return evaluate(parse(program), env);\n}",
"function run() {\n var env = Object.create(topEnv);\n var program = Array.prototype.slice\n .call(arguments, 0).join(\"\\n\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
groups device sensors by its Type | function groupByType(sensors) {
const grouped = [];
sensors.forEach((sensor) => {
if (isPMSensor(sensor) && grouped.length) grouped[0].push(sensor);
else grouped.push([sensor]);
});
return grouped;
} | [
"getSensors(type) {\n \tvar list = [];\n \tfor (let i of this.Sensors.keys()) {\n \t\tlet val = this.Sensors.get(i);\n \t\tif (type != null && val.raw.type == type) {\n \t\t\tlet capabilities = [];\n \t\t\t// Add sensor capabilities based on sensor values\n \t\t\tfor (let v in val.raw.data) {\n \t\t\t\t//th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::RUM::AppMonitor.CustomEvents` resource | function cfnAppMonitorCustomEventsPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAppMonitor_CustomEventsPropertyValidator(properties).assertSuccess();
return {
Status: cdk.stringToCloudFormation(properties.status),
};
} | [
"function CfnAppMonitor_CustomEventsPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A a JS native array with the given size. | function makeNativeIntArray(size) {
var arr = [];
for (var i = 0; i < size; i++)
arr[i] = 0;
return arr;
} | [
"function typedArray (size, value) {\n\tvar arr = new Array(size);\n\tfor (var i = 0; i < size; i++) {\n\t\tarr[i] = value;\n\t}\n\treturn arr;\n}",
"function makeArray(size) \n{\n\tthis.size = size;\n\treturn this;\n}",
"function makeArray(size) {\r\nthis.size = size;\r\nreturn this;\r\n}",
"function number_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open a fullchrome (all GUI elements) window This is like using a target="_blank" in a normal link but allows focussing the window | function openFullChromeWindow(url, name, openerName) {
return openWindow(url, name, 'directories,location,menubar,resizable,scrollbars,status,toolbar');
} | [
"function launchWin(href, target, params)\n{\n var features = params + ',screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,status=0,toolbar=0';\n popWin = window.open(href, target, features);\n if (popWin.focus) popWin.focus();\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if it is a DOM text element. | function isText(o) {
return o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 3 && typeof o.nodeName === 'string';
} | [
"function isText(node) {\r\n return node.nodeType === 'text';\r\n}",
"function isText(node) {\n return node.nodeType === 'text';\n}",
"function isText(node) {\n return node.nodeType === 3;\n}",
"function isText(node)\n{\n\treturn node && node.nodeType == node.TEXT_NODE;\n}",
"function isText(node) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
agrega 3 nuevos aleatorios | function agregarTri() {
for (var i = 0; i < 3; i++) {
var userName = makeid(5);
var levelUser = parseInt(Math.floor(Math.random() * 401));
var resetsUser = parseInt(Math.floor(Math.random() * 1000));
var viplevelUser = parseInt(Math.floor(Math.random() * 9));
... | [
"function Level3(criaturasAnteriores){\n tempoTexto = 0;\n indexTexto = 0;\n flagTexto = false;\n minigame = -1;\n criaturas = [];\n tipoCriaturas = criaturasAnteriores;\n}",
"function aleatorios() {\n\n //1. Crear una funcion que genere numeros aleatorios entre 1 y 50.\n return Math.floor(Math.random... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AutoHideContainer Close event handler | _autoHideWindowCloseHandler() {
const that = this;
if (that.allowToggle && that.$.tabsElement.selectedIndex !== null) {
that.$.tabsElement.select(that.$.tabsElement.selectedIndex);
}
if (that._autoHideWindow) {
that._moveContent(that._autoHideWindow.items[0], th... | [
"_onCloseClick(e) {\n this.hide();\n }",
"onContainerClose() {\n updateContainerLayout(this.container, size.closed);\n }",
"onCloseContainer() {\n\n\t\t$(document).on(\"click\", \".aimeos-overlay, .aimeos-container .btn-close\", () => {\n\t\t\treturn Aimeos.removeOverlay();\n\t\t});\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function perform the action on ONE of the equation sides (right or left, determined by the string "equationSide"): ax + b = y ax + b b = y b | function reduceSide(equationSide, inverseOperator, reducingTerm, TtargetSide){
if ((TtargetSide.indexOf('+')!==-1) || (TtargetSide.indexOf('-')!==-1)) {
if ((inverseOperator == '*') || (inverseOperator == '/')) {
equationSide = '('+equationSide+')'+inverseOperator+reducingTerm;
} else {
equationSide = equa... | [
"function equationSideToLatex(equationSide) {\n\n\tconsole.log('\\nequationSideToLatex - equationSide 1: ' + equationSide);\n\n\tvar ipfObj, innerParenthesisFraction_latex;\n\tvar pos = equationSide.indexOf('/');\n\tvar count = 0;\n\twhile ((pos!==-1) && (count < 10)) { // Convert to LaTex fractions, starting with... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region Join Bill | function handleJoinBillClicked() {
navigateToScreen(SCREENS.JOIN_BILL);
} | [
"function _qboCallback(err, bill){\n if (err) return console.error(JSON.stringify(err, null, 2));\n console.info('The following bill was created for ' + org.name + ': ' + bill.Id);\n // save all payments, setting each to \"Paid\"\n async.each(payments, fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
p[m..n+m1] = q[m..n+m1] + z x / n is the size of x / n+m is the size of p and q | function mula_small(p, q, m, x, n, z) {
m = m | 0;
n = n | 0;
z = z | 0;
var v = 0;
for (var i = 0; i < n; ++i) {
v += (q[i + m] & 0xff) + z * (x[i] & 0xff);
p[i + m] = v & 0xff;
v >>= 8;
}
return v;
} | [
"function mula_small(p, q, offs, x, n, z)\r\n{\r\n var i, v=0;\r\n for (i=0; i<n; ++i) {\r\n v += (q[i + offs]) + z*x[i];\r\n p[i+offs]=v;\r\n v >>= 8; // SIGNED shift\r\n }\r\n return v;\r\n}",
"function symmetricPoints(p, q){\nvar p1 = [];\np1.push(q[0] - p[0] + q[0]);\np1.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes a list of RowBuilder method calls based on the given direction NB: Seats for RowBuilder methods that create multiple seats are not reversed | function createDirectionalSingleRowSeatLayout(direction, seatFunctions) {
var directionalSeats = direction === 'left' ? seatFunctions.reverse() : seatFunctions;
return createSingleRowSeatLayout(function (row) { return directionalSeats.forEach(function (fn) { return fn(row); }); });
} | [
"switchRows(whichRow, whichDirection){\n //these will store the top row of each side\n if(whichRow.toUpperCase() === \"TOP\")\n {\n const front = [this.front[0], this.front[1], this.front[2]];\n const left = [this.left[0], this.left[1], this.left[2]];\n const ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given two DOMRanges, union them: return a range that contains all points that either A contains or B contains, and contains no other points. If A and B do not overlap, no union exists; return null. | function unionRanges(a, b) {
if (!rangesOverlap(a, b)) {
return null;
}
// Find the range with the earliest start point, and the range with the
// latest end point.
var starter = compareRangeBoundaryPoints(a, "start", b, "start") < 0 ? a : b;
var ender = compareRangeBoundaryPoint... | [
"function unionRanges(a, b) {\n if (!rangesOverlap(a, b)) {\n return null;\n } // Find the range with the earliest start point, and the range with the\n // latest end point.\n\n\n var starter = compareRangeBoundaryPoints(a, \"start\", b, \"start\") < 0 ? a : b;\n var ender = compareRangeBoundaryPoints(a, \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
General onChange for create form | function create_form_onChange(self, new_v, old_v)
{
var $form = $$(build_name(self, "create_form"));
var changed = $form.isDirty();
if(changed) {
var btn = $$(build_name(self, "create_record"));
webix.html.addCss(btn.getNode(), "icon_color_submmit");
btn =... | [
"formChanged() {}",
"change() {\n this.showValidationOnHandler('change');\n }",
"function inputChanged(e) {\n formChanged = true;\n }",
"function onChange() {\n\t\t__debug_1990( 'Received a change event.' );\n\t\tself.render();\n\t}",
"function onChange() {\n\t\t__debug_452( 'Received a change e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the user is authenticated, this.props.isAuthenticated has to be set from your application logic (or use reactredux to retrieve it from global state). | isAuthenticated() {
return this.props.isAuthenticated;
} | [
"function isAuthenticated() {\n return !!currentUser();\n }",
"function isAuthenticated() {\n return !!service.currentUser;\n }",
"async checkAuthentication() {\n const authenticated = await this.props.auth.isAuthenticated();\n if(authenticated !== this.state.au... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Animates a change in size | function ChangeSize(amount, duration) {
var sizeAnimation = new Animation({
begin: 0,
loop: false,
timeToFinish: duration,
propsBegin: { size: this.size },
propsEnd: { size: this.size + amount }
});
return sizeAnimation;
} | [
"async growAndShrink() {\n await this._temporaryAnimation(this._icon, 'grow-and-shrink', 200);\n }",
"function fAnimateHeightWidth (elem, eHeight, eWidth) {\n tMx.to (elem, animTym, {css: {height: eHeight, width: eWidth}, ease: easePower});\n //tMx.css ({\"backgroundSize\": \"cover\"});\n //, backgro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function: Whether the given node name has a member named "skipDelete" and that member has the value of true. | function hasSkipDeleteInDefinition(nodeName) {
let itemDefinition = getItemDefinition(nodeName);
if (no(itemDefinition)) {
console.log(`ERROR: Cannot find item definition for ${nodeName}`);
return false;
}
if (no(itemDefinition.skipDelete)) {
return false;
}
return itemDefinition.skipDelete;
} | [
"get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }",
"function shouldSkip(name, value) {\n\tvar attrType = properties[name];\n\treturn value == null ||\n\t(attrType === types.BOOLEAN && !value) ||\n\t(attrType === types.OVERLOADED_BOOLEAN && value === false);\n}",
"function isDeleteTarget(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert string to boolean | function stringToBoolean(str) {
if (str == "true") {
return true;
} else {
return false;
}
} | [
"function toBoolean(string) {\n if (string === 'true') {\n return true;\n } else if (string === 'false') {\n return false;\n }\n }",
"function stringToBoolean(string) {\n\tswitch(string.toLowerCase()) {\n\t\tcase \"true\":\n\t\tcase \"yes\":\n\t\tcase \"on\":\n\t\tcase \"1\":\n\t\t\treturn tru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A viewless document doesn't have a window open in Photoshop, doesn't have a corresponding "document" object in the DOM, and isn't known to the DOM in general. Instead, it carries a pointer to the TImageDocument in PS, and manipulates it via PS events. The code supporting this is hiding in U3DCommands.cpp | function ViewlessDocument( desc, pathname )
{
var bppdict = { 1:BitsPerChannelType.ONE,
8:BitsPerChannelType.EIGHT,
16:BitsPerChannelType.SIXTEEN,
32:BitsPerChannelType.THIRTYTWO };
var modeDict = {};
modeDict[classBitmapMode] = DocumentMode.BITMAP;
modeDict[classGrayscaleMode] = DocumentMode.GRAY... | [
"function openViewlessDocument( pathname )\n{\n\tvar desc = new ActionDescriptor();\n\tdesc.putBoolean( kpreferXMPFromACRStr, true );\n\tdesc.putPath( app.charIDToTypeID('File'), new File( pathname ) );\n\tvar result = executeAction( kopenViewlessDocumentStr, desc, DialogModes.NO );\n\tvar psViewPtr = result.getDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if a bomb kills a player | checkForKill(x, y, bomb) {
// Vorfilterung um nicht jedes Mal die Liste durch zu iterieren
if (!(this.gameMap.isPlayerAtPosition(x, y)) && !(this.gameMap.isBombAtPosition(x, y))) {
return;
}
for (var manId in this.men) {
var man = this.men[manId];
if (man.indest == false && Math.abs(man.getXPosition() ... | [
"function isCollidingWithKillBox()\r\n {\r\n insideKillBox = false;\r\n isInsideKillBox = false;\r\n killBoxes.forEach(function (Collisions) {\r\n playerKillBoxCollision(Collisions.collisionBoxX, Collisions.collisionBoxY, Collisions.collisionBoxWidth, Collisions.collisionBoxHeight)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A Ticker class that runs an update loop that other objects listen to. This class is composed around an EventEmitter object to add listeners meant for execution on the next requested animation frame. Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. | function Ticker()
{
var _this = this;
/**
* Internal tick method bound to ticker instance.
* This is because in early 2015, Function.bind
* is still 60% slower in high performance scenarios.
* Also separating frame requests from update method
* so listeners may be called at any time an... | [
"function Ticker()\n{\n var _this = this;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will set the visible example photo as the one containing a part of the face that user want to have. Id of this photo will be assigned to the global variable 'activeExamplePhotoId'. | function chooseExamplePhoto() {
const $activeExampleFace = $acitveExampleFaces.find(buildCustomData(KEY_OF_THE_INDEX_OF_AN_EXAMPLE_PHOTO, exampleFaceIndex)).find(buildCustomData(KEY_OF_THE_FACE_ID));
setImgSrc($chosenPartOfFace, $activeExampleFace.attr('src'));
activeExamplePhotoId = $activeExampleFace.data... | [
"static startProcessingUserPhoto() {\n swapPartOfFace.prepareTheModal();\n swapPartOfFace.showTheModal();\n abilityToChangePartOfFace = false;\n $closeExampleFaceModal.hide();\n swapPartOfFace.blockTheScreen();\n }",
"function _findFace()\n{\n misty.Set(\"findFace\", true)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Props... Instance variables... Resulting action Lifecycle... typeId = 'ModalPortal' | function ModalPortal(props) {var _this;
_this = _React$PureComponent.call(this, props) || this;
// const popupsInited = config.modals.isInited
defineProperty_default()(assertThisInitialized_default()(_this), "isOutsideClickWaiting", false);defineProperty_default()(assertThisInitialized_default()(_this), "gl... | [
"render() {\n return (\n <Portal>\n {this.renderModal()}\n </Portal>\n )\n }",
"openActionModal() {\n this.showActionModal = true;\n }",
"function Modal({ children }) {\n return ReactDOM.createPortal(\n <div className=\"ModalBackground\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that defines how to render a video as a list require video object and Ul too append list item to | function listVideos(video, videoUl) {
let videoLi = document.createElement('li')
let titleH3 = document.createElement('h3')
let pubH4 = document.createElement('h4')
let descP = document.createElement('p')
titleH3.innerText = video.title
pubH4.innerText = `Publisher: ${video.publisher}`
descP... | [
"renderVideoList() {\n this.$videoList.empty();\n for(let i = 1; i < this.model.get('videos').models.length; i++) {\n let video = this.model.get('videos').models[i];\n let videoListView = new VideoListView({model: video});\n this.$videoList.append(videoListView.render().el);\n }\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Global variables are available inside other functions | function globalFunction(){
console.log(globalVariable);
} | [
"function globalMehtod() {\n\n }",
"function getGlobalVariable(){\n\treturn;\n}",
"function sharingIsCaring() {\n console.log(globalVar)\n}",
"function iniFunction() {\r\n const akuTopLocal = akuTopGlobal; // akuTopLocal merupakan variable dengan scope Local\r\n return akuTopLocal;\r\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ram_size computed: true, optional: false, required: false | get ramSize() {
return this.getNumberAttribute('ram_size');
} | [
"ramSize() {\n return `${_.sample(['4', '6', '8', '16', '32', '64'])}GB`;\n }",
"getRamSize() {\n let kb;\n switch (this.ramSize) {\n case RamSize.RAM_4_KB:\n kb = 4;\n break;\n case RamSize.RAM_16_KB:\n kb = 16;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse a binary byte | function parseBinary(buf, index) {
// Get the result as an integer
var num = buf.readUInt8(index);
// Convert to a binary string
var binary = num.toString(2);
// For each value
_.times( 8 - binary.length, function() { binary = "0" + binary; });
// Save the result
var results = {};
// Loop each 8
_.times(... | [
"function unBinary(str) { return parseInt(str,2); }",
"function BinaryParser() {}",
"function BinaryParser() { }",
"function fromByte(b) {\n const sv = (b & VTOI.shuttle) ? 'shuttle' :\n (b & VTOI.thinshuttle) ? 'thinshuttle' : null;\n const v = ITOV[b & 0x3f];\n\n assert(v != null);\n return [v, sv];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |