query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Group the transactions by currency + buys and sells Returns an array of capital gains | calculateCapitalGains() {
const groupedTransactions = {};
for (let t = 0; t < this.transactions.length; t++) {
const transaction = this.transactions[t];
const transactionType = transaction.type === 'buy' ? 'buys' : 'sells';
if (!(transaction.unitCurrency in groupedTransactions)) {
gr... | [
"async function getStocks(transactions){\n //convert transactions to a list of totals\n var unappraisedPortfolio = transactions.reduce((accu, curr) => {\n accu[curr.symbol] = accu[curr.symbol] || {\n 'count': 0,\n 'investment': 0\n };\n accu[curr.symbol].count += (curr.type == \"buy\" ? parseFl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the target element is fixed or not. | function isFixed() {
return position === 'fixed';
} | [
"function isFixed() {\n\t\t\treturn position === 'fixed';\n\t\t}",
"function isFixed() {\n return position === 'fixed';\n }",
"function isFixed(element){var nodeName=element.nodeName;if(nodeName==='BODY'||nodeName==='HTML'){return false;}if(getStyleComputedProperty(element,'position')==='fixed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
production IntExpr ::== digit intop Expr // ::== digit | function parse_IntExpr() {
tree.addNode('IntExpr', 'branch');
if (foundTokensCopy[parseCounter][1] == 'digit') {
parse_digit();
//tree.endChildren();
console.log("this is the next look ahead: " + foundTokensCopy[parseCounter][0]);
if (foundTokensCopy[parseCounter][0] == '+') {
... | [
"function parseIntExpr() {\n CST.addBranchNode(\"IntegerExpression\");\n if (match([\"T_digit\"], true, false)) {\n if (match([\"T_intop\"], true, true)) {\n match([\"T_digit\"], false, false);\n if (match([\"T_intop\"], false, false)) {\n parseExpr();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render product to checkout list | renderToCheckout(product) {
var $item = `<tr class='item' data-name='${product.name}'>
<td class='item-name'>${product.name}</td>
<td class='item-quantity'>${product.quantity}</td>
<td class='item-price'>${product.r_price}</td>
... | [
"static renderProducts() {\n\t\tlet productHTML = \"\";\n\t\tProduct.getProductList().forEach( product => {\n\t\t\tproductHTML += \n\t\t\t`<product-list-item\n\t\t\tname=\"${product.name} \"\n\t\t\tdata-product-id=\"${product.id}\"\n\t\t\timg=\"${product.img}\"\n\t\t\tdescription=\"${product.description}\"\n\t\t\tp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send HTML The purpose of this function is to send html code to the display clients. The letter H is the indication to the client that it is html code. The filepath is appended to it as well as the filename. | function sendHTML()
{
socketSend('H' + html);
} | [
"function sendHtmlPage(response, filePath) {\n response.set('Content-Type', 'text/html');\n response.send(new Buffer(fs.readFileSync(filePath))); \n}",
"render_html(path) {\n\t\tthis.win.loadURL(`file://${path}`);\n\t}",
"function sendClientHtml(response) {\n\tif (sendClientHtml.cachedHtml) {\n\t\tresponse.w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the list of reference names associated with given commit hash. | getNames(commitHash) {
return this.namesPerCommit.get(commitHash) || [];
} | [
"static parseRefs(stdout) {\n // store references\n const refs = {};\n\n // line delimited\n const refLines = stdout.split('\\n');\n\n for (const line of refLines) {\n const match = gitRefLineRegex.exec(line);\n\n if (match) {\n var _match = (0, (_slicedToArray2 || _load_slicedToArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Binds on the given target and event the given function. The SpriteSpin namespace is attached to the event name | function bind(target, event, func){
if (func) {
target.bind(event + '.' + name, function(e){
func.apply(target, [e, target.spritespin('data')]);
});
}
} | [
"function bind(target, event, func) {\n\t\tif (func) {\n\t\t\ttarget.bind(event + '.' + namespace, function(e) {\n\t\t\t\tfunc.apply(target, [e, target.spritespin('data')]);\n\t\t\t});\n\t\t}\n\t}",
"function applyEvents(data) {\n\t\tvar target = data.target;\n\t\t// Clear all SpriteSpin events on the target elem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
accept Day Select Element Delete | function acceptDayDelete(){
var element = document.getElementById("accept_day");
var length = element.length;
accept.day = 0;
for(var i = 0; i < length - 1; i++){
element.removeChild(element.lastChild);
}
nexttimeYearDelete();
} | [
"function acceptMonthDelete(){\n\tvar element = document.getElementById(\"accept_month\");\n\tvar length = element.length;\n\taccept.month = 0;\n\t\n\tfor(var i = 0; i < length - 1; i++){\n\t\telement.removeChild(element.lastChild);\n\t}\n\t\n\tacceptDayDelete();\n}",
"function choiceDay(day) {\n if (day == \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes object provided by command line json object parser | function processObj(o) {
if (DEBUG) console.log("Object from parser: ", o);
try {
var ob = JSON.parse(o);
if (DEBUG) console.log("After JSON.parse: ", ob);
answers.process(ob);
} catch (e) {
console.log("Oops, could not parse or process ", o, e.message);
}
} | [
"function parseObj (input) {\n var str, out;\n try {\n str = fs.readFileSync(program.obj);\n } catch (e) {\n return eval('(' + program.obj + ')');\n }\n // We don't want to catch exceptions thrown in JSON.parse() so have to\n // use this two-step approach.\n return JSON.parse(str);\n}",
"function par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy the raw response headers from the currently selected item. | copyResponseHeaders() {
let rawHeaders = this.selectedRequest.responseHeaders.rawHeaders.trim();
if (Services.appinfo.OS !== "WINNT") {
rawHeaders = rawHeaders.replace(/\r/g, "");
}
copyToClipboard(rawHeaders);
} | [
"copyRequestHeaders() {\n let rawHeaders = this.selectedRequest.requestHeaders.rawHeaders.trim();\n if (Services.appinfo.OS !== \"WINNT\") {\n rawHeaders = rawHeaders.replace(/\\r/g, \"\");\n }\n copyToClipboard(rawHeaders);\n }",
"function recoverHeaders(response) {\r\n response.Headers = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves the OL feature ID of the given waypoint | function getFeatureIdOfWaypoint(wpIndex) {
var rootElement = $('#' + wpIndex).get(0);
var address = rootElement.querySelector('.address');
var id = address ? address.id : null;
return id;
} | [
"function getWaypiontIndexByFeatureId(featureId) {\n\t\t\tvar wpResult = $('#' + featureId);\n\t\t\tvar wpElement;\n\t\t\tif (wpResult) {\n\t\t\t\twpElement = wpResult.parent().parent();\n\t\t\t}\n\t\t\tif (wpElement) {\n\t\t\t\tvar wpIndex = wpElement.attr('id');\n\t\t\t\tif (!isNaN(wpIndex)) {\n\t\t\t\t\treturn w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Firebase and local storage when someone likes or dislikes a track | toggleLike(key) {
let updateAmt = 0,
localLiked = localStorage.getItem(key) ? true : false
if (localLiked) {
updateAmt--;
} else {
updateAmt++;
}
let siteLikesRef = firebase.database().ref('tracks/' + key + '/likes');
// transaction(update function, callback)
siteLikesRe... | [
"function updateLikes() {\n // first check if user is login\n if (auth().currentUser) {\n if (extraData.likes.includes(auth().currentUser.email)) {\n // remove the like from the 'likes' array at firestore \n firestore().collection('article').doc(route.params.da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
define la clase Pagina | function Pagina(x) {
this.attPagina=0;
this.titulo = 'General'; //titulo de la pagina
this.unidad = 'General'; //unidad de la materia
this.numero = x;//numero de pagina
this.puntaje = 1;//puntaje para evaluacion
this.tipo = 'General';
Pagina.prototype.GetTipo = function(){
return (this.tipo);
... | [
"function PaginaIndice(x) {\n\t\t // Llama al constructor primario\n\t\t\tPagina.call(this,x);\t\t \n\t\t\tthis.numero = 0;//numero de pagina\n\t\t\tthis.titulo = 'Sin titulo';\n\t\t\tthis.tipo = 'Texto-Texto-Texto';\t\t\t\t\t\n\t\t}",
"cambiarPagina(page){\n let me = this;\n me.li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transformers our API meta data to a format understood by vuetable 2 | transform(data) {
// Clean up fields for meta pagination so vue table pagination can understand
data.meta.last_page = data.meta.total_pages;
data.meta.from = (data.meta.current_page - 1) * data.meta.per_page;
data.meta.to = data.meta.from + data.meta.count;
... | [
"function transformResponse() {\n \n}",
"transform(response) {\n return response.data;\n }",
"transform() {\n const transformed = {};\n const fields = [\n \"OwnerEmail\",\n \"ArtistEmail\",\n \"Credits\",\n \"Confirmed\",\n \"ConfirmationToken\",\n \"BookId\",\n \"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Round the number to the third. | function roundThird(value) {
const rem = value % RADIX;
if (rem === 0) {
return value;
}
return value + RADIX - rem;
} | [
"function round3(num) {\n return Math.round(num * 1000) / 1000;\n }",
"function roundTo3(num) {\r\n 'use strict';\r\n var postDecimal;\r\n\r\n postDecimal = num.toString().split(\".\")[1];\r\n\r\n if (!!postDecimal && postDecimal.length > 3) {\r\n return num.toFixed(3);\r\n }\r\n\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runtime helper for rendering vfor lists. | function renderList(val,render){var ret,i,l,keys,key;if(Array.isArray(val)||typeof val==='string'){ret=new Array(val.length);for(i=0,l=val.length;i<l;i++){ret[i]=render(val[i],i);}}else if(typeof val==='number'){ret=new Array(val);for(i=0;i<val;i++){ret[i]=render(i+1,i);}}else if(isObject(val)){keys=Object.keys(val);re... | [
"renderList() {\n let liElements = this.contents.map((content, index) => this.getLi(content.text, content.isSelected, index));\n for( let li of liElements ){\n this.appendLi( li );\n }\n }",
"function renderList(val,render){var ret,i,l,keys,key;if(Array.isArray(val)||typeof val=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stretch Goals 8. Function to check if a letter is the first letter in a string. Return true if it is, and false otherwise | function isFirstLetter(letter, string) {
return (string.charAt(0) === letter);
} | [
"function isFirstLetter(letter, string) {\n if (string.charAt(0) === letter) return true\n else if (string.charAt(0) !== letter) return false\n}",
"function isFirstLetter(letter, string) {\n if (letter === string[0]) {\n return true;\n }\n else {\n return false;\n }\n\n}",
"function isFirstLetter(let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
postPhoto is defined under Mutation, so postPhoto is a root resolver parent is always the first argument of resolver, here parent point to "Mutation" | postPhoto(parent, args) {
const newPhoto = {
id: _id++,
created: new Date(),
/*
* url field could be assigned value here
*/
// url: `http://mysite/img/${_id}.jpg`,
...args.input // now we are u... | [
"function uploadPostPhoto(file) {\n // Create Promise for async call\n return new Promise((resolve, reject) => {\n uploadPhoto(file, \"posts\").then( photoObj => {\n return resolve(photoObj);\n }).catch(err => {\n return reject(err);\n });\n });\n}",
"uploadPost... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define basic policy rules. | defineBasicPolicies() {
const gate = this.app.make('gate');
gate.policy('public', () => {
return true;
});
gate.policy('private', () => {
return false;
});
gate.policy('env', (environment) => {
return this.app.environment === environment;
});
} | [
"defineBasicPolicies() {\n const gate = this.app.make('gate');\n gate.policy('public', () => {\n return true;\n });\n gate.policy('private', () => {\n return false;\n });\n gate.policy('env', environment => {\n return this.app.environment === environment;\n });\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes a list of lists of possible argument types, returns a function to resolve those types. | function type_resolver_from_list(lst)
{
var param_length = lst[0].length - 1;
return function() {
if (arguments.length != param_length) {
throw new Error("expected " + param_length + " arguments, got "
+ arguments.length + " instead.");
}
... | [
"function resolveArgsByType(args, types) {\n var argIndex = 0;\n return types.map(v => {\n // make rule\n var rule, dft;\n\n if (isArray(v)) {\n rule = v[0];\n dft = v[1];\n } else {\n rule = v;\n dft = undefined;\n }\n\n if (!isFunction(rule)) {\n if (rule == null) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the user clicks on bt2, open the popup share element. | function popUp2() {
var popup_share = document.getElementById("popup_share");
popup_share.style.display = "block";
} | [
"open_newsHub_Article_ShareButton(){\n this.newsHub_Article_ShareButton.waitForExist();\n this.newsHub_Article_ShareButton.click();\n }",
"function socialClick(share){\r\n\tvar link = share.getAttribute(\"data-dash-href\");\r\n\twindow.open(link);\r\n}",
"function showTwitterShare() {\n // O... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the google map and put markers if blocks that were created on server side has attribyte "datalng" and "datalat. | function initialize() {
indexOfMarket = -1
geocoder = new google.maps.Geocoder();
var mapOptions = {
zoom: 14
};
map = new google.maps.Map(
gId('map-canvas'),
mapOptions);
google.maps.event.addListener(map, 'click', function(event) {
placeMarker(event.latLng);
... | [
"function init () {\n map = new google.maps.Map(document.getElementById('map-canvas'), {\n center: {\n lat: INIT_LAT,\n lng: INIT_LNG\n },\n zoom: INIT_ZOOM\n });\n\n beers.forEach(function (beer) {\n addMarker(beer);\n });\n }",
"function initM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
txt is the text to measure, font is the full CSS font declaration, e.g. "bold 12px Verdana" | function measureText(txt, font) {
var id = 'text-width-tester',
$tag = $('#' + id);
if (!$tag.length) {
$tag = $('<span id="' + id + '" style="display:none;font:' + font + ';">' + txt + '</span>');
$('body').append($tag);
} else {
$tag.css({
font: font
}).html(txt);
... | [
"function measureText(txt, font) {\n var id = 'text-width-tester',\n $tag = $('#' + id);\n if (!$tag.length) {\n $tag = $('<span id=\"' + id + '\" style=\"display:none;font:\"Lucida Grande\", Helvetica, Arial, sans-serif;\">' + txt + '</span>');\n $('body').append($tag);\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles the select state of an image and updates the array of selected image urls. The url array is then persisted in localStorage. | toggleImageSelected(e) {
// Toggle .selected class on the <li>
const isLiSelected = this.helpers.closest(e.target, 'li').classList.toggle('selected');
// Add or remove from localStorage.
if (isLiSelected) {
this.lStorage.add(e.target.src);
}
else {
... | [
"function selectImage(args) {\n\tfor (var i in thumbs) thumbs[i].selected.value = false;\n\tthumbs[args.data.id].selected.value = true;\n\tselectedImage.value = args.data.id;\n}",
"function button_setSelectedImage (name) {\r\n\tvar oldSelected = button_selected;\r\n\r\n\tdocument.images[name].src = buttons[name].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! 16. switchMood() Check the mood of creature :) :( :o | function switchMood() {
let mood;
switch (
rnd(3, 0) // mood
) {
case 1:
mood = talk(); // --> Look 17.talk()
break;
case 2:
mood = smile(); // --> Look 18.smile()
break;
case 3:
mood = cry(); // --> Look 19.cry()
break;
}
return mood;
} | [
"function SetMood(mood) {\n\t\tif (mood == 1) { //Movie Time\n\t\t\tSingleBulb(1,0)\n\t\t\tSingleBulb(2,1,5)\n\t\t\tSingleBulb(3,0)\n\t\t\tSingleBulb(4,1,5)\n\t\t\tSingleBulb(5,1,5)\n\t\t\tSingleBulb(6,0) }\n\t\telse if (mood == 2) { //Party Time\n\t\t\tfor (count=1; count < 100; count++) {\n\t\t\t\tbrightness=Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[Re]initialize subdivision. Keep base geometry and structure. | reset() {
if ( this.WARNINGS ) console.info( 'Reset: initialize subdivision.' );
this.activeSubdivisions = 0;
this._subdivStructure = this._baseStructure;
this.geometry.copy( this._baseGeometry );
// Initialize vertex weights, for quick updating. Initially, each vertex is solely dependent on itself.
th... | [
"subdivide() {\n this.divided = true; // Informs of the subdivision to only subdivide once\n \n let x = this.boundary.x;\n let y = this.boundary.y;\n let w = this.boundary.w / 2;\n let h = this.boundary.h / 2;\n \n // Creates the 4 children quad trees with the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a depth + normals texture. | get DepthNormals() {} | [
"set DepthNormals(value) {}",
"function GenerateDepthTexture() {\n\n gl.bindFramebuffer( gl.FRAMEBUFFER, framebuffer );\n gl.viewport( 0, 0, width, height );\n gl.framebufferTexture2D( gl.DRAW_FRAMEBUFFER, gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D, depthTexture, 0 );\n\n CheckFramebufferStatus( gl, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! ORDER INDICATOR UPDATE This is the function that runs to update order indicator | function updateOrderIndicator(){
if(orderListNum>=0){
orderIndicator.visible=true;
orderIndicator.x = Math.round(canvasW/100 * 81);
orderIndicator.y = gameOrderContainer.y + $.marks[orderListNum].y;
}else{
orderIndicator.visible=false;
}
} | [
"function updateOrder() {\n orderPoly = orderPolySlider.value();\n initOperands();\n}",
"function updateOrder(order) {\n newest = order;\n loadTimeline();\n}",
"function updateOrderCount() {\n orderCountElement.textContent = orderCount;\n }",
"function table_order_changed (new_order)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A _type guard_ designed to test whether an input is of type `TypeSubtype` | function isTypeSubtype(input) {
return typeof input === "string" && input.split("/").length === 2;
} | [
"function isTypeSubTypeOf(schema, maybeSubType, superType) {\n // Equivalent type is a valid subtype\n if (maybeSubType === superType) {\n return true;\n }\n\n // If superType is non-null, maybeSubType must also be non-null.\n if (superType instanceof _definition.GraphQLNonNull) {\n if (maybeSubType inst... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is called when the Component is mounted initally, which causes the timer to start. | componentDidMount() {
this.startTimer()
} | [
"componentDidMount(){\n this.trigger_timer();\n }",
"initStart(){\n this.startTimer = Date.now()/1000;\n }",
"componentDidMount() {\n // Install the interval.\n this.intervalHandle = setInterval(() => {\n /**\n * To allow mocked tests of the timing functions and still be able... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all employees in a given Commune with commuune_id | getEmpCommune(commune : number): Promise<Employee[]>{
return axios.get(url+'/employee/commune/'+commune);
} | [
"findAllEEsByDept(departmentId) {\n return this.connection.query(\n \"SELECT employee.id, employee.first_name, employee.last_name, role.title FROM employee LEFT JOIN role on employee.role_id = role.id LEFT JOIN department department on role.department_id = department.id WHERE department.id = ?;\",\n de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Organize your react/redux application in the vuex way. / API Reference createStore(options): Store Arguments Returns Store ensure(path: Array) dispatch(path: string, payload) Create a store. | function createStore(options) {
return new _Store.Store(options);
} | [
"generateStore (options) {\n return generateStore(options)\n }",
"function createStore(){}",
"function createStore (options, id) {\n debug('Creating FS store ' + id + ' with following parameters', options)\n return store(options)\n}",
"generateStore(options) {\n return generateStore(options);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from types/LiteralObject.java =================================================================== Needed early: ArcObject Needed late: Literal PORT NOTE: This was originally abstract. | function LiteralObject() {
} | [
"function Obj(){ return Literal.apply(this,arguments) }",
"function Obj(){ Literal.apply(this,arguments) }",
"readObjectLiteralAPIs(objectliterals) {\n if (!objectliterals || objectliterals.length <= 0) {\n return;\n }\n let objlitObj = {};\n for (let objlit of objectliter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
While a bit blunt, this function selects Haunty and applies the Shivering ID to him, allowing him to be scared. | function shivering() {
findHaunty().setAttribute('id', 'spooked');
} | [
"function hauntyListener() {\n\tfindHaunty().addEventListener('click', function (event) {\n\t\tevent.preventDefault();\n\t\tvar monsterPresence = monsterList.map (function(name) {\n\t\t\treturn findStalker().classList.contains(name);}\n\t\t);\n\t\tvar isThereAMonster = false;\n\t\tmonsterPresence.forEach(function(p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instructies voor het plaatsen van schroeven Als het bedonderdeel schroeven nodig heeft dan worden deze geplaatst in een array Schroeficoon wordt verplaatst aan de hand van de voortgang van de gebruiker en het schroef object in de array | function instruerenSchroef(object){
var schroefDraai = 0;
var schroeven = [];
var schroefNummer = 0;
$("[class*='schroefgat-"+object.id+"']").each(function(i){
schroeven.push(this);
});
var pijlPosY = $(schroeven[schroefNummer]).attr("position").y + 2;
$("#schroevendraaier-icoon").attr({"position": ''+$(schr... | [
"voegVerbindingenToe(verbindingen) {\n let graaf = this;\n verbindingen.forEach(function(verbinding){\n if (verbinding.constructor === Array && verbinding.length === 3 && (typeof verbinding[2] === \"number\" || verbinding[2] >= 0) && graaf.knopen.indexOf(verbinding[0]) >= 0 && graaf.knopen.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the Timeline object that can be used to control the host's player control. | function getTimeline() {
checkIsConnected();
return _timeline;
} | [
"get timeline() {\n return Wick.ObjectCache.getObjectByUUID(this._timeline);\n }",
"function _createTimeline(){\n var attributes = Object.create(null);\n attributes['method'] = 'rtm.timelines.create';\n attributes = _generateAttributes(attributes);\n var timeline = '';\n\t\n $.getJSON( RTM_URL,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register all routes in api/routes folder. | loadRoutes() {
const apiPath = path.join(process.cwd(), 'api', 'routes')
// check that path exists.
if (!fs.existsSync(apiPath)) {
throwError({
type: 'Application.PathNotExists',
message: 'path not exists.',
detail: 'path "api/... | [
"function registerApiRoutes(app, callback) {\n var pattern = config.api + '/**/index.js';\n glob(pattern, function (err, files) {\n if (err) { return log.error('Error finding route files', err); }\n log.info('Found [' + files.length +'] routes');\n files.forEach(function (file) {\n var folders = pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validacion de la fecha de la itv | function validarFecha(){
var mensaje="";
var fechaI = document.getElementById("Fecha");
var fechaItv = new Date(Date.parse(fechaI.value)).setHours(0,0,0,0);
var fechaActual = new Date();
fechaActual.setHours(0,0,0,0);
var valid = true;
valid = valid && fechaItv <= fechaActual;
if(!valid){
mensaje = ... | [
"function validarFecha(){\n\tvar mensaje=\"\";\n\tvar fechaTur = document.getElementById(\"Fecha\");\n\tvar fechaTurno = new Date(Date.parse(fechaTur.value)).setHours(0,0,0,0);\n\tvar fechaActual = new Date();\n\tfechaActual.setHours(0,0,0,0);\n\tvar valid = true;\n \n valid = valid && fechaTurno >= fechaActu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fake a rsvp data for the next api endpoint | function rsvpData() {
return {
created: 1507230178000,
updated: 1507277274000,
response: 'yes',
guests: faker.random.number(2),
event: {
id: '243328174',
name: 'Hacker News Meetup #13',
yes_rsvp_count: 48,
time: 1507741200000,
utc_offset: 7200000
},
group: {
... | [
"@sv.scenario\n oneCall(model = sv.svVar(\"\").setFinal(), color = sv.svVar(\"\").setFinal(\"\"),\n wheels = sv.svVar(\"\").setFinal(),\n price = sv.svVar(\"\"), currency = sv.svVar(\"\")) {\n // note the .setFinal() SV variable declaration above telling the simulator\n // to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to save our highscore list to local storage | function saveToLocalStorage() {
var highScoreListStr = JSON.stringify(highScoreList);
localStorage.setItem("movieFighterHighScoreList", highScoreListStr);
} | [
"function saveScore() {\n localStorage.setItem(\"highScore\", JSON.stringify(scoreList));\n}",
"function storeHighScores () {\nlocalStorage.setItem('highScoreList', JSON.stringify(highScoreList));\n}",
"function saveHighScore(highscores) {\n localStorage.setItem(\"hs\", JSON.stringify(highscores));\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensures metric names are valid Prometheus metric names by removing characters allowed by OpenTelemetry but disallowed by Prometheus. 1. Names must match `[azAZ_:][azAZ09_:]` 2. Colons are reserved for user defined recording rules. They should not be used by exporters or direct instrumentation. OpenTelemetry metric name... | _sanitizePrometheusMetricName(name) {
return name.replace(this._invalidCharacterRegex, '_'); // replace all invalid characters with '_'
} | [
"function sanitise(name) {\n\t\t\treturn name.replace(/[^a-zA-Z0-9\\.\\-]/g, '_');\n\t\t}",
"function sanitise(name){\n\treturn name.replace(/[^a-zA-Z0-9\\.\\-]/g, '_');\n}",
"function sanitise(name) {\n\t\t\treturn name.replace(/[^a-zA-Z0-9\\.\\-\\/~]/g, '_');\n\t\t}",
"static cleanRepresentation(input) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds 5 minutes of focusTime & playTime up to 60 minutes | function addFocus() {
setFocusTime(prevTime => prevTime < 60 ? prevTime + 5 : prevTime);
setPlayTime(prevTime => prevTime < 3600 ? prevTime + 300 : prevTime);
} | [
"function increaseFocusDuration() {\n // If focusDuration is less than 60 minutes, increase focusDuration by 5\n if (focusDuration < 60) {\n // setFocusDuration fn takes focusDuration state & does the increase\n setFocusDuration(focusDuration + 5);\n }\n }",
"function incrFocusDuration() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Spec Section Functions Populate spec section. | function populateSpecSection(initFlag) {
var detailedRequirements = mainWidget.softwareCompetition.projectHeader.projectSpec.detailedRequirements;
var guidelines = mainWidget.softwareCompetition.projectHeader.projectSpec.finalSubmissionGuidelines;
var privateDescription = mainWidget.softwareCompetition.project... | [
"set spec(value) {\n if (value) {\n this._spec = value;\n }\n }",
"function extendSpecification(spec) {\n Object.assign(awsData_1.awsResources, mergeOptions(awsData_1.awsResources, spec));\n}",
"function putSpecs () {\n\t\tvar specsLayer = null;\n\t\tfor (var i = 0; i < doc.layers.length; i ++) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an object whose keys are variable names used in the code and whose values are variable identifiers. 'name' is the category of variables to extract, such as 'ain', 'aout' and 'mem'. | function variables(name, str) {
var re = new RegExp(name + '\\.([a-zA-Z_][a-zA-Z_0-9]*)', 'g');
var nameVar = {}, varname, vartype;
var match = null;
while (match = re.exec(str)) {
if (!(match[1] in nameVar)) {
varname = name + '_' + match[1] + '_' + (variables.count++);
... | [
"function getAllVariables(){\n allVariables = Array.from(document.querySelectorAll('[name]'))\n .map(function(element){\n return {type: element.className, name: element.attributes.name.value};\n });\n console.log(allVariables);\n}",
"function getVars(src) {\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display Third day weather to UI | function displaythirdDayWeather(){
thirddayIconElement.innerHTML = `<img src="icons/${weather.iconId}.png" width=30% height=30%/>`;
thirddayTempElement.innerHTML = `${weather.temperature.min}°<span>C</span>/${weather.temperature.max}°<span>C</span>`;
thirddayDescElement.innerHTML = weather.description;
} | [
"function displayForecastDay3(response) {\n \n\n // transfer to the html\n $(forecastDayThreeDate).html(\"<h3>\" + \" (\" + response.data[3].datetime + \")</h3>\" );\n $(forecastDayThreeTemp).text(\"Temperature: \" + response.data[3].temp);\n $(forecastDayThreeHumidity).t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a cloud sprite. | function addSpriteCloud() {
// Clean up all clouds
destroyClouds();
// Create new cloud
var x = RATIO * game.world.width;
var y = randint(MIN_CLOUD_Y, MAX_CLOUD_Y);
var cloud = groupClouds.create(x, y, 'cloud');
unsmoothSprite(cloud);
scaleSprite(cloud);
return cloud;
} | [
"function newCloud(x, y, width, height, vel) {\n let img = document.createElement(\"img\");\n img.src = 'images/cloud.png';\n img.width = width;\n img.height = height;\n img.style.position = \"absolute\";\n img.style.top = y + \"px\";\n img.style.left = x + \"px\";\n document.getElementById(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the description of projects to none and toggles them on and off based on mouseover and mouseout and screen size | function toggleDescriptions(){
if(screen.width >= 960){
console.log(screen.width)
for(let i = 0; i < projectDescription.length; i++){
projectDescription[i].style.display = 'none';
}
for(let i = 0; i < projectCard.length; i++){
projectCard[i].addEventListener(... | [
"function showProjectTitleAndMag(){\n $('.project').on({\n mouseenter: function(){\n $(this).find('.project-title, .magnifying-icon').show(); \n },\n mouseleave: function(){\n $(this).find('.project-title, .magnifying-icon').hide();\n }\n })\n if ($(wind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns binary_cookiesets & decimal_cookiesets which only have specific number of cookies marked. For example is 'x' = 2, and tot_cookies = 3, then [['0', '1', '1'], ['1', '0', '1'], ['1', '1', '0']] will get returned. Marked cookies will be omitted while populating shadow_cookie_store. If any of the cookies in the abo... | function generate_binary_cookiesets_X(url,
x,
tot_cookies,
verified_strict_account_decimal_cookiesets,
verified_non_account_super_decimal_cookiesets) {
var my_binary_cookiesets = [];
var my_decimal_cookiesets = [];
var tot_sets_equal_to_x = 0;
if (tot_cookies ... | [
"function generate_binary_cookiesets_X_efficient(url, \n\t\t\t\t x, \n\t\t\t\t tot_cookies, \n\t\t\t\t verified_strict_account_decimal_cookiesets,\n\t\t\t\t verified_non_account_super_decimal_cookiesets) {\n var my_binary_cookiesets = [];\n var my_decimal_cookiesets = [];\n var tot_sets... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the manager object for the given widget type name. The manager is expected to provide `sanitize`, `output` and `load` methods. Normally | setWidgetManager(name, manager) {
self.widgetManagers[name] = manager;
} | [
"getWidgetManager(name) {\n return self.widgetManagers[name];\n }",
"function SetType(type) {\n delet = false;\n selectedType = type;\n ResetPartsGUI(); \n CreatePartGUI();\n}",
"function setSelectedWidget() {\n var widgetType = $('#widget_type').val();\n switch(widgetTy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the file name and drop the other letters in URL. getFileName() | function getFileName(url) {
var tmp,last;
last = url.lastIndexOf('\\');
tmp = url.substring(last + 1, url.length);
return tmp;
} | [
"function getFileName(url) {\n\t\tvar m = /(?:\\/|#|\\?|&)(([^?\\/#&]*)\\.\\w\\w\\w\\w?)$/.exec(url);\n\t\treturn decodeURIComponent(m && m[2] ? m[1] : url.split('/').pop());\n\t}",
"function getFileName(url) {\n return url.substring(_.lastIndexOf(url, '/') + 1, url.length);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
'pre' hook: executed BEFORE the user answers the query. | pre(done) {
this.setAnswer(true);
// You can also have the engine skip the query.
// Notice that we are passing in the callback (`done`) to
// `this.skip()`! Therefore you do NOT need to invoke `done()`.
return this.skip(done);
} | [
"async preQueryHook () {\t\t\n\t}",
"function fnPreEnterQuery() {\n\tvar execute = true;\n\tdebugs(\"In fnPreEnterQuery\", \"A\");\n\tif (gAction == 'ENTERQUERY') {\n\t\tshowErrorAlerts('IN-HEAR-152');\n\t\treturn false;\t\n\t}\n\treturn execute;\n}",
"function fnPreEnterQuery() {\n fnResetStyle();\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the multplicative inverse of a mod m | function modInv(a, m)
{
if (a == null || m == null)
{
throw new Error("Invalid arguments to inverseMod");
}
// Extended Euclidian algorithm finds Bézout identity
// (we don't need the second Bézout coefficient or the actual gcd):
let t = 0,
newT = 1,
r = m,
newR = a;
while (newR !== 0)
{
const quoti... | [
"function calculateMultInverse(a,m) {\n var v = 1;\n var d = a;\n var u = (a == 1);\n var t = 1-u;\n if (t == 1) {\n var c = m % a;\n u = Math.floor(m/a);\n while (c != 1 && t == 1) {\n var q = Math.floor(d/c);\n d = d % c;\n v = v + q*u;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Access to social methods | get social() {
return this.create(SocialQuery);
} | [
"function Social() {\n}",
"function SocialWrapper() {\n\n /*\n * Retrieves the current viewer.\n */\n this.getViewer = function(callback) {\n osapi.people.getViewer().execute(callback);\n }\n\n /*\n * Retrieves the current owner.\n */\n this.getOwner = function(callback) {\n osapi.people.getOwn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract best quality audio | function getBestAudio(info) {
// Get only results that contain audio only in their
// format description
const audioResultsOnly = info.formats.filter(
result => result.format.includes('audio only') && result.acodec == 'opus'
);
// Check the higher quality one of all audio urls
const bestQualityAudio = ... | [
"function extractAudio(bytes) {\n var tree = helpers_1.parse(bytes);\n var finder = new finder_1.Finder(tree);\n var offset = 8 * 6;\n var ftyp = {\n majorBrand: \"M4A \",\n minorVersion: 1,\n compatibleBrands: [\"isom\", \"M4A \", \"mp42\"]\n };\n ftyp.bytes = new composer_bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete dataset in clientside database | function clientDB() {
/**
* object store from IndexedDB
* @type {object}
*/
var store = getStore();
/**
* request for deleting dataset
* @type {object}
*/
var request = store.delete( key );
// set success callback
r... | [
"function del() {\n\n // read existing dataset\n getDataset( data.del, existing_dataset => {\n\n // delete dataset and perform callback with deleted dataset\n collection.deleteOne( { _id: convertKey( data.del ) }, () => finish( existing_dataset ) );\n\n } );\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
subfunction to add closing LI and UL | function closingEndList(tmpPrev, tmpCur) {
let nbLevel = 0;
nbLevel = tmpPrev - tmpCur;
for (let i = 0; i < nbLevel; i++) {
htmlResult += '</ul>\n</li>\n';
}
} | [
"function closeListItem() {\n\t\t\tvar node = xmlNode;\n\t\t\twhile (node != rootNode && node.nodeName.toLowerCase() != 'ul' && node.nodeName.toLowerCase() != 'ol' && node.nodeName.toLowerCase() != 'li') {\n\t\t\t\tnode = node.parentNode;\n\t\t\t}\n\t\t\t\n\t\t\tif (node.nodeName.toLowerCase() == 'li') {\n\t\t\t\tx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that replaces specific words with random words from rita lexicon | function processRita() {
let input = $('#input'); // is now populated with a quote
let rs = new RiString(input.text()); // turn the text of input into string
let words = rs.words(); // extracting individual words from the string
let pos = rs.pos(); // defining part of speech for every word
let probability = ... | [
"function changeWord() {\n // split into words\n let words = RiTa.tokenize(canzone);\n\n // fa partire il loop da un punto random all'interno del testo\n let r = floor(random(0, words.length));\n for (let i = r; i < words.length + r; i++) {\n let idx = i % words.length;\n let word = words[idx].toLowerCas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
should print false PrintSum /Please complete the code below to have the function print integers from 0 to 255 and with each integer print the sum so far. Have the function return the final sum | function printSum(x){
sum = 0;
//your code here
for(var i = 0; i < 255; i++){
sum = sum + i
console.log(sum)
}
return sum
} | [
"function PrintIntsAndSum0To255(){\n}",
"function printSum(x) {\n var sum = 0;\n for (var i = 0; i <= 255; i++) {\n sum = sum + i;\n console.log((\"i:\", i, \"sum:\", sum));\n }\n return sum;\n}",
"function printIntAndSum() {\n let sum = 0\n for(let i = 0; i<=255; i++){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Language: HTMLBars Requires: xml.js, handlebars.js | function htmlbars(hljs) {
// This work isn't complete yet but this is done so that this technically
// breaking change becomes a part of the 10.0 release and won't force
// us to prematurely release 11.0 just to break this.
var SHOULD_INHERIT_FROM_HANDLEBARS = hljs.requireLanguage('handlebars');
// https://gi... | [
"get markup() {}",
"function Easybars() {\n var args = arguments;\n if (this instanceof Easybars) {\n var _options = args[0] || {};\n var options = extend({}, defaultOptions, _options);\n var tags = extend({}, defaultTags, _options.tags);\n var tagOpen = tags.raw[0];\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the message list section | function getMessageList() {
if (props.messageGroupDetails === undefined || props.messageGroupDetails.messages === undefined ||
props.selectedMsg === undefined) {
return (React.createElement("div", {className: 'msg-listing-wrap', id: 'msg-list-container'}, React.createElement("ul", {class... | [
"getSectionData() {\n\t let inbox = this.props.store.messages.inbox.messages;\n\n\t let lastStationName = [];\n\t let lastMessageType = \"\";\n\t let sections = [];\n\t let stationIndex = -1;\n\t let lastDateGroup = \"\";\n\n\t for (var i = 0; i < inbox.length; i++) {\n\t let msg = inbox[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a chaser robot. | function chaser_create(pos, target_entity) {
var coords = map_get_tile_coords(pos.row, pos.col);
// creates an entity
var entity = entity_manager_create_entity();
// attaches the components
physics_component_add(entity, coords, 0, physics_create_circular_shape(3.5));
robot_move_component_add(e... | [
"function makeRobot() {\n container = document.querySelector(\"#container\");\n let cw = container.width;\n let ch = container.heigh;\n\n robot = document.createElement(\"img\");\n robot.id = \"robot\";\n robot.setAttribute(\"src\", \"/img/robot.png\");\n robot.style.position = \"absolute\";\n robot.style.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.Headers` resource | function cfnRuleGroupHeadersPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnRuleGroup_HeadersPropertyValidator(properties).assertSuccess();
return {
MatchPattern: cfnRuleGroupHeaderMatchPatternPropertyToCloudFormation(properties.matchPatt... | [
"function cfnRuleGroupCustomHTTPHeaderPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnRuleGroup_CustomHTTPHeaderPropertyValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(properties.name),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts the custom attributes from the JWT. | function customAttributes(jwtPayload) {
if (jwtPayload[exports.mappingUserFields.customAttributes.keyInJwt]) {
return jwt_1.readPropertyWithWarn(jwtPayload, exports.mappingUserFields.customAttributes.keyInJwt);
}
return new Map();
} | [
"function customAttributes(decodedToken) {\n if (decodedToken[exports.mappingUserFields.customAttributes.keyInJwt]) {\n return jwt_1.readPropertyWithWarn(decodedToken, exports.mappingUserFields.customAttributes.keyInJwt);\n }\n return new Map();\n}",
"function _generateAttributes(customAttributes)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check checking height until it is set (iframe fully rendered) | function checkHeightAndReturn() {
const iframe = d3Select(this.root).selectAll('iframe');
lastHeight = height;
height = parseInt(iframe.node().style.height.replace("px", ""));
if(height > 0 && heightStableSince > 3) {
this.props.onLoadSuccess(height, this.props.item);
window.clea... | [
"function iframeLoaded(){\n var height = ($('iframe').contents().height()) + 20;\n Ext.getCmp(\"pageViewContent\").setHeight(height);\n}",
"function iframeLoaded() {\r\n bug(isdebug);\r\n var iFrameID = document.getElementById('Iframe_synap');\r\n if (iFrameID) {\r\n // here you can make the height, I... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the controller for companyList/Cpage.html mainly for company to dispalay their infomation | function Cpage($scope,$routeParams,StaticResource,CompanyInfo,ResumePostManager){
$scope.ResourceURLs = StaticResource.getResourceURLs('Cpage');
CompanyInfo.CompanyBasicInfo($routeParams['cid'],function(result){
$scope.company = result.data;
});
CompanyInfo.CompanyJoblist($routePa... | [
"function companyList($scope,StaticResource,CompanyInfo){\r\n $scope.ResourceURLs = StaticResource.getResourceURLs('companyList');\r\n\r\n $scope.getComListCallBack = function(result){\r\n $scope.companys = result.data;\r\n for(var i = 0 ; i < $scope.companys.length ; i++){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle item insertion with position | _handleItemPositionInserting(item, targetItem, position) {
const that = this;
if (item.autoHide || position.indexOf('layout') > -1) {
that._handleLayoutItemInserting(targetItem, item, position);
}
else if (position.indexOf('outside-') > -1) {
that._handleOutsideI... | [
"insertAt(item, pos) {\n let counter = 1;\n let currNode = this.head;\n while (counter !== pos && currNode !== null) {\n currNode = currNode.next;\n counter++;\n }\n this.insertBefore(item, currNode.value)\n }",
"insertAt(newItem, pos) {\n let stepper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
opens a new window and writes data in CSV format. | function writeToWindow(points) {
var str = '';
var ide = this.world.children[0];
var radii = [];
var angles = [];
var keys = [];
for(var key of points.keys()) {
keys.push(key);
}
keys.sort(fun... | [
"function downloadCSV() {\n const urlParameters = generateUrlParams(lastQuery);\n const url = window.location.origin + \"/csv?\" + urlParameters;\n\n window.open(url);\n}",
"function displayCSV() {\n let head = keys.join();\n let body = \"\";\n values.forEach(d => {\n body += d.join() + \"\\n\";\n });\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
As a writer I want to be able use a pencil to write text on a sheet of paper so that I can better remember my thoughts | write(addToPaper,onPaper){cov_1rtpcx8cw8.f[1]++;let availableLetters=(cov_1rtpcx8cw8.s[2]++,this.pointDegradation(addToPaper));// Write the letters of the string you can write with the pencil
cov_1rtpcx8cw8.s[3]++;if(onPaper){cov_1rtpcx8cw8.b[0][0]++;cov_1rtpcx8cw8.s[4]++;return`${onPaper} ${availableLetters}`;}else{co... | [
"write(whatToWriteOnPaper,writtenOnPaper){cov_14q771vu2z.f[1]++;// Used to figure out what letters I can write\nlet whatICanWrite=(cov_14q771vu2z.s[3]++,this.pointDegradation(whatToWriteOnPaper));// Write the letters of the string you can write with the pencil\ncov_14q771vu2z.s[4]++;if(writtenOnPaper){cov_14q771vu2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the current location for the gamePlay interval | function getPlayerLocation() {
Titanium.Geolocation.getCurrentPosition( updatePlayerPosition );
} | [
"function currentLocation() \r\n{\r\n\treturn locations[player.location];\r\n}",
"getCurrent() {\r\n return this.player.getCurArea();\r\n }",
"getPlayerLocation() {\n return {\n id: this.playerId,\n pos: {\n rot: this.rotation.toFixed(1),\n top: this.top,\n left: this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This hack is necessary to ensure that the vscode.htmllanguagefeatures extension is activated in order to enable htmlLanguageParticipants support. Please see for more info. | async function activate() {
const htmlExtension = vscode.extensions.getExtension('vscode.html-language-features')
if (!htmlExtension) {
const output = vscode.window.createOutputChannel('Jinja')
output.appendLine(
'Warning: Could not find vscode.html-language-features. HTML Language Participants supp... | [
"function html() { return exports.htmlSyntax.extension; }",
"function htmlSupport() { return [htmlCompletion, javascriptSupport()]; }",
"function addExperimentalAppLanguages(){\n\t\tsupportedAppLanguages.push({value: \"---\", name: \"--Dev. Only--\", disabled: true});\n\t\tStringsLocale.getExperimentalAppLangua... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fucntion to get the time latency between a user sending a message and the bot particularly useful for long periods which may lead to issues being raised | function getTimeLapse(session){
console.log("getTimeLapse() executing");
var botTime = new Date(session.userData.lastMessageSent);
var userTime = new Date(session.message.localTimestamp);
var userTimeManual = new Date(session.userData.lastMessageReceived);
console.log("Time Lapse Info:");
var timeLapseMs = userTi... | [
"function timeRequest() {\n const before = getTime();\n\n const sucessful = sendRequest();\n\n const difference = getTimeDifference(before);\n\n return difference;\n}",
"timeLeft(sender_id) {\n let user = this.getUser(sender_id);\n let currTime = new Date().getTime();\n let retVal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region function RetrieveRadioButtonValue(groupName) / This method allows us to find which radio button was checked in the group of radio buttons | function RetrieveRadioButtonValue(groupName) {
// debugger;
var value = "";
var radioButtonGrouping = document.getElementsByName(groupName);
if (radioButtonGrouping && radioButtonGrouping.length > 0) {
// We need to search for which radio button was selected
// by looking at the checked ... | [
"function getSelectedValue(groupName) {\n var radios = document.getElementsByName(groupName);\n for( i = 0; i < radios.length; i++ ) {\n if( radios[i].checked ) {\n return radios[i].value;\n }\n }\n return null;\n }",
"function getCheckedValue(radioGroup) {\n\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translate the receipt to web3 format by converting BigNumbers (note: these are ethers BigNumbers) to numbers | function translateReceipt(receipt) {
return Object.assign({},
...Object.entries(receipt).map(([key, value]) => ({
[key]: Utils.is_big_number(value)
? value.toNumber()
: value
}))
);
} | [
"function EURtoVND(eur){\n return(eur*26544.67);\n}",
"function moneyConvert(){ //calling the function\n\n fetch(endpoint) //fetching the data\n .then( response => response.json())\n .then(data => {\n const euroAmount ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
color a event sheet cell | function colorEventCell(str,r,c)
{
globalEventSheet.getRange(r , c).setBackground(str);
} | [
"function cellColorAlarm(s) {\n\t //e.g. A1 1~100 red\n\t $.each(s.cellBind.colorRangeData, function (i, e) {\n\n\t var cell,\n\t cellValue,\n\t sheetColorHash = s.sheet.colorhash,\n\t sheetColors = s.sheet.colors;\n\n\t if (s.sheet.cells[e.coord] && s.sheet.cell... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter the results with the genre selected | function filterByGenre(genre) {
$('.results .result').each(function () {
// reset display to all the .result
$(this).removeClass('display-none');
// add .display-none if genre doesn't match
if (!($(this).attr('data-attribute').includes(genre))) {
$(this).addClass('display-none');
}
});
} | [
"filterFilmsViewByGenre(genre) {\n this.fullList.forEach(filmData => {\n this.elem.galleryList.querySelector(`[data-id=\"${filmData.id}\"]`).style.display =\n (filmData.genres.includes(genre) || genre === '-') ? 'block' : 'none';\n });\n }",
"function filterByGenre(genre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================== End edit mode ============================================== ============================================== Speech recognition ============================================== | function speechRecognitionSetup() {
let p = document.createElement('p');
var words = document.querySelector('.words')
words.appendChild(p);
speechRecognition.addEventListener('result', e => {
const transcript = Array.from(e.results)
.map(result => result[0])
.map(result ... | [
"onSpeechRecognitionEnd_() {\n // Stop dictation if it wasn't already stopped.\n this.stopDictation_();\n }",
"function recognize() {\n recognizer = new speechRecognition();\n recognizer.continuous = RECOGNIZER_CONTINUOUS;\n recognizer.lang = RECOGNIZER_LANG;\n recognizer.interimResults = RECOG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to render Command | function renderCommand(command) {
var formGroup, button;
if (!buttonDiv) {
formGroup = document.createElement("div");
formGroup.className = 'form-group';
panelForm.appendChild(formGroup);
buttonDiv = document.createElement("div");
buttonDiv.className = 'col-sm-offset-3 col-sm-9';
... | [
"function UpdateRenderCommand(Command)\n\t\t{\n\t\t\tif ( !Command )\treturn;\n\t\t\tif ( Command[0] == 'Draw' )\n\t\t\t{\n\t\t\t\t//\tgeo\n\t\t\t\tCommand[1] = this.AssetManager.GetAsset(Command[1],RenderContext);\n\t\t\t\t//\tshader\n\t\t\t\tCommand[2] = this.AssetManager.GetAsset(Command[2],RenderContext);\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch the user's list of Burners. | fetchBurners() {
return fetch(`${this.apiBaseUrl}/v1/burners`, {
method: 'GET',
headers: this._headers(),
})
.then(this._checkStatus)
.then(this._parseJSON)
} | [
"getBooksForUser(username, cb) {\n User.getBooksForUser(username, (err, user) => {\n if (err) {cb(err);}\n else {cb(null, user.bookList);}\n });\n }",
"function getBillsForUser(userEmail) {\n var queryURL = baseUrl + 'api/users/bills/';\n $.ajax({\n url: queryURL ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the Authorization context. Currently this is simply the MedCommons ID of the authenticated user; perhaps something more complex will be needed in the future. It is typically called from the body's onload handler. | function setAuthorizationContext (accountId) {
//alert ("Authorization Context: " + accountId);
setContextURL(baseURL + "setAuthorizationContext?accountId="
+ accountId);
return (true);
} | [
"function AuthContext() {\n\t _classCallCheck(this, AuthContext);\n\n\t this._onBehalfOf = undefined;\n\t this._keyLevel = _config2.default.KeyLevel.LOW;\n\t this._customerInitiated = false;\n\t }",
"setAuthorized(authorizationData) {\n this.isAuthorized = true\n this.authoriz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shuffles the array of elemeent and sets the board again | function shuffleBoard() {
for (var i = pack.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = pack[i];
pack[i] = pack[j];
pack[j] = temp;
}
setBoard(pack);
} | [
"shuffleBoard() {\n \tvar i = 0\n var j = 0\n var temp = null\n \t\tfor (i = this.cells.length - 1; i > 0; i -= 1) {\n \tj = Math.floor(Math.random() * (i + 1))\n \ttemp = this.cells[i]\n \tthis.cells[i] = this.cells[j]\n \tthis.cells[j] = temp\n \t}\n }",
"function puzzleS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds nxtdays to date_start and returns as a SQL formatted string | function dateAddDays(date_start, nxtdays)
{
date_new = new Date(date_start.getTime() + nxtdays*(24*60*60*1000));
var month = date_new.getMonth()+1;
if (month<10) month = "0" + month;
var day = date_new.getDate();
if (day<10) day = "0" + day;
return date_new.getFullYear() + '-' + month + '-' + day;
} | [
"function getStartDayN(n) {\n // take the start and add n days to it ;)\n var startDayN = new Date(startDay0.getTime());\n startDayN.setDate(startDayN.getDate() + n);\n \n return startDayN;\n }",
"function formatStartDay(startDay) {\r\n return new Date(startDay + \" \" +\"00:00:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a list of the data node's subtree of descendent data nodes. To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes with correct levels. | getDescendants(dataNode) {
const startIndex = this.dataNodes.indexOf(dataNode);
const results = [];
// Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
// The level of descendants of a tree node must be greater than the level of the given
// tr... | [
"getDescendants(dataNode) {\n const startIndex = this.dataNodes.indexOf(dataNode);\n const results = [];\n // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.\n // The level of descendants of a tree node must be greater than the level of the given\n // tree node.\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global Drawable : false, SceneNode : false | function Scene() {
SceneNode.call( this );
this.drawableList = [];
} | [
"function Scene() {}",
"isDrawable() {\n return true;\n }",
"function createSceneGraphModule() {\n\n // Part names. Use these to name your different nodes\n var CAR_PART = 'CAR_PART';\n var FRONT_AXLE_PART = 'FRONT_AXLE_PART';\n var BACK_AXLE_PART = 'BACK_AXLE_PART';\n var FRONT_LEFT_TI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a query string to regex without throwing an error. | toRegex(query) {
try {
return new RegExp(query, "i");
}
catch (e) {
return query;
}
} | [
"function parseQuery(query, state) {\n var emptyQuery = 'x^'; // matches nothing\n\n if (query === '') { // empty string matches nothing\n query = emptyQuery;\n } else {\n if (state.regexp === false) {\n query = parseString(query);\n query = query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateDonationAmount: updates donation price, used in Donation | updateDonationAmount(amount) {
this.setState({donationAmount: amount})
} | [
"function updateCostAndPrice() {\n $(\"#totalCostCalculated\").text(Math.round(totalCostCalculated * Math.pow(10, 2)) / Math.pow(10, 2));\n $(\"#sellingPriceAtSpan\").text($(\"#profitMarginInput\").val());\n $(\"#sellingPrice\").text((Math.round(sellingPrice * Math.pow(10, 2)) / Mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a function to the Player prototype called "attackWith". This function should use a random number between 7 and 0, to select a weapon from the weapons array property, at that index and retums that weapon. | attackWith() {
const randomWeaponIndex = Math.floor(Math.random() * 8);
return this.weapons[randomWeaponIndex];
} | [
"attack(weapon, enemy) {\n let damage = weapon.power * (Math.floor(Math.random(2)) + 1);\n enemy.hurt(damage);\n }",
"function chooseWeapon(num) {\n playerWeapon = weapons[num]\n randomWeapon()\n getStarted()\n}",
"attack() {\n this.enemy.takeDamage(this.weapon.damage);\n }",
"function equipWeap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. Make a "describeBook" function which accepts a book object as its only argument and returns the HTML which represents that book in your list. Your HTML should be semantic, and I would suggest an with well formatted data inside. It will be up to you how to lay out each row for a book in the list: whether or not to se... | function describeBook(book) {
let stock = INVENTORY[book.ISBN];
return `<tr><td><input type="checkbox" value= "${book.ISBN}"></td>
<td>${book.ISBN}</td>
<td class="title">${book.Title}</td>
<td class="author">${book.AuthorLastName}, ${book.AuthorFirstName}</td>
<td>${book.Year}</td>
<td><strong>${stock.nu... | [
"function renderBook(book) {\r\n const { title, authors, description, price, rating, quantity } = book;\r\n const content = `\r\n <div class=\"book\">\r\n <div class=\"details\">\r\n <div class=\"title\">\r\n ${title}\r\n <span class=\"rating\">${rating}</span>\r\n </div>\r\n <div... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mock functions Resets state of mock SensorProvider between test runs. | reset() {
if (this.active_sensor_ != null) {
this.active_sensor_.reset();
this.active_sensor_ = null;
}
this.get_sensor_should_fail_ = false;
this.resolve_func_ = null;
this.max_frequency_ = 60;
} | [
"async reset() {\n if (!testInternal.initialized)\n throw new Error('Call initialize() before reset().');\n testInternal.sensorProvider.reset();\n testInternal.sensorProvider = null;\n testInternal.initialized = false;\n\n // Wait for an event loop iteration to let any pending mojo c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GLOBAL UTILITY METHODS / prototype function to convert latlng to utm | function convertToUTM(obj) {
[obj.north, obj.east] = proj4(wgs84, utm, [obj.lat, obj.lng]);
} | [
"function LLtoUTM(EQUATORIAL_RADIUS, ECC_SQUARED) {\n return function (lat, lon, utmcoords, zone) {\n var squared = ECC_SQUARED,\n radius = EQUATORIAL_RADIUS,\n primeSquared = squared / (1 - squared),\n // utmcoords is a 2-D array declared by the calling routine\n // note: input of l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to count words per minute | function wordsPerMinute() {
wpmSecondsCounter++;
let inputText = TEXTAREA.value;
let minutesPassed = wpmSecondsCounter / 60;
let wordsTyped = inputText.length / 5; //1 word counts as 5 characters
wpm = Math.trunc(wordsTyped / minutesPassed);
WPM.innerHTML = wpm;
return wpm;
} | [
"function getWordsPerMinute() {\n if (wordCount == 0) {\n return 0;\n } else {\n let currentWPM = Math.round(wordCount / (seconds / 60));\n if (currentWPM > maxWPM) {\n maxWPM = currentWPM;\n }\n return currentWPM;\n }\n}",
"function wordsCount() {\n let t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves the messaging device token to the datastore. | function saveMessagingDeviceToken() {
// TODO 10: Save the device token in the realtime datastore
} | [
"function saveMessagingDeviceToken() {\n // TODO 10: Salva o token do devices de mensagens realtime datastore\n}",
"function saveMessagingDeviceToken() {\n firebase.messaging().getToken().then(function(currentToken) {\n if (currentToken) {\n // Saving the Device Token to the datastore.\n firebase.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the tick drawing distance. | _calculateTickAndLabelDistance() {
const that = this,
measurements = that._measurements;
if (that.scalePosition === 'none') {
that._plotLabels = false;
that._plotTicks = false;
measurements.innerRadius = measurements.radius;
return { majorTi... | [
"function calculateDistance() {\n\t\t\t\t\tif (event.touches.length > 1) {\n\t\t\t\t\t\tvar dx = event.touches[0].pageX - event.touches[1].pageX;\n\t\t\t\t\t\tvar dy = event.touches[0].pageY - event.touches[1].pageY;\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn Math.round(Math.sqrt(dx*dx + dy*dy));\n\t\t\t\t\t}\n\t\t\t\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of records retured in search Method to perform search on change of search field | searchRecords(event) {
this.searchText = event.target.value;
//If search text is blank hide list to show records
if (this.searchText === '') {
this.closeSearchList();
}
else {
//Call apex method searchRecords to fetch the matching records
sear... | [
"function search () {\n saveState();\n self.filtered = self.gridController.rawItems.filter(self.filterFunc);\n self.gridController.doFilter();\n }",
"searchFilter(e) {\n this.getSearchResults(formData)\n }",
"searchFilter(e) {\n this.getSearchResults(fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Array$prototype$chain :: Array a ~> (a > Array b) > Array b | function Array$prototype$chain(f) {
var result = [];
this.forEach(function(x) { Array.prototype.push.apply(result, f(x)); });
return result;
} | [
"function Array$prototype$chain(f) {\n var result = [];\n for (var idx = 0; idx < this.length; idx += 1) {\n for (var idx2 = 0, xs = f(this[idx]); idx2 < xs.length; idx2 += 1) {\n result.push(xs[idx2]);\n }\n }\n return result;\n }",
"function Array$prototype$chain(f) {\n var resu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funzione per modificare l'immagine grande sugli eventi | function gallery(){
var tutteLeImmagini = document.images; //salvo tutte le immagini in questa variabile
for(var i=0; i<tutteLeImmagini.length; i++){
tutteLeImmagini[i].onclick = CambiaImmagine; //ogni volta che si clicca sull'immagine,chiama la funzione CambiaImmagine
}
} | [
"function constroiEventos(){}",
"function notificationEvents() {\n notifications[eNotificationType.InstrumentEdited] = new delegate();\n notifications[eNotificationType.InstrumentEdited].Add(onInstrumentModified);\n\n notifications[eNotificationType.MinDealGroupEdited] = new deleg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init the service worker | _initServiceWorker() {
if (process.browser && 'serviceWorker' in navigator) {
if (envBoolean(process.env.ENABLE_SERVICE_WORKER)) {
navigator.serviceWorker
.register('/service-worker.js')
.then(() => {
console.log('> service worker registration successful');
})... | [
"async function initServiceWorker() {\n swRegisteration = await navigator.serviceWorker.register(\"/Sw.js\", {\n updateViaCache: \"none\"\n });\n\n // Get Service From Current State\n svcWorker =\n swRegisteration.installing ||\n swRegisteration.waiting ||\n swRegisteration.active;\n\n sendSWMessag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
layerAnchorClickEventHandler() Show user selected layer (active layer) | revealActiveLayer(activeLayer) {
// console.log('method: revealActiveLayer');
this.setActiveLayer(activeLayer);
// Hide unclicked layers
this.customLayers.forEach((layer) => {
if (layer !== activeLayer) {
this.map.setLayoutPro... | [
"function clickLayer() {\r\n // Outline and open popup on click\r\n this.openPopup();\r\n this.bringToFront();\r\n this.setStyle({\r\n weight: 2,\r\n opacity: 1\r\n });\r\n}",
"onclick(e){\n\t\tvar {x, y} = this.canvasMousePos(e);\n\t\tvar lcl = this.getLayerAt(x, y);\n\t\tif(lcl){\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate temporary form on dashboard to get overview of a game DEPRECATED | function validate_dashboard_overview() {
var form = get_form_data('#game_overview_form');
if (check_field_empty(form.game_id, 'Game Id'))
return false;
if (check_field_int(form.game_id, 'Game Id'))
return false;
var dataObj = {
"content" : [ {
"session_id" : get_co... | [
"function validate_game(f){\n\tf.edit_game_date.required = true;\n\tf.edit_game_time.required = true;\n\tf.edit_fieldRef.required = true;\n\tf.edit_weather.pattern = 'text';\n\tf.edit_referee.pattern = 'text';\n\tf.edit_umpire.pattern = 'text';\n\tf.edit_field_judge.pattern = 'text';\n\tf.edit_scorekeeper.pattern =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a [[Theme]] with formatter functions to a [[JsonTheme]] with string values. Used by [[stringify]]. | function toJson(theme) {
var jsonTheme = {};
for (var _i = 0, _a = Object.keys(jsonTheme); _i < _a.length; _i++) {
var key = _a[_i];
var style = jsonTheme[key];
jsonTheme[key] = style._styles;
}
return jsonTheme;
} | [
"function objectBuildTheme(themeString) {\n return themeString;\n}",
"function _themeGenToString(themeGeneration) {\n let conversionStr = \"\";\n\n Object.entries(themeGeneration).forEach(([ key, value ]) => {\n conversionStr += `${key}: ${value}; `;\n });\n\n // Set the root background and te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enlarge the output buffer if needed. | function enlargeOutputBufferIfNeeded(
numSamples)
{
if(numOutputSamples + numSamples > outputBufferSize) {
outputBufferSize += (outputBufferSize >> 1) + numSamples;
outputBuffer = resize(outputBuffer, outputBufferSize);
}
} | [
"shrink() {\n\t\t// noinspection ConditionalExpressionJS\n\t\tconst currentLength = (this.bitsCount >> 3) + (this.bitsCount % 8 ? 1 : 0);\n\t\tif (currentLength < this.buffer.byteLength) {\n\t\t\t//region Change size of buffer\n\t\t\tconst buffer = new ArrayBuffer(currentLength);\n\t\t\tconst view = new Uint8Array(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |