query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Send out a configuration change to a specific cv output | function updateCV(cvNo, cfgType) {
updateDisplay(controlEnum.cv, cvNo);
switch (cfgType) {
case cfgEnum.type:
var cType = document.getElementById("cType" + cvNo);
var cfgValue = cType.options[cType.selectedIndex].value;
break;
case cfgEnum.channel:
var cChannel = documen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getOutputConfig(outputNo) {\n var message = [0xF2, parseInt(outputNo), 0x00];\n output.send(message);\n}",
"UpdateConfig(IsTypeElectrovanne = true){\n // L'éléctrovanne a ete passée en ref, this._DeviceConfig a donc été updaté automatiquement\n // Clear view\n this._DeviceCont... | [
"0.60015124",
"0.5866086",
"0.57788116",
"0.5748291",
"0.563485",
"0.563485",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"0.5569332",
"... | 0.68379843 | 0 |
clear the tipped state | function clearTippedState() {
updateLocalStorage("firstTrans", null, true);
updateLocalStorage("firstEnglish", null, true);
updateLocalStorage("secondTrans", null, true);
updateLocalStorage("secondEnglish", null, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clearTip() {\n if (this.tip) {\n this.tip.remove();\n }\n }",
"clearOptions(){\n let element = p5Instance.select(`#div_${this.id}`);\n if(element){\n element.remove();\n this.command.context.chain.strokeWeight(1);\n }\n\n //clear tips div\n let... | [
"0.8205698",
"0.68592966",
"0.6853455",
"0.6846484",
"0.66044635",
"0.652934",
"0.64810276",
"0.64550215",
"0.6427024",
"0.6424683",
"0.6391714",
"0.63525516",
"0.627858",
"0.62115973",
"0.61676556",
"0.6152743",
"0.6085061",
"0.60799915",
"0.6075538",
"0.60671747",
"0.605995... | 0.7557254 | 1 |
The great thing about Context is that I do not need to prop drill or send props a million levels down components that need the data. If the header component needs to know how many cart items there are, can simply use Context to grab the data from Context. Begin by importing useContext hook and the Context.js file. Can ... | function Header() {
const {cartItems} = useContext(Context) //Header now has access to cartItems passed from Context.js
const cartClassName = cartItems.length > 0 ? "ri-shopping-cart-fill" : "ri-shopping-cart-line"
return (
<header>
<Link to='/'><h2>Add a pic to your cart</h2></Link>
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"render() {\n return(\n <section>\n <ProductConsumer>\n {value => {\n const { cart } = value;\n if (cart.length > 0 ) {\n return(\n <React.Fragment>\n ... | [
"0.6840279",
"0.6770556",
"0.6692442",
"0.6493587",
"0.6416381",
"0.63779193",
"0.63540834",
"0.6310186",
"0.62273693",
"0.61589193",
"0.6112734",
"0.6109229",
"0.60899305",
"0.60814184",
"0.60643816",
"0.6036759",
"0.60337096",
"0.60045105",
"0.59698683",
"0.59641194",
"0.59... | 0.79649675 | 0 |
Retrieve games from the db and display each of them in their own box in the DOM. | function getAndDisplayBoardGames() {
$.getJSON(GAMES_URL, function(result) {
let element = result.boardGames;
let boardGameElements = $(element).map(function(i) {
return makeBoardGame(
element[i].id,
element[i].name,
element[i].type,
element[i].players,
element... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function displayAllGames(){\n //getting games from server\n const gamesFromServer = await fetchApi.getGamesList();\n \n //turning the array of games from server in an array of game objects\n const gamesList = gamesFromServer.map(gameServer => new Game(gameServer._id,\n ... | [
"0.7738315",
"0.7157598",
"0.7124526",
"0.709009",
"0.6949459",
"0.6907674",
"0.6796303",
"0.6742492",
"0.6720351",
"0.66006285",
"0.65528107",
"0.6514968",
"0.6494533",
"0.6430729",
"0.6429563",
"0.640937",
"0.63698375",
"0.6365626",
"0.6361395",
"0.6359875",
"0.63030773",
... | 0.78202826 | 0 |
Converts the possible Proto values for a timestamp value into a "seconds and nanos" representation. | function X(t) {
// The json interface (for the browser) will return an iso timestamp string,
// while the proto js library (for node) will return a
// google.protobuf.Timestamp instance.
if (k(!!t), "string" == typeof t) {
// The date string can have higher precision (nanos) than the Date class
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function timestamp(value) {\n var sec_num = value;\n var hours = Math.floor(sec_num / 3600);\n var minutes = Math.floor((sec_num - (hours * 3600)) / 60);\n var seconds = sec_num - (hours * 3600) - (minutes * 60);\n\n if (hours < 10) {hours = \"0\"+hours;}\n if (minut... | [
"0.61944884",
"0.6172904",
"0.61444384",
"0.6076155",
"0.598291",
"0.5934147",
"0.58618325",
"0.57953477",
"0.5770812",
"0.57616484",
"0.5746951",
"0.5740002",
"0.5728548",
"0.5673633",
"0.5661902",
"0.5654098",
"0.55826855",
"0.5573661",
"0.5547079",
"0.55438244",
"0.5532006... | 0.6477154 | 0 |
We need to increment the the expected number of pending responses we're due from watch so we wait for the ack to process any messages from this target. | function Go(t, e) {
t.Gr.H(e.targetId), as(t).Ir(e)
/**
* We need to increment the expected number of pending responses we're due
* from watch so we wait for the removal on the server before we process any
* messages from this target.
*/;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function qo(t, e) {\n t.qr.U(e.targetId), is(t).mr(e)\n /**\n * We need to increment the expected number of pending responses we're due\n * from watch so we wait for the removal on the server before we process any\n * messages from this target.\n */;\n}",
"function yi(t, e) {\n t.Lh.cn(e.targetId), Pi(t... | [
"0.6354588",
"0.6063356",
"0.6009532",
"0.59084857",
"0.5731218",
"0.56757027",
"0.56292456",
"0.56292456",
"0.55994064",
"0.55994064",
"0.55994064",
"0.55994064",
"0.55994064",
"0.55994064",
"0.55809563",
"0.54880214",
"0.54589075",
"0.5421725",
"0.541631",
"0.53653264",
"0.... | 0.6336619 | 1 |
Validates that the value passed into a disjunctive filter satisfies all array requirements. | function ac(t, e) {
if (!Array.isArray(t) || 0 === t.length) throw new G(j.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
if (t.length > 10) throw new G(j.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ic(t, e) {\n if (!Array.isArray(t) || 0 === t.length) throw new S(_.INVALID_ARGUMENT, \"Invalid Query. A non-empty array is required for '\" + e.toString() + \"' filters.\");\n if (t.length > 10) throw new S(_.INVALID_ARGUMENT, \"Invalid Query. '\" + e.toString() + \"' filters support a maximum of 1... | [
"0.60129786",
"0.59701204",
"0.5967194",
"0.56729734",
"0.5492219",
"0.54477423",
"0.54401284",
"0.5364026",
"0.53592426",
"0.53367317",
"0.52147293",
"0.5212886",
"0.52078986",
"0.5169551",
"0.514781",
"0.514781",
"0.5132404",
"0.51155955",
"0.5093536",
"0.5093536",
"0.50895... | 0.5977336 | 1 |
Returns the download URL for the given Reference. | function getDownloadURL$1(ref) {
return getDownloadURL(ref);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDownloadURL$1(ref) {\n ref = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_2__[\"getModularInstance\"])(ref);\n return getDownloadURL(ref);\n}",
"function getDownloadURL$1(ref) {\n ref = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_2__[\"getModularInstance\"])(ref);\n return getDownloa... | [
"0.7094307",
"0.7094307",
"0.68362135",
"0.67945075",
"0.67945075",
"0.5476094",
"0.53607446",
"0.5350583",
"0.5334949",
"0.532935",
"0.52917105",
"0.5226913",
"0.5173156",
"0.5173032",
"0.5086403",
"0.5051225",
"0.5040319",
"0.5028431",
"0.50284004",
"0.5007989",
"0.500722",... | 0.7591768 | 0 |
If the container is not mounted, the toast is enqueued and the container lazy mounted | function dispatchToast(content, options) {
if (isAnyContainerMounted()) {
eventManager.emit(0
/* Show */
, content, options);
} else {
queue.push({
content: content,
options: options
});
if (lazy && canUseDom) {
lazy = false;
containerDomNode = document.createElement... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_handleContainers() {\n const that = this;\n let customContainer;\n\n if (typeof that.appendTo === 'string') {\n customContainer = document.getElementById(that.appendTo);\n }\n else if (that.appendTo instanceof HTMLElement) {\n customContainer = that.appendT... | [
"0.64635724",
"0.61707586",
"0.61472493",
"0.60263795",
"0.59389144",
"0.5865036",
"0.5865036",
"0.5865036",
"0.5798342",
"0.5795055",
"0.57862246",
"0.5773392",
"0.57733667",
"0.5756452",
"0.5726893",
"0.57239175",
"0.5662659",
"0.5646763",
"0.56439126",
"0.5626736",
"0.5623... | 0.61894816 | 1 |
Sticky Header: Sticky que diminui e muda de cor ao descer scroll | function headerSticky(){
var windowPos=$(window).scrollTop();
if( windowPos>20){
// SCROLL
$('.fixed-top').addClass("on-scroll");
$('#svg-normal').removeClass("svg-hidden");
$('#svg-branca').addClass("svg-hidden");
$('.nav-link ').addClass("my-menu-scroll");
} else {
// FIXADO (É O INICIAL)
$... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function headerScroll() {\n // if the user scrolls (pageYOffset) past the header's position, add the sticky class\n if (window.pageYOffset > sticky) {\n header.classList.add(\"sticky\");\n } else {\n header.classList.remove(\"sticky\");\n }\n}",
"function stickyHeader() {\n\t\tif ($(this).scrollTop() >... | [
"0.7836382",
"0.78123975",
"0.7797711",
"0.7742905",
"0.7733957",
"0.7722661",
"0.76866084",
"0.7684398",
"0.7631536",
"0.7629325",
"0.76047796",
"0.7600059",
"0.75967664",
"0.75938654",
"0.75545096",
"0.7534285",
"0.752101",
"0.7438493",
"0.7432728",
"0.7430091",
"0.74183816... | 0.7846713 | 0 |
Each Big ass fan has a set of properties which in turn have fields | function BigAssFan (name, id, address, master) {
this.name = name;
this.id = id ? id : name; // Use the name as the backup if no ID is available
this.address = address;
this.master = master;
this.onPropertyUpdate = undefined;
this.propertyTable = {};
this.propertyListeners = [];
this.ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFootballerFields() {\n return {\n name: 'f.Name',\n nationality: 'f.Nationality',\n national_position: 'f.National_Position',\n national_kit: 'f.National_Kit',\n club: 'f.Club',\n club_position: 'f.Club_Position',\n club_kit: 'f.Club_Kit',\n Club_joining: 'f.Club_Joining',\n ... | [
"0.584687",
"0.5818533",
"0.5789593",
"0.578281",
"0.57685757",
"0.57273436",
"0.57199585",
"0.5649565",
"0.5644849",
"0.56244653",
"0.56109685",
"0.56071335",
"0.5603663",
"0.5587162",
"0.55673003",
"0.5563681",
"0.5561521",
"0.55544215",
"0.55418885",
"0.55418885",
"0.55404... | 0.63347363 | 0 |
Below are Utility functions TODO: Move to seperate file? This function supplies a callback which can be called N times, where N is the number of elements in tableBeingUpdated. Once this supplied callback has been called these N times it will call the passed in callback | function syncingCallback (tableBeingUpdated, callback) {
var callCount = 0;
var lengthOfTable = Object.keys(tableBeingUpdated).length;
var callbackForUser = function() {
if (++callCount == lengthOfTable) {
callback();
}
}
return callback ? callbackForUser : undefined;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTableUpdate() {\n\n}",
"OnBatchModified() { this.Trigger(\"BatchModified\", new tp.DataTableEventArgs()); }",
"function loopTable(tbl, fnCallback, data)\r\n{\r\n\t\r\n var r, c;\r\n if (!tbl || !fnCallback) \r\n\treturn; \r\n\t\r\n for (r = 0; r < tbl.rows.length; ++r) {\r\n if (false == fnC... | [
"0.6250899",
"0.5966186",
"0.5907514",
"0.5903033",
"0.5808794",
"0.5704752",
"0.5665094",
"0.56647724",
"0.56643546",
"0.5640744",
"0.56326276",
"0.562887",
"0.5627652",
"0.5622465",
"0.5616381",
"0.5612534",
"0.55800074",
"0.557757",
"0.5570843",
"0.55381286",
"0.55330604",... | 0.73815644 | 0 |
Function that logs all the elements of the slide (Use this to identify which element you'd need to be editting in your template) | function getElementId(){
slides.forEach(slide => {
const elements = slide.getPageElements();
elements.forEach(element => {
const type =
element.getPageElementType().toJSON().toLowerCase();
if (type === 'shape') {
console.log(element.getObjectId(),
element.asShape().getText().asString());
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function element() {\n\n\t\t/* -------------------------------------------------- */\n\t\t/* FUNCTIONS\n\t\t/* -------------------------------------------------- */\n\n\t\t//removeIf(production)\n\t\tfunction log(eventName, element) {\n\n\t\t\tconsole.log(Date.now(), eventName, element.getAttribute('data-src'));\n... | [
"0.63612473",
"0.59019667",
"0.5859344",
"0.576536",
"0.5757344",
"0.57444745",
"0.5658344",
"0.55799454",
"0.55766135",
"0.55766135",
"0.5566656",
"0.5450255",
"0.53970987",
"0.53786516",
"0.5368586",
"0.5366578",
"0.5363886",
"0.5359961",
"0.53568816",
"0.53385305",
"0.5337... | 0.63040286 | 1 |
Blob definition, blobs dictionary, chats list | function Blob(name, id, x, y, r) {
this.name = name;
this.id = id;
this.x = x;
this.y = y;
this.r = r;
this.lastchat = "";
this.lastchattime;
this.velx = 0;
this.vely = 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function BlobObject({\n selected,\n blob,\n blob: {\n path,\n size,\n },\n onBlob,\n depth,\n filepath,\n}) {\n const classes = useStyles();\n const _filepath = Path.join(filepath || '', path);\n const _blob = { ...blob, filepath: _filepath };\n\n const icon = selected ?\n <Note /> :\n <Note... | [
"0.5365265",
"0.5149661",
"0.5104014",
"0.5102951",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"0.5058914",
"... | 0.5772715 | 0 |
Generic utility function to convert and store loaded assets | function storeAssets(rawAssets, assets) {
var i;
for (i = 0; i < rawAssets.length; i++) {
var item = rawAssets[i];
switch (item.type) {
case "json":
// convert json text to js objects
var ssdata = JSON.parse(item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storeAssets(pRawAssets, pAssets) {\n var i;\n for (i = 0; i < pRawAssets.length; i++) {\n\n var item = pRawAssets[i];\n\n switch (item.type) {\n\n case \"json\":\n var ssdata = JSON.parse(item.result.toString());\n var key;\n ... | [
"0.64630324",
"0.6379604",
"0.5777534",
"0.5743524",
"0.57175916",
"0.5616361",
"0.5603773",
"0.5601755",
"0.55718726",
"0.5504418",
"0.54917973",
"0.5473787",
"0.5431215",
"0.5429289",
"0.5414633",
"0.5375962",
"0.53727573",
"0.53727573",
"0.53649276",
"0.5341776",
"0.534135... | 0.64192057 | 1 |
var result = num 2; console.log(result); } doubleIT(10); doubleIT(20); doubleIT(30); | function doubleIT(num){
var result = num * 2;
return result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doubleIt(num){\n var result = num*2;\n //console.log(result);\n return result;\n}",
"function doubleIt(originalNum) {\n return originalNum * 2;\n // doubleIt2(originalNum);\n}",
"function double(num){\n retrun num * 2;\n}",
"function print2(a) {\r\n var i = a*a;\r\n console.log... | [
"0.80663586",
"0.72393644",
"0.7000456",
"0.67670286",
"0.6704399",
"0.6688087",
"0.6681446",
"0.6680673",
"0.6679995",
"0.66726714",
"0.6612493",
"0.6612493",
"0.6569017",
"0.6471641",
"0.64620453",
"0.6437362",
"0.6435516",
"0.643047",
"0.6415326",
"0.6412285",
"0.64104366"... | 0.8280793 | 0 |
Function: AnimateGame() Desc: redraw game UI at 60 fps | function AnimateGame()
{
var deltaTime = calculateDeltaTime();
ctx.fillStyle="gray";
ctx.fillRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);
// calling updating functions
updateGame(deltaTime);
godzilla.update(deltaTime);
// calling drawing functions
level.drawCurrentSection();
godzilla.draw();
ui.drawUI();
if(spa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function animate() {\n game.update();\n game.draw();\n window.requestAnimFrame(animate);\n}",
"function gameDraw()\n{\n\tstate.gameDraw();\t\n\t/* repeat */\n\trequestAnimationFrame(gameDraw);\n}",
"function update_game_area()\n{\n\t// clear and draw the game\n\tgame.clear();\n\tgame.draw();\n\n\t// request... | [
"0.79577124",
"0.79204696",
"0.77477986",
"0.7599255",
"0.7419862",
"0.7417737",
"0.7394028",
"0.7325469",
"0.72789335",
"0.72488004",
"0.722483",
"0.7221095",
"0.72069365",
"0.71881986",
"0.71881986",
"0.7149347",
"0.7113249",
"0.71051836",
"0.708875",
"0.70848435",
"0.70845... | 0.7969844 | 0 |
capitalizeFish(fish) //> ["Rainbow Trout", "Smallmouth Bass", "White Bass", "Channel Catfish"] | function capitalizeFish(arr){
var output= [];
for(var i=0; i<arr.length; i++){
var words = arr[i].split(' ')
for(var i=0; i<words.length; i++){
var string = ' ';
string += words[i][0].toUpperCase() + ' '
output.push(string)
}
}
return output;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static capitalize(word){\n let arr;\n arr = word.split(\"\")\n arr[0] = arr[0].toUpperCase()\n return arr.join(\"\")\n }",
"function capMe(arr){\n return arr.map(name => name[0].toUpperCase()+name.slice(1).toLowerCase())\n}",
"static capitalize(string){\n let array = string.split(\"\")\n ... | [
"0.75144976",
"0.74939746",
"0.73091936",
"0.7307204",
"0.7294937",
"0.7282919",
"0.7275745",
"0.7245947",
"0.72225755",
"0.72188747",
"0.7216572",
"0.7214936",
"0.7205977",
"0.71874017",
"0.71864676",
"0.7176135",
"0.71725285",
"0.71654165",
"0.7160387",
"0.7154906",
"0.7109... | 0.77623135 | 0 |
Divide o tempo restante pelo limite de tempo definido. | function calculateTimeFraction() {
const rawTimeFraction = timeLeft / TIME_LIMIT;
return rawTimeFraction - (1 / TIME_LIMIT) * (1 - rawTimeFraction);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateTimeFraction(){\n const rawTimeFraction = timeLeft/TIME_LIMIT;\n return rawTimeFraction - (1/TIME_LIMIT)*(1-rawTimeFraction);\n}",
"function calculateTimeFraction() {\n const rawTimeFraction = timeLeft / TIME_LIMIT;\n return rawTimeFraction - (1 / TIME_LIMIT) * (1 - rawTimeFraction)... | [
"0.6427619",
"0.64026827",
"0.63441235",
"0.62956",
"0.6016386",
"0.59694535",
"0.58745134",
"0.5770383",
"0.5731822",
"0.5681515",
"0.5681515",
"0.5655364",
"0.5642839",
"0.56375587",
"0.56234527",
"0.55976516",
"0.5592725",
"0.5580524",
"0.55577207",
"0.5495662",
"0.5490438... | 0.64085555 | 1 |
Store a zoom (the action). low Number high Number delta Number, the delta at the time of creation. | function Zoom(low, high, delta) {
this.low = low
this.high = high
this.delta = delta
this.clock = CLOCK++
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"dispatchZoom() {\n const currentZoom = this.map.getZoom()\n store.dispatch(mapNewZoomLevel(currentZoom))\n }",
"function ZoomTheMap(action) {\n var zoom = geeMap.zoom;\n var newZoom;\n if ((action == 'out') && (zoom > 1)) {\n if (zoom == null || zoom == undefined) {\n zoom = 1;\n }\n newZ... | [
"0.67535096",
"0.6719172",
"0.63235873",
"0.61966604",
"0.6020492",
"0.60130024",
"0.60021496",
"0.59480286",
"0.59452313",
"0.59450483",
"0.59019655",
"0.58993906",
"0.58890414",
"0.58842355",
"0.5813428",
"0.5813428",
"0.5802597",
"0.57996863",
"0.5785746",
"0.57705003",
"0... | 0.7005082 | 0 |
when receives the event, get the passed parameter, then set the searchKey | handleSearchKeyChange(searchKey) {
this.searchKey = searchKey;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"updateSeachKey(event) {\n this.sVal = event.target.value;\n }",
"_handleChange(e){let root=this;root._getSearchText(root.$.input.value);root.resultCount=0;root.resultPointer=0;root.dispatchEvent(new CustomEvent(\"simple-search\",{detail:{search:root,content:e}}))}",
"function setQuery(event) {\n if ... | [
"0.6954283",
"0.6894655",
"0.6858838",
"0.6837542",
"0.68298215",
"0.6807385",
"0.67811495",
"0.67788804",
"0.6734207",
"0.6665596",
"0.66048765",
"0.6578741",
"0.65763336",
"0.65715134",
"0.65712166",
"0.6553152",
"0.65368044",
"0.652755",
"0.6525566",
"0.6523469",
"0.651793... | 0.73273426 | 0 |
whenever an item is selected in the list, fire an event called 'worklogSelected' and pass the id worklogDetail cmp will subscribe and receive the passed id | handleWorklogSelect(event) {
// fire worklogSelected event
fireEvent(this.pageRef, 'worklogSelected', event.target.worklog.Id);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleSelect(event){\n event.preventDefault();\n const selectedRecord = new CustomEvent(\n \"select\",\n {\n detail : this.record.Id\n }\n );\n this.dispatchEvent(selectedRecord);\n }",
"publishEvent()\n {\n this.SelectTextD... | [
"0.5983567",
"0.590266",
"0.5898898",
"0.5809221",
"0.576558",
"0.5738826",
"0.572189",
"0.5698076",
"0.5678588",
"0.56681263",
"0.56681263",
"0.5601361",
"0.55683696",
"0.555343",
"0.5536331",
"0.5529505",
"0.552085",
"0.552085",
"0.5513689",
"0.5503903",
"0.54795873",
"0.... | 0.80337405 | 0 |
get gallery width available for the grid | function getGalleryWidth(){
var galleryWidth = g_gallery.getSize().width;
galleryWidth -= g_options.theme_gallery_padding * 2;
return(galleryWidth);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getContainerWidth() {\n var justifiedGallery = document.querySelector('.h5p-image-gallery-justified-gallery');\n var containerWidth = window.parseFloat(getStyle(justifiedGallery, 'width'), 10);\n\n return containerWidth;\n}",
"get gridItemWidth() {\n return windowWidth / this.perRow;\n }",
... | [
"0.76472574",
"0.73596686",
"0.73596686",
"0.72407615",
"0.7226753",
"0.70842505",
"0.70842385",
"0.7031254",
"0.6956013",
"0.6905403",
"0.6865928",
"0.68087256",
"0.67982185",
"0.6773478",
"0.6715023",
"0.669615",
"0.6693829",
"0.66603106",
"0.6623402",
"0.6606289",
"0.65829... | 0.8095367 | 0 |
get estimated height of the carousel and the navigation | function getEstimatedHeight(){
var height = g_carousel.getEstimatedHeight();
if(g_objNavWrapper){
var navHeight = g_objNavWrapper.height();
height += navHeight + g_options.theme_navigation_margin;
}
return(height);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function carouselHeight() {\n\t\tlet $highest_name = 0;\n\t\tlet $highest_opinion = 0;\n\t\tlet $opinion_carousel_item = $('.opinion-carousel-item');\n\t\t// let $check = $opinion_carousel_item.first().height();\n\t\t$opinion_carousel_item.each(function() {\n\n\t\t\tlet $name = $(this).find('h2').outerHeight();\n... | [
"0.72735274",
"0.7221324",
"0.69437945",
"0.6937476",
"0.6801333",
"0.67256933",
"0.66504145",
"0.66012967",
"0.6580542",
"0.65283674",
"0.65259016",
"0.64384043",
"0.6438156",
"0.64160067",
"0.64160067",
"0.64082175",
"0.6391258",
"0.63795686",
"0.637627",
"0.63759464",
"0.6... | 0.85585076 | 0 |
on tile click open lightbox | function onTileClick(data, objTile){
objTile = jQuery(objTile);
var objItem = g_objTileDesign.getItemByTile(objTile);
var index = objItem.index;
g_lightbox.open(index);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onTileClick(data, objTile) {\n\n\t\tobjTile = jQuery(objTile);\n\n\t\tvar objItem = g_objTileDesign.getItemByTile(objTile);\n\t\tvar index = objItem.index;\n\n\t\tg_lightbox.open(index);\n\t}",
"function showLightBox() {\r\n // show the lightbox on a click\r\n lightBox.classList.add(\"show-lightbo... | [
"0.7861492",
"0.7102016",
"0.7094251",
"0.702728",
"0.69585866",
"0.6843303",
"0.68431795",
"0.6812166",
"0.67595047",
"0.65669864",
"0.6564325",
"0.65547514",
"0.655226",
"0.65192896",
"0.64644665",
"0.64521354",
"0.6438416",
"0.64090484",
"0.64072746",
"0.6356107",
"0.63554... | 0.7889215 | 0 |
on gallery size change resize the theme. | function onSizeChange(){
var galleryWidth = getGalleryWidth();
g_carousel.setMaxWidth(galleryWidth);
g_carousel.run();
positionElements();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onGalleryResized(){\n\t\t\n\t\tvar objSize = t.getSize();\n\t\t\n\t\tif(objSize.width == 0)\t//fix hidden gallery change\n\t\t\treturn(true);\n\t\t\n\t\tt.setSizeClass();\n\t\t\n\t\tvar objSize = t.getSize();\n\t\t\t\t\n\t\tif(objSize.width != g_temp.lastWidth || objSize.height != g_temp.lastHeight){\n\t\... | [
"0.7608168",
"0.7565466",
"0.70491743",
"0.70315003",
"0.69802207",
"0.68668324",
"0.68526614",
"0.6781173",
"0.6756136",
"0.6746419",
"0.6730867",
"0.6721987",
"0.670109",
"0.66285586",
"0.659833",
"0.6558521",
"0.655414",
"0.6551635",
"0.6495968",
"0.6492315",
"0.64857095",... | 0.7615044 | 0 |
before items request: hide items, show preloader | function onBeforeReqestItems(){
g_carousel.stopAutoplay();
g_carousel.getElement().hide();
if(g_objNavWrapper)
g_objNavWrapper.hide();
//show preloader:
g_objPreloader.fadeTo(1,1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onBeforeReqestItems() {\n\n\t\tg_objTilesWrapper.hide();\n\n\t\tif (g_objPreloader) {\n\t\t\tg_objPreloader.show();\n\n\t\t\tvar preloaderSize = g_functions.getElementSize(g_objPreloader);\n\t\t\tvar galleryHeight = preloaderSize.bottom + 30;\n\n\t\t\tg_objWrapper.height(galleryHeight);\n\t\t}\n\t}",
"f... | [
"0.74194235",
"0.71730095",
"0.67707187",
"0.67707187",
"0.6658971",
"0.6570021",
"0.65495616",
"0.63377964",
"0.6319287",
"0.6301473",
"0.63004076",
"0.6297756",
"0.629676",
"0.6284065",
"0.62811446",
"0.62766427",
"0.62766427",
"0.62730515",
"0.62730515",
"0.62730515",
"0.6... | 0.8057112 | 0 |
adds the node version and os, if available | function createVersionAndOSSpan() {
var span = $('<span>').attr('class', 'version-info');
if (node.status === 'online') {
$(span).text('v' + node.version);
}
if (node.os !== 'not available') {
$(span).text($(span).text() + ' on ' + node.os);
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSystemNodeVers(cb) {\n exec('node -v', function(err, stdout) {\n if (err) {\n return cb(err, null);\n }\n cb(null, stdout.slice(1).replace('\\n',''));\n });\n}",
"function osVerLog() {\n var osVer = document.querySelector(\".osVer\");\n\n var osysVer = result.os.vers... | [
"0.6059",
"0.5941218",
"0.5754391",
"0.5720927",
"0.5646538",
"0.55291003",
"0.54326206",
"0.5384328",
"0.53748035",
"0.53702587",
"0.5319351",
"0.52735156",
"0.52728313",
"0.52728313",
"0.52728313",
"0.52728313",
"0.52728313",
"0.52728313",
"0.52728313",
"0.5267898",
"0.5267... | 0.63475233 | 0 |
add the slot info | function addSlotInfo(slots) {
var slotsDiv = $('<div>')
.attr('class', 'icon-row')
.attr('data-src', index);
if (typeof slots !== 'object') {
return;
}
$.each(slots, function addli(k, v) {
$(slotsDiv).append($('<li>').attr('class', 'icon').attr('da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addEmptySlot(slot) {\n this.slotsInfo.push(slot);\n }",
"setSlot(index, info) {\n this.slots[index].load(\n info.name,\n info.count,\n info.ability,\n info.abilityLevel,\n info.edible,\n info.equippable,\n );\n }",
"function add_to_inventory (gObject, slot) {\r\n\r\n\tv... | [
"0.7585992",
"0.6806943",
"0.6751664",
"0.67017925",
"0.6581857",
"0.6552371",
"0.6415081",
"0.6391965",
"0.61901325",
"0.6130783",
"0.6118033",
"0.60135573",
"0.59843737",
"0.5880483",
"0.5873403",
"0.5849186",
"0.58488506",
"0.5833281",
"0.5815244",
"0.58152276",
"0.5784130... | 0.7236068 | 1 |
Callback that fetches response for list of regions. | function callback_GetRegionList(response, location){
if(location != 'local'){
dureUtil.storeAtLocal('RegionList', response);
}
//console.log("===========Response for Region List Service.=============");
if(response != undefined){
// Store the response of list of regions in a global variable.
dureMaste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function getRegions() {\n let fetchRegions = await fetch(`${APP_SERVER}/regions`, {\n method: 'GET',\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `Bearer ${token}`\n }\n });\n\n let allRegions = await fetchRegions.json();\n ... | [
"0.7391725",
"0.72698164",
"0.72273",
"0.70942533",
"0.70164376",
"0.69150966",
"0.68035585",
"0.67683315",
"0.6751007",
"0.67147505",
"0.6679845",
"0.6667966",
"0.66480315",
"0.6639733",
"0.65383196",
"0.64758414",
"0.6362269",
"0.6259258",
"0.6238388",
"0.6159004",
"0.61439... | 0.75086516 | 0 |
Prepare Region Summary data . | function prepareRegionSummaryData(){
var regionSummary,key;
if(level == 'target'){
regionSummary = param.data.regions[1].regionSummaryData[0];
key = 'regionSummaryData_'+dureUtil.appId+'_'+dureUtil.targetId+'_'+dureUtil.regionId;
}else{
regionSummary = param[0];
key = 'regionSummaryData_'+dureUtil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function prepData(region, county) {\n regionData = setupNumbers(_.clone(region[0], true));\n countyData = setupNumbers(_.clone(county[0], true));\n\n // Once we have the data, set up the visualizations\n setup();\n }",
"function prepData(local, region) {\n ... | [
"0.6711511",
"0.6654309",
"0.6508008",
"0.6501426",
"0.63881546",
"0.5993476",
"0.5668918",
"0.5628683",
"0.56062526",
"0.56007653",
"0.552126",
"0.5477149",
"0.5433403",
"0.5433234",
"0.5417397",
"0.5416065",
"0.53775233",
"0.53667456",
"0.5332945",
"0.53262484",
"0.53197426... | 0.79534745 | 0 |
Prepare Region level data . | function prepareRegionData(isocode){
//console.log("================= Preparing region data on click of function. ===================");
//console.log(param);
//console.log(dureUtil.getDataLevel());
var region;
try{
if(dureUtil.getDataLevel() == 'world'){
region = param[0]; ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function prepareRegionSummaryData(){\n\t\tvar regionSummary,key;\n\t\tif(level == 'target'){\n\t\t\tregionSummary = param.data.regions[1].regionSummaryData[0];\n\t\t\tkey = 'regionSummaryData_'+dureUtil.appId+'_'+dureUtil.targetId+'_'+dureUtil.regionId;\n\t\t}else{\n\t\t\t\n\t\t\tregionSummary = param[0];\n\t\t\tk... | [
"0.7077423",
"0.6710442",
"0.66620773",
"0.6584404",
"0.6457601",
"0.6197046",
"0.6075819",
"0.60102284",
"0.5887596",
"0.58674926",
"0.5828133",
"0.5790522",
"0.57330334",
"0.57255983",
"0.56842893",
"0.56573015",
"0.5619028",
"0.561402",
"0.5594431",
"0.55668265",
"0.553570... | 0.73982847 | 0 |
Callback function to fetch indicator data for a country. | function callback_GetCountryDrillDownData(resp){ // TODO double click on layer
var check, countryLcase, countryISO;
//console.log("========= Receiving response from indicator service for country. ==========");
//console.log(resp);
check = province.setDataForMap(resp);
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function callbackGetIndicatorData(resp){\n\t\n\t//resp = clubObjectData(resp); // custom change for indonesia only\n\t\n\tvar indicator = {};\n\t\n\t// var currentDataJSON = resp;\n\t\n\tdureUtil.storeAtLocal(\"CurrentJSONData\",resp);\n\tdureUtil.respJsonData = resp;\n\t\n\tif... | [
"0.7118049",
"0.7027244",
"0.6718506",
"0.6578561",
"0.65590173",
"0.6420327",
"0.6364477",
"0.6329146",
"0.63192713",
"0.6281332",
"0.6263738",
"0.61904216",
"0.61601144",
"0.6156028",
"0.6142664",
"0.60834527",
"0.6065831",
"0.60548574",
"0.60293555",
"0.6025812",
"0.602180... | 0.7563709 | 0 |
Callback function to fetch indicator data for a province in a country. | function callback_GetProvinceDrillDownData(resp){
var check,provinceLcase,drillDown = {};
//console.log("========= Receiving response from indicator service for province. ==========");
if(resp.indicators[1].geoInfo) { // if geoinfo is null than data not available for drill down
extendSummaryBoxDist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getProvinces(callback) {\n $.get(PATH_DATA, function(data) {\n callback(data);\n });\n }",
"function callback_GetCountryDrillDownData(resp){ // TODO double click on layer\n\tvar check, countryLcase, countryISO; \n\t//console.log(\"========= ... | [
"0.70563203",
"0.6921065",
"0.65525573",
"0.64477843",
"0.63904047",
"0.62202173",
"0.62095106",
"0.608646",
"0.6063318",
"0.6034133",
"0.59509206",
"0.5888756",
"0.5838083",
"0.5828785",
"0.5825496",
"0.5818033",
"0.58150846",
"0.58092767",
"0.5778703",
"0.5773035",
"0.57446... | 0.7058717 | 0 |
Callback function to fetch indicator data for a district in a province. | function callback_GetDistrictDrillDownData(resp){
var check,districtLcase,drillDown = {};
if(resp != undefined){
//console.log("========= Receiving response from indicator service for district. ==========");
//console.log(resp);
var currentView = dureUtil.retrieveFromLocal("currentView");
var year = dureUtil.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function callback_GetProvinceDrillDownData(resp){\n\tvar check,provinceLcase,drillDown = {};\n\t//console.log(\"========= Receiving response from indicator service for province. ==========\");\n\tif(resp.indicators[1].geoInfo) { // if geoinfo is null than data not available for drill down\n\t\texte... | [
"0.741552",
"0.6710152",
"0.65914536",
"0.62519777",
"0.62515813",
"0.61622715",
"0.6125612",
"0.6092796",
"0.605034",
"0.5992421",
"0.59470403",
"0.59314924",
"0.5786934",
"0.57749444",
"0.5712215",
"0.57017475",
"0.5697898",
"0.5612977",
"0.56109893",
"0.55992615",
"0.55936... | 0.7249939 | 1 |
callback function to fetch indicator data for worldwide. | function callbackGetDataForIndicator(resp){
//console.log(resp);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function callbackGetIndicatorData(resp){\n\t\n\t//resp = clubObjectData(resp); // custom change for indonesia only\n\t\n\tvar indicator = {};\n\t\n\t// var currentDataJSON = resp;\n\t\n\tdureUtil.storeAtLocal(\"CurrentJSONData\",resp);\n\tdureUtil.respJsonData = resp;\n\t\n\tif... | [
"0.7840322",
"0.68776685",
"0.63682216",
"0.6104986",
"0.60151863",
"0.6013135",
"0.59949183",
"0.5985027",
"0.59123516",
"0.59121364",
"0.589136",
"0.5830353",
"0.5825376",
"0.582445",
"0.58007216",
"0.5791866",
"0.57120967",
"0.5696045",
"0.56727725",
"0.5643519",
"0.563959... | 0.744673 | 1 |
Add ships to board to start game | startGame(){
// set initial list of ships
var ships = []
// TODO: Figure out how to use state instead of the hardcoded ship array length
// TODO: Dedupe these random numbers
// TODO: I think this loop would only find numbers 1-99 - so the 0 cell would never have a ship
for(let i = 0; i < 5; i++){
ships.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"#playerRegisterShips() {\n let self = this;\n let gameboard = document.querySelector(\".p1.gameboard\");\n\n for (let i = 0; i < self.shipLengths.length; i++) {\n let ship = gameboard.querySelector(`#player-ship${i}`);\n let originCell = ship.parentNode;\n let row = parseInt(originCell.data... | [
"0.69453776",
"0.69016135",
"0.6867861",
"0.67815346",
"0.6706311",
"0.66780055",
"0.6467803",
"0.64635384",
"0.6424828",
"0.64119816",
"0.64057714",
"0.6398265",
"0.6395861",
"0.63728935",
"0.6343739",
"0.6342039",
"0.63364965",
"0.6301645",
"0.628927",
"0.6274438",
"0.62694... | 0.712207 | 0 |
select the first product from PLP (product list page) | selectProduct()
{
//select the first product "Hydro Boost Hydrating 100% Hydrogel Mask" from PLP
cy.get('#search-result-items li:nth-child(1) > div > div.product-image > a.thumb-link > img.tile-hover-img').first().click()
cy.contains('Hydro Boost Hydrating 100% Hydrogel Mask').should('have.class', 'pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_selectFirstResult() {\n this._unsetProduct();\n\n const values = Object.values(this.products);\n\n if (values.length !== 0) {\n this._selectProduct(values[0].productId);\n }\n }",
"selectProduct()\r\n {\r\n //select the first product \"Hydro Boost Hydrating 100% Hydrogel Mask\" from PLP\r\... | [
"0.7749187",
"0.6803652",
"0.67834145",
"0.65123284",
"0.6412901",
"0.62798375",
"0.62002677",
"0.61500424",
"0.6138091",
"0.5998303",
"0.5874463",
"0.58325976",
"0.58319277",
"0.5820965",
"0.5816631",
"0.5813142",
"0.5794739",
"0.57548934",
"0.574752",
"0.5744491",
"0.566929... | 0.68378836 | 1 |
function to display the "your last guess was" text and the user input as a string need to set character limit to avoid layout issues if user puts too many characters | function displayInputString() {
guessSection.innerText = document.getElementById('main-input').value;
yourLastGuessWas.innerText = "Your last guess was";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function provideHint() {\n var diff = Math.abs(playersGuess - winningNumber);\n if (diff > 50) {\n return (\" Like whoa. Maybe try a different end of the spectrum.\")\n } else if (diff > 25) {\n return (\" You're a fair ways off.\")\n } else if (diff > 9) {\n return (\" Getting there!\... | [
"0.65955704",
"0.6552514",
"0.6485766",
"0.63645107",
"0.6296023",
"0.6291813",
"0.622558",
"0.6184189",
"0.6164261",
"0.60431194",
"0.60112804",
"0.6010159",
"0.60005355",
"0.5996081",
"0.59940296",
"0.5962371",
"0.59434223",
"0.5936515",
"0.59329545",
"0.59220487",
"0.58985... | 0.6603461 | 0 |
function to increase the min and max value by 10 if the user gets it right. requires updating random number and displayed text as well | function increaseValueOnWin() {
if (inputAsNumber() === randomNumber) {
min = min - 10;
max = max + 10;
randomNumber = generateRandomNumber();
updateMinMaxText();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function increaseMinMax() {\n min -= 10;\n max += 10;\n }",
"function setMinAndMaxRange(e) {\n e.preventDefault();\n var minRangeValue = parseInt(minRangeInput.value);\n var maxRangeValue = parseInt(maxRangeInput.value);\n minNumber.innerText = minRangeValue;\n maxNumber.innerText = maxRangeValue;\n ... | [
"0.7876842",
"0.7265026",
"0.7259452",
"0.72155595",
"0.70042276",
"0.69029903",
"0.68195987",
"0.6817799",
"0.68125135",
"0.6801334",
"0.67787904",
"0.6741652",
"0.6730772",
"0.66427886",
"0.66338354",
"0.6598857",
"0.6597892",
"0.65823984",
"0.6554854",
"0.6554776",
"0.6475... | 0.8606396 | 0 |
resetting the page on click to set a new random number and clear the input | function resetPage() {
randomNumber = generateRandomNumber();
mainInputField.value = "";
yourLastGuessWas.innerText = "";
guessSection.innerText = "";
response.innerText = "";
minValueField.value = "";
maxValueField.value = "";
guessButton.disabled = true;
clearButton.disabled = true;
console.log(ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetGame() {\n input.value = '';\n clicks = 0;\n counter.innerHTML = clicks;\n result.innerHTML = 'Escribe un número y dale a <em>Prueba</em>';\n randomNumberSelected = getRandomNumber(100);\n}",
"reset()\n {\n this.ios['oNumber'].value = random();\n this.somethingChange... | [
"0.77917445",
"0.7653434",
"0.757186",
"0.75453776",
"0.7529801",
"0.7505255",
"0.7498416",
"0.74326354",
"0.74301773",
"0.7424917",
"0.73839945",
"0.73293763",
"0.7303054",
"0.72767484",
"0.72727436",
"0.72583866",
"0.7246191",
"0.7244268",
"0.7230027",
"0.7144429",
"0.71355... | 0.7842736 | 0 |
defining a function as clearing the input field and replacing it with nothing | function clearInputField() {
mainInputField.value = "";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makingInputEmpty(input){\n input.value = \"\";\n}",
"function clearInput()\n {\n input.val('');\n }",
"function clearInput() {\n input.value = \"\";\n}",
"function inputClear() {\n $(\"#input\").val('');\n }",
"function emptyinput(input){\n input.value = '';\n}",
... | [
"0.85222286",
"0.8421155",
"0.84077895",
"0.8374974",
"0.83746433",
"0.83065104",
"0.8304415",
"0.8300815",
"0.8188344",
"0.8179926",
"0.8177442",
"0.81216776",
"0.8087433",
"0.80546963",
"0.8012403",
"0.7982768",
"0.79357404",
"0.790911",
"0.7897927",
"0.7892019",
"0.7883476... | 0.8454103 | 1 |
updates min and max variables to user preference | function updateMinMax() {
min = parseInt(minValueField.value);
max = parseInt(maxValueField.value);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setMinMaxValues(min, max) {\n numberGuessInput.min = min;\n numberGuessInput.max = max;\n}",
"function changeMaxAndMin(minRange, maxRange) {\n var minStorage = document.querySelector('#post-min-range');\n var maxStorage = document.querySelector('#post-max-range');\n if (minRange > 10) {\n minRan... | [
"0.77723277",
"0.74564195",
"0.71894366",
"0.7101179",
"0.7093725",
"0.70756304",
"0.70211023",
"0.7009616",
"0.6996617",
"0.68561935",
"0.6837021",
"0.68168294",
"0.6755944",
"0.67151153",
"0.6714827",
"0.668116",
"0.66805863",
"0.6622959",
"0.65554285",
"0.6431708",
"0.6429... | 0.82458675 | 0 |
given a size this function returns a size x size matrix of 0's this was also developed in class on Thu for the magic square program | function create( size ) {
var matrix = [];
for (var row = 0; row < size; row++) {
var numbers = [];
for (var col = 0; col < size; col++) {
numbers.push( Math.round(Math.random()) );
}
matrix.push( numbers );
}
return matrix;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeSquareMatrix(size, initial_value) {\n var matrix = new Array();\n for(var i = 0; i < size; ++i) {\n matrix[i] = new Array();\n for(var j = 0; j < size; ++j) {\n matrix[i][j] = initial_value; \n }\n }\n return matrix;\n}",
"zeroFill2DArray(size) {\n let arr = [];\n for (let i ... | [
"0.7332212",
"0.69786674",
"0.6894166",
"0.68610907",
"0.685041",
"0.6740863",
"0.6694448",
"0.666373",
"0.66592306",
"0.661407",
"0.65155184",
"0.64985037",
"0.64923203",
"0.6471987",
"0.6463586",
"0.6457295",
"0.64473385",
"0.6428496",
"0.6397168",
"0.63778824",
"0.6315176"... | 0.7014445 | 1 |
add a raw attr (use this in preTransforms) | function addRawAttr (el, name, value) {
el.attrsMap[name] = value;
el.attrsList.push({ name: name, value: value });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addRawAttr (el, name, value) {\n\t el.attrsMap[name] = value;\n\t el.attrsList.push({ name: name, value: value });\n\t}",
"function addRawAttr (el, name, value) {\r\n el.attrsMap[name] = value;\r\n el.attrsList.push({ name: name, value: value });\r\n}",
"function addRawAttr(el, name, value) {\n ... | [
"0.7494019",
"0.74636805",
"0.7457149",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
"0.7437616",
... | 0.7515597 | 0 |
Resolves a user's package by testing for 'package.json', 'ngpackage.json', or 'ngpackage.js'. | function resolveUserPackage(folderPathOrFilePath, isSecondary = false) {
return __awaiter(this, void 0, void 0, function* () {
const readConfigFile = (filePath) => __awaiter(this, void 0, void 0, function* () { return (fs_extra_1.pathExistsSync(filePath) ? Promise.resolve().then(() => require(filePath)) : u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resolvePackagePromise() {\n Promise.all(packageReadPromises).then(consumePackageJSON);\n}",
"function getPackageInfo(installPackage) {\n if (installPackage.match(/^.+\\.(tgz|tar\\.gz)$/)) {\n return getTemporaryDirectory()\n .then(obj => {\n let stream;\n ... | [
"0.5957767",
"0.5785935",
"0.5773347",
"0.57477826",
"0.5689804",
"0.5679574",
"0.56080633",
"0.55197024",
"0.5516892",
"0.54933256",
"0.53883624",
"0.5385214",
"0.53641623",
"0.53599143",
"0.53555053",
"0.5349713",
"0.53300625",
"0.5325016",
"0.5287996",
"0.52725536",
"0.526... | 0.6228365 | 0 |
Reads a secondary entry point from it's package file. | function secondaryEntryPoint(primary, userPackage) {
const { packageJson, ngPackageJson, basePath } = userPackage;
if (path.resolve(basePath) === path.resolve(primary.basePath)) {
log.error(`Cannot read secondary entry point. It's already a primary entry point. Path: ${basePath}`);
throw new Err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function main(entryArgs){\n\tlet argV = entryArgs;\n\t//verify proper formatting\n\tif(argV.length > 3 || argV.length <= 2){\n\t\tconsole.log(\"Usage: $ node coding-exercise.js <path-to-input-file>\");\n\t\treturn;\n\t}\n\tlet filePath = entryArgs.slice(2);\n\tfilePath = path.resolve(filePath[0]);\n\t//verify file... | [
"0.5567584",
"0.5311567",
"0.48248383",
"0.47349995",
"0.4708829",
"0.46989566",
"0.46520695",
"0.46480837",
"0.46165064",
"0.45931596",
"0.45806378",
"0.45765367",
"0.45348835",
"0.45103824",
"0.44959337",
"0.44923553",
"0.4432527",
"0.43986177",
"0.4394336",
"0.438305",
"0.... | 0.65697366 | 0 |
This sample demonstrates how to Creates or updates a data flow. | async function dataFlowsCreate() {
const subscriptionId =
process.env["DATAFACTORY_SUBSCRIPTION_ID"] || "12345678-1234-1234-1234-12345678abc";
const resourceGroupName = process.env["DATAFACTORY_RESOURCE_GROUP"] || "exampleResourceGroup";
const factoryName = "exampleFactoryName";
const dataFlowName = "exampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function dataFlowsUpdate() {\n const subscriptionId =\n process.env[\"DATAFACTORY_SUBSCRIPTION_ID\"] || \"12345678-1234-1234-1234-12345678abc\";\n const resourceGroupName = process.env[\"DATAFACTORY_RESOURCE_GROUP\"] || \"exampleResourceGroup\";\n const factoryName = \"exampleFactoryName\";\n const da... | [
"0.65141964",
"0.58464926",
"0.56220794",
"0.55420834",
"0.55161244",
"0.55142194",
"0.54186743",
"0.5360699",
"0.5340008",
"0.53363657",
"0.53229463",
"0.5261422",
"0.52529883",
"0.5242717",
"0.5232502",
"0.522615",
"0.51894027",
"0.5157576",
"0.51564705",
"0.51364684",
"0.5... | 0.63812876 | 1 |
This sample demonstrates how to Creates or updates a data flow. | async function dataFlowsUpdate() {
const subscriptionId =
process.env["DATAFACTORY_SUBSCRIPTION_ID"] || "12345678-1234-1234-1234-12345678abc";
const resourceGroupName = process.env["DATAFACTORY_RESOURCE_GROUP"] || "exampleResourceGroup";
const factoryName = "exampleFactoryName";
const dataFlowName = "exampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function dataFlowsCreate() {\n const subscriptionId =\n process.env[\"DATAFACTORY_SUBSCRIPTION_ID\"] || \"12345678-1234-1234-1234-12345678abc\";\n const resourceGroupName = process.env[\"DATAFACTORY_RESOURCE_GROUP\"] || \"exampleResourceGroup\";\n const factoryName = \"exampleFactoryName\";\n const da... | [
"0.63803667",
"0.5848867",
"0.56253135",
"0.55431896",
"0.5516223",
"0.55122495",
"0.5414948",
"0.53593177",
"0.53432834",
"0.53373593",
"0.5318948",
"0.5264111",
"0.52512354",
"0.52453136",
"0.52293783",
"0.52256346",
"0.51825404",
"0.5158804",
"0.51564986",
"0.5133755",
"0.... | 0.6512102 | 0 |
Find all students who have best scope for quiz and exam | async function studentsTask2() {
try {
const {result} = await studentCollection.aggregate([
{$unwind: '$scores'},
{$match: {$or: [{'scores.type': 'quiz'}, {'scores.type': 'exam'}]}},
{$sort: {'scores.score': -1}}
]);
console.log(`Best students by scope and exam`);
} catch (err) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"examStudent(gid) {\n let s = this.getStudent(gid);\n let st = new Set()\n s.courses.forEach(course => {\n course.forEach(name => {\n for (let c of this.crseMap.values())\n if (c.name == name) st.add(c);\n });\n\n });\n\n return st\n\n }",
"function getSurveySubmmissionsB... | [
"0.60588324",
"0.5634931",
"0.54432476",
"0.5424829",
"0.5302563",
"0.52704006",
"0.5105012",
"0.50865644",
"0.5037273",
"0.50303084",
"0.50274813",
"0.49909908",
"0.49904972",
"0.4968496",
"0.495675",
"0.49381125",
"0.4928752",
"0.49242663",
"0.48965192",
"0.4888916",
"0.487... | 0.5876139 | 1 |
Delete all students that have homework score <= 60 | async function studentsTask4() {
try {
let idList = await studentCollection.aggregate([
{$unwind: '$scores'},
{$match: {$and: [{'scores.type': 'homework'}, {'scores.score': { $gt: 0, $lt: 60 }}]}},
]).map(d => d._id);
studentCollection.remove({_id: {$in: idList}});
console.log(`Deleted ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function example14() {\n try {\n const {result} = await studentsCollection.deleteMany({\n scores: {\n $elemMatch: {\n type: 'homework',\n score: {$lt: 60}\n }\n }\n });\n console.log(`Deleted ${result.n} articles with results lower than 60`);\n } catch (er... | [
"0.66695035",
"0.5887416",
"0.5626256",
"0.5520004",
"0.55106467",
"0.5448459",
"0.5435557",
"0.54323703",
"0.5430284",
"0.5324712",
"0.5305482",
"0.52637684",
"0.52471954",
"0.52383196",
"0.52318114",
"0.5212421",
"0.5201589",
"0.51973724",
"0.51739746",
"0.5164915",
"0.5162... | 0.6951698 | 0 |
similar to This will 'navigate' to the next/prev slide if the user clicks in the right/left half of the slide div | function clickMove(e) {
var x = e.pageX - this.offsetLeft;
if (x < slideWidth() / 2) {
showPreviousSlide();
} else {
showNextSlide();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function slideArrowHandler(){\n var section = $(this).closest(SECTION_SEL);\n\n if ($(this).hasClass(SLIDES_PREV)) {\n if(isScrollAllowed.m.left){\n FP.moveSlideLeft(section);\n }\n } else {\n if(isScrollAllowed.m.righ... | [
"0.73291487",
"0.73291487",
"0.73215216",
"0.73215216",
"0.72962826",
"0.72962826",
"0.72962826",
"0.72801787",
"0.7153156",
"0.7153156",
"0.7153156",
"0.71281016",
"0.71281016",
"0.7026446",
"0.7007694",
"0.696995",
"0.6931095",
"0.691046",
"0.6909148",
"0.6898404",
"0.68633... | 0.7494466 | 0 |
TODO allow users to provide their own function for generating the toc | function generateToc() {
tocContainer = jQuery(settings.tocContainerSelector)
tableOfContents = jQuery("<ol class='slide-toc'></ol>")
titles.each(function(i){
line = jQuery("<li><a href='#slide-" + i + "'>" + jQuery(this).text() + "</a></li>")
jQuery("a", line).click(function(){showS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function TOC_writeTOC() {\n\tvar api = stub.getAPI();\n\tif (api.isLoggedIn()) {\n\t\tvar selectedItem = null;\n\t\tif (api.mode == api.MODE_COURSE) {\n\t\t\tselectedItem = api.getAnticipatedItem();\n\t\t\tif (selectedItem == null) selectedItem = api.getCurrentItem();\n\t\t}\n \t\tvar currentOrganization = api.get... | [
"0.7497353",
"0.70078236",
"0.69383425",
"0.69338727",
"0.68413657",
"0.68346167",
"0.68067867",
"0.6695699",
"0.6667408",
"0.66166604",
"0.66069746",
"0.63843924",
"0.63793296",
"0.6330198",
"0.62826556",
"0.6272727",
"0.6247463",
"0.62356544",
"0.6193993",
"0.61769396",
"0.... | 0.72615016 | 1 |
Returns a list of Dirent objects representing the contents of the directory. | async readDirEnts() {
let ents = undefined;
let res = [];
while (true) {
ents = await this._pathClient.ReadDirents(fidling.fuchsia_io.MAX_BUF);
if (ents.s != '0') {
throw 'Unable to read directory entries';
}
if (ents.dirents.length == 0) {
break;
}
let bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"readdir(dirpath) {\n return RNFS.readDir(dirpath)\n .then(files => {\n return files.map(file => file.name);\n });\n }",
"async readdir() {\n if (!this.canReaddir()) {\n return [];\n }\n const children = this.children();\n if (this.calledReaddir()) {\n ... | [
"0.6674262",
"0.6547409",
"0.6502916",
"0.6424",
"0.6399431",
"0.635563",
"0.63471705",
"0.6314108",
"0.6299402",
"0.6225769",
"0.61956215",
"0.6189731",
"0.6149616",
"0.61154073",
"0.61088157",
"0.6090618",
"0.60845816",
"0.60845816",
"0.605788",
"0.59891605",
"0.59866893",
... | 0.74429345 | 0 |
Given an absolute path string, returns a Directory object representing that path. If the path string represents a nondirectory node, returns null. | static async getDirectoryFor(pathString) {
let rns = fdio.nsExportRoot();
let splitDirString = pathString.split('/');
const rootElements = rns.getElements();
let restOfPath = undefined;
let element = undefined;
let checkDirectory = fidling.fuchsia_io.OPEN_FLAG_DESCRIBE;
// The root elements... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDir(str) {\n return str.match(/^(?:.*[\\/\\\\])?/)[0];\n }",
"function getDirName(path) {\n if (path == null) {\n return null;\n }\n var index = path.lastIndexOf(\"/\");\n return index == -1 ? null : path.substring(0, index);\n}",
"function directoryOf(/*string*/ hr... | [
"0.57436866",
"0.5491157",
"0.5413685",
"0.5379884",
"0.5363692",
"0.5360121",
"0.5355075",
"0.53378993",
"0.5311687",
"0.52627724",
"0.5254373",
"0.517737",
"0.5144572",
"0.51120627",
"0.50067556",
"0.49760926",
"0.4966506",
"0.49419704",
"0.49355343",
"0.4932692",
"0.492537... | 0.58146536 | 0 |
Temporarily expose input value. Use with caution. | get valueInput() {
return this._value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get value() { return this._inputValueAccessor.value; }",
"get value() {\n return this.input_.value;\n }",
"get value() {\n return this._inputValueAccessor.value;\n }",
"getInputVal(inp) {\r\n return inp.value;\r\n }",
"get inputValue() {\n if (this.getAsElem(0).getIf(\"value\... | [
"0.7328745",
"0.7063216",
"0.7040465",
"0.6972757",
"0.6958317",
"0.6842812",
"0.68374085",
"0.6756451",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67474395",
"0.67313784",
"0.6723237",
"0.66592336",
"0.6... | 0.71309584 | 1 |
Makes a clone and fix estampas array. | function setupClone() {
var estampas = []
var clone = JSON.parse(JSON.stringify(_this.tshirt));
angular.forEach(clone.estampas, set);
function set(value, index) { estampas.push(value.id); }
clone.estampas = estampas;
clone.cantidad = 1;
return clone;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clone(array) {\n return array.map(row => row.slice());\n }",
"function array_Clone(x)\r\n{\r\ny=[...x] ;\r\nreturn y ;\r\n}",
"function arrayClone(a) {\r\n var b = a;\r\n return b;\r\n}",
"function arrayClone(arr) {\n return JSON.parse(JSON.stringify(arr));\n}",
"function arrayClone(a){ \n\t\tva... | [
"0.6181098",
"0.6148019",
"0.6018477",
"0.60158867",
"0.5994809",
"0.59156245",
"0.59129894",
"0.59006494",
"0.5884115",
"0.5863967",
"0.5829431",
"0.5829431",
"0.5796516",
"0.57546914",
"0.5732827",
"0.5722742",
"0.5709864",
"0.5702222",
"0.56983185",
"0.56587756",
"0.562202... | 0.69147193 | 0 |
create Element and render Docs | function renderDoc(doc) {
let para = document.createElement('p');
let name = document.createElement('span');
let city = document.createElement('span');
para.setAttribute('data-id', doc.id)
name.textContent = doc.data().Name;
city.textContent = doc.data().city;
para.appendChild(name);
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"buildElement() {\n const templateString = fs.readFileSync(this.__template, {encoding: 'utf-8'});\n const parser = new DOMParser();\n const doc = parser.parseFromString(templateString, 'text/html');\n return doc.querySelector('.pio-template-root').cloneNode(true);\n }",
"function buildDocDef()\n {... | [
"0.6441378",
"0.6236522",
"0.61939794",
"0.61595553",
"0.6100447",
"0.60979587",
"0.607541",
"0.60272837",
"0.60101825",
"0.6000276",
"0.5999149",
"0.5999127",
"0.5989798",
"0.5970934",
"0.59575903",
"0.594213",
"0.59420586",
"0.59305274",
"0.5925326",
"0.59211653",
"0.591686... | 0.64675546 | 0 |
piece is either going to equal the piece on deck, if no piece on deck, then piece is randomPiece() | function newPiece() {
var piece = pieceOnDeck || randomPiece();
pieceOnDeck = randomPiece();
drawOnDeck();
return piece;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function randomPiece(pieceSet){\n\tvar newPiece = false;\n\tvar rp = function() { return 'PYRB'.split('')[Math.round(Math.random()*3)] + (Math.floor(Math.random()*13) + 1); }\n\tif (!pieceSet || pieceSet.length === 0) return rp();\n\twhile (!newPiece || pieceSet.indexOf(newPiece) !== pieceSet.lastIndexOf(newPiece)... | [
"0.76691103",
"0.721872",
"0.71014935",
"0.70086545",
"0.6984158",
"0.6945826",
"0.6932369",
"0.68520015",
"0.6740554",
"0.6728926",
"0.6680578",
"0.6614267",
"0.65854657",
"0.6540264",
"0.65189403",
"0.64253354",
"0.637639",
"0.63312566",
"0.63051057",
"0.62956583",
"0.62525... | 0.7311107 | 1 |
Clearing the piece on deck before adding the next piece on deck | function clearDeck() {
var onDeckCanvas = document.getElementsByClassName("tetron-next-piece")[0]
var ctx = onDeckCanvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearDeck() {\n isFlippedCard = false;\n freezePlay = false;\n cardOne = null;\n cardTwo = null;\n }",
"deckClear() {\n\t\tthis.mCardDeck = [];\n\t}",
"clearDeck() {\n this.hand = [];\n this.twoCard = [];\n }",
"function clearBoard() {\n debug(\... | [
"0.73062134",
"0.72922516",
"0.7018058",
"0.69568896",
"0.68464017",
"0.67771214",
"0.6742989",
"0.6693184",
"0.6617888",
"0.65371656",
"0.6531696",
"0.65245736",
"0.6474909",
"0.6464569",
"0.64628744",
"0.64510953",
"0.6449248",
"0.64471054",
"0.64321357",
"0.6431312",
"0.64... | 0.7692497 | 0 |
try requesting needed memory | function tryNeed(need, i) {
// if the process is not finished
if (!copy.finished[i]) {
// check if it can be finished now by making a request that would satisfy the need
copy.request = need
copy.processId = i
// checking available resources
if (allElementsAreGreaterOr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function xxMemThr() { return getQOpt('mem:xxThr');} // threshold above which need to reserve memory",
"function gatherMemory() {\n let memory = process.getProcessMemoryInfo();\n let details =\n 'workingSetSize: ' + memory.workingSetSize +\n ' peakWorkingSetSize: ' + memory.peakWorkingSet... | [
"0.6542534",
"0.6065542",
"0.5927255",
"0.5909764",
"0.5909304",
"0.5883093",
"0.58733267",
"0.58341664",
"0.58201337",
"0.58162534",
"0.57514966",
"0.5711522",
"0.5711522",
"0.5711522",
"0.569171",
"0.56343067",
"0.55450064",
"0.55301404",
"0.55152136",
"0.5485264",
"0.54724... | 0.610569 | 1 |
allocate memory for the process based on request, free the memory if the need is met | allocate() {
// allocate memory as per request
this.allocation[this.processId] = sumArrays(this.allocation[this.processId], this.request)
// check if allocation == max, then free the resources
if (this.allocation[this.processId].equals(this.max[this.processId])) {
// increase available resources
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onAlloc () {\n allocDoneCount++\n }",
"_onRunGC(req, res) {\n if (global.gc) {\n const preGcMemory = process.memoryUsage();\n global.gc();\n const postGcMemory = process.memoryUsage();\n const json = {\n \"status\": \"ok\",\n ... | [
"0.5984661",
"0.5786299",
"0.5725212",
"0.57166475",
"0.5688904",
"0.5688535",
"0.55985284",
"0.5562399",
"0.55560523",
"0.5551429",
"0.5528262",
"0.5510689",
"0.54986465",
"0.53642327",
"0.5348736",
"0.53216755",
"0.53186405",
"0.5308102",
"0.52437484",
"0.5165836",
"0.50624... | 0.7286111 | 0 |
send request and check for safe sequence | sendRequest() {
const successStr = 'Success!'
const deniedStr = 'Request denied.'
if (!allElementsAreGreaterOrEqual(this.available, this.request)) {
this.error = 'The request exceeds available resources'
this.status = deniedStr
return
}
if (!allElementsAreGreaterOrEqual(this.need... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async send(request, response) {}",
"function tryRequest() {\n self.xapp.install()\n\n request.get('/api').end(function(err, res) {\n if(err) { return done(err) }\n expect(res.ok).to.equal(true)\n done()\n })\n }",
"execute() {\n if (this.isRunning... | [
"0.60981995",
"0.5834519",
"0.57957333",
"0.57679075",
"0.5760792",
"0.5655707",
"0.5615026",
"0.55772954",
"0.55325264",
"0.5503992",
"0.5493378",
"0.5492958",
"0.54903483",
"0.54781365",
"0.54674184",
"0.5467328",
"0.54538715",
"0.54504144",
"0.5441463",
"0.54265285",
"0.54... | 0.67708576 | 0 |
create a deep copy of the object's data while keeping the methods in the new object's prototype | copy() {
return Object.assign(Object.create(this), JSON.parse(JSON.stringify(this)))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clone() {\n\t\tlet data = JSON.parse(JSON.stringify(this.Serialize()));\n\t\treturn new this.constructor(data);\n\t}",
"copy() {\n var copied = Object.assign(\n Object.create(\n Object.getPrototypeOf(this)\n ), \n this\n );\n \n // Add a cop... | [
"0.7526329",
"0.73140347",
"0.7046297",
"0.6987375",
"0.6979996",
"0.6970894",
"0.6827234",
"0.6827234",
"0.6822858",
"0.6817348",
"0.6806085",
"0.6802531",
"0.6802531",
"0.6784908",
"0.6768294",
"0.6761192",
"0.6743102",
"0.6711686",
"0.66848093",
"0.6665472",
"0.66416144",
... | 0.7422761 | 1 |
returns html for one row for the table with allocation and max | function processRow(processId, processName, allocationArr,
needArr, maxArr, resourcesArr, finished) {
let allocationStr = ''
let needStr = ''
let maxStr = ''
for (let i = 0; i < resourcesArr.length; i++) {
allocationStr += `<span>${allocationArr[i]}</span>`
needStr += `<span>${needArr[i]}</span>`
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function table(numProcesses, processPrefix,\n allocationArr, needArr, maxArr, resourcesArr, finished) {\n let tableRows = ''\n for (let i = 0; i < numProcesses; i++) {\n tableRows += processRow(i, `${processPrefix}${i}`, allocationArr[i], needArr[i], maxArr[i], resourcesArr, finished)\n }\n\n let resources... | [
"0.6382318",
"0.63639",
"0.63460445",
"0.6178585",
"0.6164733",
"0.6146896",
"0.6141099",
"0.60739404",
"0.60586876",
"0.595729",
"0.5953375",
"0.5948004",
"0.5913536",
"0.5903318",
"0.5897001",
"0.5892384",
"0.58883744",
"0.58691937",
"0.5860412",
"0.58534485",
"0.58534056",... | 0.6553906 | 0 |
render table rows with allocation and max | function renderTable(numProcesses, processPrefix, allocationArr,
needArr, maxArr, resourcesArr, finished) {
document.querySelector('#table').innerHTML = table(numProcesses, processPrefix,
allocationArr, needArr, maxArr, resourcesArr, finished)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function table(numProcesses, processPrefix,\n allocationArr, needArr, maxArr, resourcesArr, finished) {\n let tableRows = ''\n for (let i = 0; i < numProcesses; i++) {\n tableRows += processRow(i, `${processPrefix}${i}`, allocationArr[i], needArr[i], maxArr[i], resourcesArr, finished)\n }\n\n let resources... | [
"0.666325",
"0.64615107",
"0.6353344",
"0.6351295",
"0.6344569",
"0.6262968",
"0.62428993",
"0.6233136",
"0.6189528",
"0.6143882",
"0.6086441",
"0.6066275",
"0.6055716",
"0.6038519",
"0.60263944",
"0.59973264",
"0.59956384",
"0.5994184",
"0.59940225",
"0.5984505",
"0.5976907"... | 0.6884677 | 0 |
handle the adding event which add the parsed emails to the array. | addingFinished() {
this.setState({
text: "",
isParsing: false,
emailsArray: []
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"add(event) {\n if (this.emailFormControl.valid || (this.contactarray != null && this.contactarray.length > 0)) {\n const input = event.input;\n const value = event.value;\n // Add our input email\n if ((value || '').trim()) {\n this.contactarray.pus... | [
"0.6467761",
"0.5709079",
"0.56889397",
"0.55641085",
"0.5455749",
"0.541231",
"0.5399178",
"0.5389519",
"0.53882414",
"0.5360348",
"0.5310744",
"0.5304969",
"0.5300176",
"0.52897525",
"0.5271611",
"0.5264351",
"0.5247376",
"0.5227758",
"0.52207994",
"0.5210492",
"0.5204898",... | 0.59003145 | 1 |
object containing all computed scores that will be returned from the service clear all calculation data, some of the vars used are reset within functions | function clearAllCalcData() {
result = {}; // clear result object
result.mimpactScore = 0;
result.mexploitScore = 0;
result.environScore = 0;
result.debugStr = ""; // lines of text used to hold scores for debugging
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearScores()\n {\n vm.impactScore = 'NA';\n vm.exploitScore = 'NA';\n vm.baseScore = 'NA';\n vm.temporalScore = 'NA';\n vm.environScore = 'NA';\n vm.modImpactScore = 'NA';\n vm.overallScore = 'NA';\n vm.cvssStr... | [
"0.6971143",
"0.68538916",
"0.6669324",
"0.6595446",
"0.6589603",
"0.6555738",
"0.6515587",
"0.6514808",
"0.64825433",
"0.6439067",
"0.6427349",
"0.6368653",
"0.6305005",
"0.63044834",
"0.62877566",
"0.62468964",
"0.6227591",
"0.6214992",
"0.62035",
"0.61872166",
"0.6177275",... | 0.8226035 | 0 |
This function does the difficult job of merging selections. Most environmental selections are meant to override the base selections (Modified) to compute an environmental score. What that means for the calculations is: if the environ selection was NOT made (Not Defined, ends in :X) then use the associated Base selectio... | function mergeSelections(environValues) {
var outValues = environValues;
// cr, ir, and ar selections are left as is, because they don't have Base associations
// other selections MAY be undefined (-1), therefore we will use the base selections
// previously made
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function draw_globalSelection() {\n\tvar html_year = 'Year: <select name=\"globalYear\" style=\"color:red;\">' +\n\t\t\t\t\t'<option value=\"none\" class=\"line_none\">No Select</option>' +\n\t\t\t\t\t'<option value=\"each\" class=\"line_none\" selected>each</option>';\n\tfor (var i=1; i<app.m; i++) {\n\t\thtml_ye... | [
"0.56946117",
"0.5339182",
"0.5332034",
"0.5309735",
"0.5309735",
"0.5309735",
"0.52751833",
"0.52751833",
"0.52751833",
"0.52751833",
"0.52655566",
"0.52655566",
"0.52655566",
"0.52005076",
"0.5178885",
"0.51660913",
"0.51660913",
"0.51660913",
"0.51660913",
"0.51660913",
"0... | 0.7594358 | 0 |
Creates, from the result of a query performed on the database, a new CancelledLectures object | function createCancelledLecture(row) {
return new CancelledLecture(row.cancelledLectureId, row.courseId, row.teacherId, row.date, row.inPresence);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cancel() {\n moveToState(this, Cancelled());\n return this;\n }",
"cancel() {\n this.end();\n queryManager.cancelQuery(this);\n return this;\n }",
"cancelNewQualification() {\n\t\tthis.addNewQualificationState = false;\n\t\tthis.newQualification = {\n\t\t\tdescription: null,\n\t\t\tdoctor: nul... | [
"0.50601727",
"0.49957767",
"0.47618574",
"0.47091246",
"0.46812075",
"0.46056363",
"0.4594508",
"0.4557404",
"0.45043874",
"0.44686037",
"0.44661534",
"0.44650474",
"0.4449758",
"0.44418725",
"0.44315168",
"0.4429328",
"0.44246936",
"0.44242126",
"0.4349216",
"0.4349216",
"0... | 0.72697717 | 0 |
returns positionArray, normalArray, colorArray cooresponding to a cube of sidelength 2 at (x, y, z) and color rgb. | function makeCube() {
const positionArray = new Float32Array([
-1, -1, 1,
1, 1, 1,
1, -1, 1,
1, 1, 1,
-1, -1, 1,
-1, 1, 1,
-1, -1, -1,
1, -1, -1,
1, 1, -1,
1, 1, -1,
-1, 1, -1,
-1, -1, -1,
-1, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeCube()\n{\n\t // vertices of cube\n\tvar rawVertices = new Float32Array([\n\t-0.5, -0.5, 0.5,\n\t0.5, -0.5, 0.5,\n\t0.5, 0.5, 0.5,\n\t-0.5, 0.5, 0.5,\n\t-0.5, -0.5, -0.5,\n\t0.5, -0.5, -0.5,\n\t0.5, 0.5, -0.5,\n\t-0.5, 0.5, -0.5]);\n\n\tvar rawColors = new Float32Array([\n 0.4, 0.4, 1.0, 1.0, // ... | [
"0.71293",
"0.7061476",
"0.6891287",
"0.6866031",
"0.67361563",
"0.6702365",
"0.66061777",
"0.6595124",
"0.65855336",
"0.6528298",
"0.6527509",
"0.64720285",
"0.6449629",
"0.63358295",
"0.6311944",
"0.62766933",
"0.6202343",
"0.6199204",
"0.61888385",
"0.6168804",
"0.6144129"... | 0.7183416 | 0 |
for a 'task' template 'click' event listener, with this CSS selector, is registered, toggle the checked property. | 'click .toggle-checked'() {
// Set the checked property to the opposite of its current value
Meteor.call('tasks.setChecked', this._id, !this.checked);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addChecked(task){\n task.addEventListener(\"click\", function(ev){\n if (ev.target.tagName ===\"LI\"){\n ev.target.classList.toggle(\"checked\");\n moveTask(ev.target);\n }\n },false);\n}",
"function toggleTaskStatus(e) {\n var target = e.target;\n target.classList.toggle(\"check... | [
"0.7402086",
"0.7231465",
"0.7095357",
"0.7086447",
"0.7009238",
"0.6880509",
"0.6670095",
"0.6459329",
"0.64418346",
"0.64357716",
"0.6401645",
"0.63972783",
"0.63728315",
"0.6334372",
"0.63115114",
"0.630803",
"0.63041264",
"0.62836134",
"0.62588006",
"0.62550306",
"0.62528... | 0.7492303 | 0 |
display(jsonObj); destroyer function to clear contents of the page | function destroyer(jsonObj)
{
var list=document.querySelectorAll(".rest");
for(var i=0;i<list.length;++i)
{
list[i].remove();
// list[i].innerHTML="";
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function display(jsonObj)\n\t\t{\n\t\t\tfor(var i=0;i<37;++i)\n\t\t\t\tcreator(jsonObj,i)\n\t\t// \n\t\t}",
"function displayJSON (data) {\n console.log(\"displayJSON\")\n $('#results').text(\"\");\n parseReceiptData(data);\n}",
"function clearDataDisplay() {\n body.removeChild(data_display);\n}",
"funct... | [
"0.6756521",
"0.67424244",
"0.6357833",
"0.62839663",
"0.6237203",
"0.61536944",
"0.6088876",
"0.60510075",
"0.602419",
"0.59976757",
"0.5979375",
"0.59784216",
"0.59023756",
"0.5885742",
"0.585147",
"0.5846401",
"0.5800736",
"0.57832026",
"0.5782842",
"0.5773916",
"0.5768568... | 0.7029164 | 0 |
This line drawing function was copied from The code is not original to me. I was very slightly modified by me. / / Draws a colored line by connecting two points using a DDA algorithm (Digital Differential Analyzer). | function drawLineDDA(pixels, Width, Height, X1, Y1, X2, Y2, r, g, b, alpha, dashed, MINX, MAXX, MINY, MAXY)
{
var W = Math.floor(Width);
var H = Math.floor(Height);
var x1 = Math.round(X1);
var y1 = Math.round(Y1);
var x2 = Math.round(X2);
var y2 = Math.round(Y2);
var minX = Math.round(MINX);
var maxX = M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wuLine(x1, y1, x2, y2) {\n var canvas = document.getElementById(\"canvas3\");\n var context = canvas.getContext(\"2d\");\n var steep = Math.abs(y2 - y1) > Math.abs(x2 - x1);\n if (steep) {\n x1 = [y1, y1 = x1][0];\n x2 = [y2, y2 = x2][0];\n }\n if (x1 > x2) {\n x1 = ... | [
"0.7346714",
"0.72113276",
"0.7190371",
"0.71323043",
"0.7107159",
"0.695742",
"0.6917494",
"0.6916596",
"0.68890667",
"0.6877277",
"0.68655455",
"0.68584913",
"0.681177",
"0.677425",
"0.67613757",
"0.67355365",
"0.6731552",
"0.67267317",
"0.6712739",
"0.67083925",
"0.6704412... | 0.784358 | 0 |
endregion Display Calendar Board Functions region | function renderBoard(){
document.querySelector(".year-text").innerHTML = currentCalendar.lastYearViewed;
board.innerHTML = "";
// Render the bolts along the sides of the board.
for(var i = 0; i < 5; i++){ // 5 bolts down the sides of the board.
for(var j = 0; j < 4; j++){ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createCalendar() {\n addCalendar();\n displayDates();\n}",
"function display(){\n\t$(\"#month\").html(getMonthName(currentDate.getMonth()));\n\t$(\"#year\").html(currentDate.getFullYear());\n\tfor(i=0;i<7;i++){\n\t\tif(week[i].getDate()==currentDate.getDate()){ //Add active class to day active\n\t... | [
"0.7187149",
"0.711412",
"0.6963524",
"0.68982565",
"0.6835707",
"0.67863697",
"0.6749311",
"0.6744781",
"0.6719214",
"0.6664808",
"0.665305",
"0.6611891",
"0.6610083",
"0.66056883",
"0.6587343",
"0.656964",
"0.6555799",
"0.6544328",
"0.65429187",
"0.6533554",
"0.65294075",
... | 0.73919827 | 0 |
state is an array of 61 sixbit integers that represents up to 366 days of progress. Each year's state is serialized as 61 printable characters ranging from "" to "i". | function encodeState(currentState){
currentCalendar.states[currentCalendar.lastYearViewed] = currentState.reduce(function(s, v){
return s + String.fromCharCode(42 + v);
}, "");
saveCurrentCalendarAfterDelay();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveState()\n{\n\tstate = new Array();\n\tvar x = 0;\n\tfor(i in colorTypes)\n\t{\n\t\tstate[i] = document.getElementById(\"colourNum\" + colorTypes[i]).value;\n\t\tx = i;\n\t}\n\tstate[i+1] = document.getElementById(\"splash_message\").value;\n\tstate[i+2] = document.getElementById(\"debug\").checked;\n\... | [
"0.5546098",
"0.5310777",
"0.5293842",
"0.5279107",
"0.5219385",
"0.51896894",
"0.5170731",
"0.5124902",
"0.51107746",
"0.51043946",
"0.5092514",
"0.50179505",
"0.5016158",
"0.50111336",
"0.49809605",
"0.49758902",
"0.49592596",
"0.49465254",
"0.49384347",
"0.4933551",
"0.490... | 0.6688558 | 0 |
This function starts recurring timers that simulate drivers' applications sending location updates to the backend | function startDriverLocationUpdates() {
return db.getAllDrivers()
.then(drivers => drivers.map(driver => setInterval(updateDriverLocation, 6000, driver.rowid, { lat: driver.latitude, lon: driver.longitude })));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function callRealTimeLocation(){\n // timer1 = setInterval(zzv,7000);\n if(isRealTime)\n timer1 = setTimeout(getRealTimeLocation,7000);\n\n}",
"start() {\n // Run immediately..\n this.runUpdate();\n\n // .. then schedule 15 min interval\n timers.setInterval(() => {\n ... | [
"0.66859",
"0.65040755",
"0.6475204",
"0.6361856",
"0.6179923",
"0.6152219",
"0.60793",
"0.60614794",
"0.6034449",
"0.60197127",
"0.6000397",
"0.59834814",
"0.5957503",
"0.59512144",
"0.5898506",
"0.5878504",
"0.5874629",
"0.58724207",
"0.5870226",
"0.5860637",
"0.5833351",
... | 0.66523826 | 1 |
This function demonstrates how trip assignment logic could work | function assignTrips() {
// First, get all currently unassigned trips
return db.getNewTrips()
.then((trips) => {
// Iterating over trips in series to avoid having the same driver assigned to multiple trips
// This is okay the purposes of this example, but may be too slow when dealing with high volum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function main(tape) {\n let position = 0;\n let instruction = tape[position];\n\n while (instruction != 99) {\n switch (instruction) {\n case 1:\n tape[tape[position + 3]] = tape[tape[position + 1]] + tape[tape[position + 2]];\n break;\n case 2:\n... | [
"0.57034737",
"0.56270075",
"0.5624662",
"0.5593597",
"0.54203284",
"0.53867227",
"0.53864175",
"0.53765756",
"0.53681886",
"0.53627664",
"0.5186236",
"0.51765686",
"0.5168776",
"0.5131362",
"0.5112091",
"0.5111555",
"0.5104325",
"0.50857955",
"0.50625974",
"0.5059726",
"0.50... | 0.60212016 | 0 |
This function starts a recurring timer that updates the trip database This includes assigning trips for which candidate drivers have been found and reuploading the shapes of still unassigned jobs to the Geofencing Extension | function startTripUpdates() {
// Set a timer for every 10 seconds
return setInterval(() => {
// First assign trips for which candidate drivers have been found
assignTrips()
// Then get a WKT file which contains geofences for jobs that have not yet been assigned
.then(db.getGeofencesWkt)
//... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function runTimer(){\r\n\t\tcallAjax(createAppointments, \"appointments\", \"get\");\r\n\t}",
"function tripRefresh() {\n database.ref('/activeTrips').once(\"value\").then(function(snapshot) {\n var tripDiv = $('#active-trips');\n tripDiv.empty();\n tripDiv.html($('<tr>').... | [
"0.5904894",
"0.56472075",
"0.55927145",
"0.5582377",
"0.5558778",
"0.5514881",
"0.548894",
"0.5430154",
"0.5419043",
"0.538638",
"0.53860223",
"0.53656995",
"0.53212863",
"0.530604",
"0.52694947",
"0.522867",
"0.520077",
"0.51876724",
"0.51776034",
"0.517069",
"0.51347446",
... | 0.78637207 | 0 |
Executes the command on the net.Stream, if no server is supplied it will use the query.key to get the server from the HashRing | function command(self, query, server) {
// generate a regular query,
var redundancy = self.redundancy && self.redundancy < self.servers.length && query.redundancy;
// try to find the correct server for this query
if (!server) {
// no need to do a hashring lookup if we only have one server assigned to
if (self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"call() {\n const now = (new Date()).getTime() / 1000.0;\n const args = Array.from(arguments);\n const command = args.shift();\n return this.load()\n .then((sha) => {\n logger.debug('Calling %s', command, { now, args });\n return this.redis.evalshaAsync([sha, 0, command, now].concat(a... | [
"0.5623018",
"0.51967734",
"0.5165847",
"0.5152112",
"0.50953585",
"0.50609225",
"0.5044165",
"0.50295734",
"0.5005454",
"0.5003891",
"0.49783742",
"0.48593178",
"0.48559785",
"0.4852122",
"0.48503774",
"0.48227757",
"0.48090926",
"0.47941387",
"0.47689822",
"0.4763697",
"0.4... | 0.7161348 | 0 |
As all command nearly use the same syntax we are going to proxy them all to this function to ease maintenance. This is possible because most set commands will use the same syntax for the Memcached server. Some commands do not require a lifetime and a flag, but the memcached server is smart enough to ignore those. | function setters(self, type, key, value, lifetime, cb, cas) {
var flag = 0;
var valuetype = typeof value;
var length;
if (Buffer.isBuffer(value)) {
flag = FLAG_BINARY;
value = value.toString('binary');
}
else if (valuetype !== 'string' && valuetype !== 'number') {
flag = FLAG_JSON;
value = JSON.stringify... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set(...args) {\n const value = args.pop();\n return super.set(this.key(args), value);\n }",
"set() {}",
"function CommandSet() {\n var commands = [];\n var nameIdMap = {};\n var commandSorter = function(c1, c2) {\n if (c1.Id() < c2.Id())\n return -1;\n else if (c1.Id() ... | [
"0.54452676",
"0.51809263",
"0.5059483",
"0.50439906",
"0.5004468",
"0.48814383",
"0.48671386",
"0.4852706",
"0.4851247",
"0.4840027",
"0.48109254",
"0.47918254",
"0.4785355",
"0.4775147",
"0.47188148",
"0.4716204",
"0.46692398",
"0.46557975",
"0.46369874",
"0.4634528",
"0.46... | 0.5533702 | 0 |
Small handler for incr and decr's | function incrdecr(self, type, key, value, cb) {
var cmd = [type, key, value].join(' ');
command(self, {
key: key,
cb: cb,
value: value,
type: type,
command: cmd,
redundancy: cmd + NOREPLY
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function testIncrDecr(callback)\n{\n\tvar key = 'test#' + token.create();\n\tvar cache = new exports.Cache();\n\ttesting.assert(cache.set(key, '10'), 'Should set record', callback);\n\ttesting.assertEquals(cache.incr(key, 5), 15, 'Not incremented', callback);\n\ttesting.assertEquals(cache.decr(key, 5), 10, 'Not de... | [
"0.66367435",
"0.6475389",
"0.64482456",
"0.6374083",
"0.637369",
"0.6327055",
"0.62972736",
"0.6277872",
"0.62430406",
"0.6174575",
"0.6163871",
"0.5996912",
"0.5954921",
"0.595423",
"0.5942563",
"0.58103645",
"0.58084375",
"0.5793029",
"0.5762427",
"0.5738219",
"0.5705569",... | 0.66872305 | 0 |
console.log(hotelCost(25)); Problem 4 / here we had find the biggest name of our friend Decalred a function with parameter. then initilized the array to store our friend count. then in if()condition we compared and stored the biggest name. | function megaFriend(friends){
var friendName = friends[0].length;
for(var i = 0; i < friends.length; i++){
var names = friends[i].length;
if(names > friendName){
var biggestName = friends[i];
friendName = names;
}
}
return biggestName;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function megaFriend(largestName){\n var larger= largestName[0];\n for(var i=0 ; i<largestName.length ; i++){\n var element= largestName[i];\n if(element > larger){\n larger =element ;\n }\n }\n return larger;\n }",
"function bestFriend(array) {\n let... | [
"0.7103961",
"0.6826076",
"0.67694396",
"0.67410874",
"0.67220956",
"0.66923547",
"0.6687085",
"0.66527313",
"0.6647186",
"0.6623798",
"0.66059315",
"0.6605715",
"0.66050184",
"0.65675277",
"0.65657616",
"0.6558349",
"0.6446549",
"0.6395496",
"0.637892",
"0.63349044",
"0.6325... | 0.68972176 | 1 |
Connects to the WebSocket Server | function _connect() {
log.debug(LOG_PREFIX, `Connecting to ${_wsURL}`);
_ws = new WebSocket(_wsURL);
_ws.on('open', _wsOpen);
_ws.on('close', _wsClose);
_ws.on('message', _wsMessage);
_ws.on('error', _wsError);
_ws.on('ping', _wsPing);
_ws.on('pong', _wsPong);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"connect() {\n this.ws = new WebSocket(this.host);\n this.ws.on('open', this.onConnect.bind(this));\n this.ws.on('close', this.onDisconnect.bind(this));\n this.ws.on('error', this.onError.bind(this));\n }",
"connect () {\n /* Connect our websocket */\n this._ws = new WebSocket(this.uri, {\n ... | [
"0.84760964",
"0.8280497",
"0.8201919",
"0.81919104",
"0.8147514",
"0.8070795",
"0.8018034",
"0.800015",
"0.7964146",
"0.7964146",
"0.7950508",
"0.79349613",
"0.7805241",
"0.77628237",
"0.77462345",
"0.77150834",
"0.7650277",
"0.76304835",
"0.75721544",
"0.7559117",
"0.754207... | 0.82977575 | 1 |
Clears the ping/pong interval | function _clearPingPong() {
if (_interval) {
clearInterval(_interval);
_interval = null;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"stopInterval() {\n if (this.intervalId) {\n window.clearInterval(this.intervalId);\n this.intervalId = null;\n this.failedPings = 0;\n logger.info('Ping interval cleared');\n }\n }",
"stopInterval() {\n if (this.intervalId) {\n window.clearInterval(this.intervalId);\n... | [
"0.73617166",
"0.7307014",
"0.7307014",
"0.72491705",
"0.72491705",
"0.7088688",
"0.6952066",
"0.6927904",
"0.6871787",
"0.684737",
"0.67965245",
"0.67591566",
"0.67553365",
"0.67544067",
"0.67503726",
"0.67485183",
"0.6745889",
"0.67269504",
"0.67269504",
"0.66940814",
"0.66... | 0.83814883 | 0 |
EMG Declaration for function authorizeCaller | authorizeCaller(dataContract, callback) {
let self = this;
let payload = {
dataContract: dataContract
}
self.flightSuretyData.methods
.authorizeCaller(payload.dataContract)
.send({ from: self.owner}, (error, result) => {
callback(error... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static authorize() {\n return (req, res, next) => {\n const { provider, accessToken } = this._getCredentials(req);\n\n if (!provider) {\n return next(new Error(\"No provider given\"));\n }\n if (!accessToken) {\n return next(new Error(\"No access token delivered\"));\n }\n... | [
"0.65366894",
"0.6217779",
"0.6215317",
"0.60672647",
"0.6060261",
"0.60409683",
"0.58986896",
"0.5888528",
"0.58095235",
"0.5773117",
"0.57686955",
"0.575406",
"0.57406265",
"0.5720942",
"0.5696394",
"0.56731886",
"0.56285465",
"0.56234765",
"0.5616034",
"0.5609176",
"0.5597... | 0.66955405 | 0 |
Name : monitoringCallback Author : Kony Purpose : This function will perform monitoringCallback once BeaconRegionStateInside then startRangingBeacons in region. | function monitoringCallback(beaconRegion, beaconRegionState) {
kony.print("BeaconRegion: ", kony.type(beaconRegion), " ", beaconRegion, " state is: ", beaconRegionState);
if (beaconRegionState == "BeaconRegionStateInside") {
beaconManager.startRangingBeaconsInRegion(beaconRegion);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function monitoringStartedForRegionCallback(beaconRegion) {\n kony.print(\"Inside monitoringStartedForRegionCallback\");\n kony.print(\"Monitoring started for region: \", kony.type(beaconRegion), \" \", beaconRegion);\n}",
"function locate_iBeacons() {\n kony.print(\"--Start locate_iBeacons--\");\n i... | [
"0.7441653",
"0.65209186",
"0.6515617",
"0.64835423",
"0.6482922",
"0.63198286",
"0.58761585",
"0.56988627",
"0.5661077",
"0.5534778",
"0.5454761",
"0.5447115",
"0.5317142",
"0.5211229",
"0.52085084",
"0.5154635",
"0.5033301",
"0.4979438",
"0.49118698",
"0.48433366",
"0.48212... | 0.8172886 | 0 |
Name : rangingCallback Author : Kony Purpose : In the rangingCallback, the developer can determine the relative distance of the beacon from the device. | function rangingCallback(beaconRegion, beacons) {
kony.print("Beacons found for BeaconRegion: ", kony.type(beaconRegion), " ", beaconRegion, " Beacons: ", beacons);
var beaconLabel = "No beacons";
var proximityLabel = "...";
if (beacons.length > 0) {
beacon = beacons[0];
proximityUUIDStr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"calculer_distance() {}",
"distanceRan(){\n var resultDist = google.maps.geometry.spherical.computeDistanceBetween(this._startLocation, this._endLocation);\n this._distanceRan = resultDist;\n return resultDist.toFixed(2);\n }",
"beaconsDidRange(data) {\n // An attempt to stop the rang... | [
"0.57104594",
"0.567975",
"0.56098723",
"0.5605908",
"0.5543268",
"0.5449996",
"0.5336454",
"0.5333298",
"0.5319165",
"0.53007066",
"0.5293875",
"0.5287057",
"0.52550256",
"0.5240935",
"0.5236573",
"0.5208138",
"0.51756966",
"0.51659024",
"0.5143704",
"0.5140124",
"0.51303184... | 0.6648884 | 0 |
Name : errorCallback Author : Kony Purpose : This function is used to get error updates from BeaconManager. | function errorCallback(beaconManagerError, errorName, errorInfo, beaconRegion) {
kony.print("Error occurred: ", beaconManagerError, " Error Name: ", errorName, " erorrInfo: ", errorInfo);
if (beaconRegion) {
kony.print("For Region: ", kony.type(beaconRegion), " ", beaconRegion);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function errorCallback(error) {\n\tswitch (error.code) {\n\tcase error.PERMISSION_DENIED:\n\t\tconsole.log(\"User denied the request for heartrate.\");\n\t\tbreak;\n\tcase error.TIMEOUT:\n\t\tconsole.log(\"The request to get user heartrate timed out.\");\n\t\tbreak;\n\tcase error.UNKNOWN_ERROR:\n\t\tconsole.log(\"... | [
"0.7076936",
"0.66956985",
"0.6683773",
"0.6603045",
"0.6511955",
"0.62383384",
"0.6236623",
"0.6169036",
"0.6135852",
"0.59878325",
"0.59803975",
"0.59803975",
"0.59498566",
"0.5905619",
"0.58835655",
"0.5828333",
"0.57217526",
"0.56971127",
"0.5692508",
"0.5683163",
"0.5654... | 0.7333358 | 0 |
Name : monitoringStartedForRegionCallback Author : Kony Purpose : This function helps to start monitoring for the specified Beacon Region. | function monitoringStartedForRegionCallback(beaconRegion) {
kony.print("Inside monitoringStartedForRegionCallback");
kony.print("Monitoring started for region: ", kony.type(beaconRegion), " ", beaconRegion);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function monitoringCallback(beaconRegion, beaconRegionState) {\n kony.print(\"BeaconRegion: \", kony.type(beaconRegion), \" \", beaconRegion, \" state is: \", beaconRegionState);\n if (beaconRegionState == \"BeaconRegionStateInside\") {\n beaconManager.startRangingBeaconsInRegion(beaconRegion);\n }... | [
"0.76692593",
"0.59978926",
"0.59043485",
"0.5704759",
"0.5550418",
"0.55390507",
"0.55178165",
"0.53553134",
"0.5261532",
"0.5246369",
"0.50849825",
"0.50453055",
"0.5032623",
"0.50153875",
"0.49708626",
"0.48570272",
"0.48447984",
"0.48053172",
"0.47565693",
"0.47444853",
"... | 0.8688809 | 0 |
Name : authorizationStatusChangedCallback Author : Kony Purpose : This Function helps to set the authorization status changed callback. | function authorizationStatusChangedCallback(status) {
kony.print(">>>>>>>>>> Location Authorization status changed to: ", status);
if (status === "BeaconManagerAuthorizationStatusAuthorized") {
var proximityUUID = "CAD6ACBA-9D1C-4772-90AA-0FEEF6868D30";
var major = 100;
var minor = 1;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function statusChangeCallback(response)\n {\n console.log('statusChangeCallback');\n console.log(response);\n if (response.status === 'connected') {\n console.log(\"connected\");\n } else if (response.status === 'not_authorized') {\n console.log(\"not authorized... | [
"0.73783606",
"0.7142201",
"0.7050268",
"0.694012",
"0.68112546",
"0.6763158",
"0.6654249",
"0.6634343",
"0.66309094",
"0.66092616",
"0.6591841",
"0.6589541",
"0.65823394",
"0.65808475",
"0.6578506",
"0.6578506",
"0.6578506",
"0.65686697",
"0.656838",
"0.6532796",
"0.6532422"... | 0.7459962 | 0 |
Name : locate_iBeacons Author : Kony Purpose : This function is used to creating a BeaconManager with callbacks . | function locate_iBeacons() {
kony.print("--Start locate_iBeacons--");
if (beaconManager === null) {
kony.print("--creating beaconManager--");
beaconManager = new com.kony.BeaconManager(monitoringCallback, rangingCallback, errorCallback);
kony.print("--beaconManager = new com.kony.BeaconM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findBeacons() {\n\tvar room = \"\";\n\t/*[] values;\n\tfor(var i=0;i>10;i++) {*/\n\t\tBeacon.rangeForBeacons(\"B9407F30-F5F8-466E-AFF9-25556B57FE6D\")\n\t\t.then(function(beacons_found) {\n\t\t // $(\"#beacon-list\").empty();\n\t\t var maxRSSI = 100;\n\t\t for(beaconIndex in beacons_found) {\n\t\t ... | [
"0.73546475",
"0.6901385",
"0.67264223",
"0.6586893",
"0.6555728",
"0.63125193",
"0.6304993",
"0.62963915",
"0.62272155",
"0.6165391",
"0.6026207",
"0.59259474",
"0.5910884",
"0.5864345",
"0.5756234",
"0.57283425",
"0.5722008",
"0.55935705",
"0.55513054",
"0.55499846",
"0.535... | 0.8783159 | 0 |
Name : beaconUpdate Author : Kony Purpose : This function will update the beacon details to the KMS Server . | function beaconUpdate() {
function asyncCallback(status, result) {
kony.print("\n------status------>" + status);
if (status == 400) {
if (result["opstatus"] == 0) {
kony.print("\n------updated result--->" + JSON.stringify(result));
} else if (result["opstatus"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateMap(time){\n // console.log(\"----------------------------\");\n if(showBeacon){\n var position1 = JSON.parse(httpGet(beaconPosiSource)); //two dimensional JSON array\n // console.log(\"----------------------------\");\n var position = new ibeaconBeanGroup(position1).getA... | [
"0.58126426",
"0.56838757",
"0.5650695",
"0.55105084",
"0.5504464",
"0.54016197",
"0.5351462",
"0.5309152",
"0.5300736",
"0.52471256",
"0.5208573",
"0.5197931",
"0.518598",
"0.518102",
"0.51615196",
"0.51533544",
"0.51323926",
"0.5124781",
"0.51235116",
"0.51228875",
"0.51225... | 0.76911795 | 0 |
Return the nth instance of a substring | function GetSubstringIndex(str, substring, n) {
var times = 0, index = null;
while (times < n && index !== -1) {
index = str.indexOf(substring, index+1);
times++;
}
return index;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function nthIndex(str, pat, n) {\r\n var L = str.length, i = -1;\r\n while (n-- && i++ < L) {\r\n i = str.indexOf(pat, i);\r\n if (i < 0) break;\r\n }\r\n return i;\r\n}",
"function nthIndex(str, pat, n) {\n var L = str.length,\n i = -1;\n while (n-- && i++ < L) {\n i = str.indexOf(... | [
"0.7646834",
"0.7593229",
"0.740282",
"0.69905025",
"0.66113245",
"0.66110843",
"0.6590959",
"0.6440691",
"0.6365032",
"0.6341224",
"0.6305879",
"0.62684256",
"0.6258047",
"0.6226537",
"0.6170033",
"0.61558294",
"0.61495477",
"0.61269784",
"0.6124846",
"0.6124343",
"0.6102218... | 0.7692247 | 0 |
gameId > host instance | _getHost(gameId)
{
const index = this.hosts.findIndex(x => x.game.id === gameId);
if (!~index) {
throw new Error(`could not find game ${gameId}`);
}
return this.hosts[index];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async assignNewHost(gameId)\n {\n const players = await this.games.playersInGame(gameId);\n\n // just pick the first one\n const p = players[0];\n\n await this.games.setHost(gameId, p.id);\n\n // broadcast updated game info via gamelist\n const game = await this.games.getActive(null, gameId);\n ... | [
"0.71342456",
"0.6762269",
"0.6452073",
"0.64139336",
"0.63148934",
"0.6266734",
"0.62090474",
"0.6098362",
"0.60952246",
"0.6079115",
"0.5986408",
"0.5940981",
"0.58952206",
"0.5879143",
"0.5836563",
"0.58130765",
"0.5777025",
"0.57619035",
"0.57585335",
"0.57504004",
"0.569... | 0.6970012 | 1 |
Get the master key from the seed. | static getMasterKeyFromSeed(seed) {
const hmac = new hmacSha512_1.HmacSha512(converter_1.Converter.utf8ToBytes("ed25519 seed"));
const fullKey = hmac.update(seed).digest();
return {
privateKey: Uint8Array.from(fullKey.slice(0, 32)),
chainCode: Uint8Array.from(fullKey... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mnemonicToMasterDerivationKey(mn) {\n return seedFromMnemonic(mn);\n}",
"function masterDerivationKeyToMnemonic(mdk) {\n return mnemonicFromSeed(mdk);\n}",
"function sendMasterKey(args) {\n var pk = masterKey.pub.stringify(),\n sk = masterKey.sec.stringify();\n return postVTPMMessage(... | [
"0.7041716",
"0.6283352",
"0.60901034",
"0.6076988",
"0.5957208",
"0.576367",
"0.5761109",
"0.57471806",
"0.5744316",
"0.5743636",
"0.5663582",
"0.563851",
"0.55933064",
"0.5574071",
"0.5490222",
"0.5473026",
"0.54229766",
"0.53880113",
"0.5342937",
"0.533975",
"0.53237945",
... | 0.7912959 | 0 |
get class name of weather icon by text | function getWeatherIconClassByText(text)
{
if (!text)
{
addDebugLog('[error] text not found.');
return '';
}
var classMap = {
d0 : '晴',
d1 : '多云',
d2 : '阴',
d3 : '阵雨',
d4 : '雷阵雨',
d5 : '雷阵雨并伴有冰雹',
d6 : '雨夹雪',
d7 : '小雨',
d8 : '中雨',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getWeatherIconClass(data) {\n if (!data) {\n return this.weatherIconClassMapping['unknown'];\n }\n if (data.icon.indexOf('cloudy') > -1) {\n if (data.cloudCover < 0.25) {\n return this.weatherIconClassMapping[\"clear-day\"];\n } else if (data.cloudCover < 0.5) {\n ... | [
"0.73439765",
"0.7298312",
"0.7168182",
"0.6971812",
"0.6881413",
"0.6855665",
"0.6843451",
"0.6843172",
"0.67761326",
"0.6762696",
"0.6748569",
"0.6676709",
"0.66604227",
"0.65687305",
"0.6551669",
"0.65283436",
"0.6512063",
"0.64696735",
"0.641345",
"0.641345",
"0.6401471",... | 0.81480145 | 0 |
Displays the result for each type (e.g. whitelisted, invalid etc.) | function showResultsForType(type, arr) {
const NO_RESULTS = "There are no input MAC addresses that are ";
var id = "#" + type;
var length = $(arr).length;
if (length == 0) {
type = type.replace(/_/g, " ");
$(id).text(NO_RESULTS + type);
} else {
var fullResult = "";
for (i = 0; i < length; i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"displayResults(type = 'array'){\n if(type === 'array'){\n console.log(this.answers);\n }else if (type === 'string'){\n console.log(`Poll resultd are ${this.answers.join(', ')}`);\n }\n }",
"function displayTypes(the_array){\n\tthe_array.forEach(function(the_item){\n\... | [
"0.619299",
"0.6129387",
"0.5938431",
"0.57685935",
"0.5745853",
"0.57036287",
"0.5590398",
"0.5580738",
"0.55739665",
"0.5548669",
"0.55459124",
"0.5526152",
"0.55178565",
"0.5470391",
"0.5469221",
"0.546402",
"0.54349613",
"0.5418157",
"0.54058105",
"0.53965026",
"0.5388472... | 0.61503446 | 1 |
Save complete solution set | function save_complete_soln(){
var data = {};
var solns_arr = [];
var flag;
$(".tbl_solutions").each(function () {
flag = 0;
var soln_ids = $(this).find("input[type=radio]:checked").val();
if(!soln_ids){
flag = 1;
alert("Please select one solution for each problem.");
return false;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function save_current_solution() {\n var mapid = get_mapid();\n var solution = get_current_solution();\n var name = $('#mt_save_solution_name').val();\n $('#mt_save_solution_name').val('');\n\n function add_solution() {\n solution_storage.add_solution(mapid, solution, name);\n }\n\n if (!name) {\n // ... | [
"0.66626906",
"0.62254685",
"0.6103515",
"0.60611033",
"0.60096204",
"0.5977029",
"0.5874449",
"0.57137126",
"0.5644071",
"0.56434727",
"0.56380343",
"0.5616393",
"0.56098115",
"0.5593232",
"0.5583418",
"0.55676174",
"0.55538213",
"0.5524972",
"0.54923815",
"0.54915",
"0.5484... | 0.6657391 | 1 |
Send DELETE request to deauthorize this node. | function sendDeauth() {
var request = $.ajax({
url: self.urls().deauthorize,
type: 'DELETE'
});
request.done(function() {
// Update observables
self.nodeHasAuth(false);
self.cancelSelection();
self.currentDisplay(null);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"del(url, opt = {}) {\n opt.method = 'DELETE';\n return this.sendRequest(url, opt);\n }",
"delete() {\n\t\treturn this.fetch(baseApiURL + this.URIPath, { method: 'DELETE' });\n\t}",
"function _delete(path) {\n const url = makeUrl(path);\n const token = getToken();\n if (getToken()) {\n re... | [
"0.6260685",
"0.6210499",
"0.6167532",
"0.6146118",
"0.60346985",
"0.59982955",
"0.59926784",
"0.59614354",
"0.595085",
"0.59261394",
"0.5890513",
"0.5882515",
"0.58746684",
"0.58659023",
"0.5853609",
"0.58286065",
"0.5799387",
"0.5798312",
"0.57941645",
"0.5784805",
"0.57764... | 0.77235603 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.