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 |
|---|---|---|---|---|---|---|
fetchDataPreES6() 2 ES6 New Way using Async/Await | async function fetchDataES6AsyncAwait() {
const url = newsurl + `&country=${userlanguage}`
const response = await fetch(url);
const data = await response.json()
renderArticles(data.articles)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function getData (url){ //aca getData nos esta devolviendo una promesa porque hace await \n const response = await fetch(url);\n const data = await response.json()\n return data;\n}",
"async function awaitFetchData() {\n let returnedData = await fetchData();\n console.log(returnedData);\n}",
"async f... | [
"0.714123",
"0.70455456",
"0.68235236",
"0.6818588",
"0.6789813",
"0.67624605",
"0.6728487",
"0.67076826",
"0.6669051",
"0.66483366",
"0.65971166",
"0.6595509",
"0.65677994",
"0.65252286",
"0.6501056",
"0.6500034",
"0.648805",
"0.6466711",
"0.64662725",
"0.6423399",
"0.641477... | 0.72521955 | 0 |
END Check grant type. | function grantTypeAllowed(clientID, grantType, callback) {
callback(false, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkContactGrants() {\r\n AppController.serverController.getRepoInterface().search(new EcContactGrant().getSearchStringByType(), function (encryptedValue) {\r\n EcRepository.get(encryptedValue.shortId(), function (encryptedValue) {\r\n var ev = new EcEncryptedValue();\r\n... | [
"0.60333323",
"0.58224386",
"0.57611525",
"0.5662902",
"0.56525713",
"0.55651486",
"0.5520261",
"0.5500767",
"0.5484484",
"0.5470609",
"0.5425251",
"0.5420594",
"0.53901637",
"0.53826666",
"0.5382081",
"0.537698",
"0.535933",
"0.5346515",
"0.5314724",
"0.5300343",
"0.5300343"... | 0.7029019 | 0 |
check all item in queue success : + false when all file not upload success + true when all file upload success | function checkAllFileUploadedFn(uploaderIn){
var checkFileAllisUpload = true;
for(var i =0; i<uploaderIn.queue.length;i++){
var item = uploaderIn.queue[i];
var itemStatus = item.isSuccess;
if(!itemStatus){
checkFileAllisUpload = false
break;
}
}
return checkFileAllisUpload;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkAllFileOfQueueUploaded(uploaderIn){\n\tvar checkFileAllisUpload = true;\n\tfor(var i =0; i<uploaderIn.queue.length;i++){\n\t\tvar item = uploaderIn.queue[i];\n\t\tvar itemStatus = item.isSuccess;\n\t\tif(!itemStatus){\n\t\t\tcheckFileAllisUpload = false\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn checkFileAl... | [
"0.83110017",
"0.71315616",
"0.68074954",
"0.67678285",
"0.6715062",
"0.6698065",
"0.6687679",
"0.6657166",
"0.65984267",
"0.6483324",
"0.64575446",
"0.6372112",
"0.6356517",
"0.6341787",
"0.62786436",
"0.625899",
"0.6227824",
"0.62244564",
"0.6216853",
"0.61838627",
"0.61790... | 0.83412683 | 0 |
upload all item by list | function uploadAllItemByList(uploaderIn){
var checkFileAllisUpload = true;
for(var i =0; i<uploaderIn.queue.length;i++){
var item = uploaderIn.queue[i];
var itemStatus = item.isSuccess;
if(!itemStatus){
item.upload();
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"uploadAll() {\n const that = this;\n\n if (that.disabled || that._items.length === 0) {\n return;\n }\n\n for (let i = that._items.length - 1; i >= 0; i--) {\n if (!that._items[i].uploading) {\n that.uploadFile(that._items[i].index);\n }\n... | [
"0.7389086",
"0.6930033",
"0.6633639",
"0.6555802",
"0.6315592",
"0.63102233",
"0.6294021",
"0.6286573",
"0.62862724",
"0.6253078",
"0.61816233",
"0.6166486",
"0.6058535",
"0.60178065",
"0.5963693",
"0.5959289",
"0.5943504",
"0.5870905",
"0.58512664",
"0.5838772",
"0.5836258"... | 0.7653996 | 0 |
get total size of list file upload return false if total file in queue greater than 10MB else return true | function getTotalSizeListFileUpload(uploaderIn){
var listFileTotalSizeByte = 0;
for(var i =0; i<uploaderIn.queue.length;i++){
var item = uploaderIn.queue[i];
var fileSize = item.file.size;
listFileTotalSizeByte += fileSize;
}
var listFileTotalSizeMB = listFileTotalSizeByte/1024/1024;
if(listFileTotalSizeMB >... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTotalSizeListFileUpload(uploaderIn){\n\tvar listFileTotalSizeByte = 0;\n\tfor(var i =0; i<uploaderIn.queue.length;i++){\n\t\tvar item = uploaderIn.queue[i];\n\t\tvar fileSize = item.file.size;\n\t\tlistFileTotalSizeByte += fileSize;\n\t}\n\tvar listFileTotalSizeMB = listFileTotalSizeByte/1024/1024;\n\t... | [
"0.84720886",
"0.70567304",
"0.6963723",
"0.67845684",
"0.67260754",
"0.66873974",
"0.6626147",
"0.6588435",
"0.6559848",
"0.6558964",
"0.6541579",
"0.65202886",
"0.65102583",
"0.64565754",
"0.6455211",
"0.6446596",
"0.64004636",
"0.64003557",
"0.6351397",
"0.63235354",
"0.62... | 0.8531992 | 0 |
validate file upload by customer type | function checkTypeDocUploadRequireCustomer(uploaderIn, typeCustomer){
var listFileDocType = getListFileDocumentType(uploaderIn);
// check cutomer is individual
if(typeCustomer == "PRIVATE"){
// check if document type CMT1 AND KH1
var checkPrivateCMT1 = $.inArray(TYPE_IMG_CMT1, listFileDocType)>-1;
var checkP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateFileBeforeUpload (file){\n // file type checking \n var validFormats = ['jpg','jpeg','png'];\n var filename = file.name;\n var ext = filename.substr(filename.lastIndexOf('.')+1);\n var matchExt = false;\n for (var index = 0; index < validFormats.length; in... | [
"0.72842586",
"0.7173709",
"0.7049238",
"0.70249665",
"0.70081216",
"0.693796",
"0.67393625",
"0.67255163",
"0.67055845",
"0.66921866",
"0.6681406",
"0.66750044",
"0.66720337",
"0.6670935",
"0.6669022",
"0.6661067",
"0.66529757",
"0.6650177",
"0.663612",
"0.6630508",
"0.66265... | 0.7259418 | 1 |
get list document type from uploader | function getListFileDocumentType(uploaderIn){
var listTypeDocument = [];
for(var i =0; i<uploaderIn.queue.length;i++){
var item = uploaderIn.queue[i];
// var itemType = item.identityDocType+"";
var itemType = item.documentType+"";
listTypeDocument.push(itemType)
}
return listTypeDocument;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDocumentTypes() {\n \n console.info(\"MultiPaymentMethodController:getDocumentTypes\");\n Visualforce.remoting.Manager.invokeAction(\n \"taOrderController.GetDocumentTypes\", $scope.bpTree.response,\n function(result) {\n ... | [
"0.72434705",
"0.67426145",
"0.6406977",
"0.6188653",
"0.6093333",
"0.5977464",
"0.59415686",
"0.59153384",
"0.589602",
"0.58399576",
"0.5834887",
"0.57350427",
"0.5730036",
"0.5717532",
"0.566469",
"0.5534962",
"0.552301",
"0.55132043",
"0.5497559",
"0.54869056",
"0.546901",... | 0.83658445 | 0 |
check all item in queue success : + false when all file not upload success + true when all file upload success | function checkAllFileOfQueueUploaded(uploaderIn){
var checkFileAllisUpload = true;
for(var i =0; i<uploaderIn.queue.length;i++){
var item = uploaderIn.queue[i];
var itemStatus = item.isSuccess;
if(!itemStatus){
checkFileAllisUpload = false
break;
}
}
return checkFileAllisUpload;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkAllFileUploadedFn(uploaderIn){\n\tvar checkFileAllisUpload = true;\n\tfor(var i =0; i<uploaderIn.queue.length;i++){\n\t\tvar item = uploaderIn.queue[i];\n\t\tvar itemStatus = item.isSuccess;\n\t\tif(!itemStatus){\n\t\t\tcheckFileAllisUpload = false\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn checkFileAllisUp... | [
"0.834099",
"0.71315724",
"0.6807177",
"0.6766498",
"0.67145056",
"0.66982114",
"0.66889626",
"0.6657388",
"0.6597623",
"0.6483005",
"0.64580595",
"0.6372898",
"0.6357067",
"0.6340759",
"0.62786776",
"0.62584877",
"0.62275326",
"0.6224368",
"0.6216532",
"0.6183863",
"0.617922... | 0.83109784 | 1 |
increases the number of dead people based on the current infected NOTE: this doesn't consider population, so the disease can erradicate itself by killing all infected before they can spread it | increaseDead(){
var buffer = this.dead + increaseByRate(this.infected-this.dead, disease.deadRate);
if(buffer >= this.infected){ // there are no living infected,
this.dead = this.infected;
}else{
this.dead = buffer;
}
if(this.dead > this.population*0.8 ){
this.state = countryStat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"increaseInfected(){\n var buffer = this.infected + increaseByRate(this.infected-this.dead, disease.contagionRate);\n if( buffer >= this.population){\n this.infected = this.population;\n }else{\n this.infected = buffer;\n }\n if(this.infected > this.population*0.6 ){\n this.alertLevel ... | [
"0.75602365",
"0.70757574",
"0.6720437",
"0.6273484",
"0.59871936",
"0.5982782",
"0.59812653",
"0.59473556",
"0.5903932",
"0.59013206",
"0.5856603",
"0.5848082",
"0.58006597",
"0.5775707",
"0.5740823",
"0.5713808",
"0.5708404",
"0.5698678",
"0.5694922",
"0.5686997",
"0.567383... | 0.76294696 | 0 |
increase the number of infected in the country infectionRate: disease's infection rate | increaseInfected(){
var buffer = this.infected + increaseByRate(this.infected-this.dead, disease.contagionRate);
if( buffer >= this.population){
this.infected = this.population;
}else{
this.infected = buffer;
}
if(this.infected > this.population*0.6 ){
this.alertLevel = alertLevels... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addInfected(num){\n this.infected += num;\n\n if(this.infected > this.population)\n this.infected = this.population;\n }",
"function incrementInterest(val){\n\tvar tempValue = parseFloat(finance.financeRate),\n\t\tincrement = parseFloat(val);\n\t\n\tupdateInterest(tempValue + incremen... | [
"0.60198337",
"0.5946351",
"0.58976424",
"0.58254886",
"0.57131225",
"0.56480736",
"0.5586589",
"0.5561841",
"0.5485301",
"0.5408217",
"0.5394563",
"0.53780305",
"0.5374217",
"0.53464705",
"0.5340772",
"0.5337788",
"0.5326276",
"0.5320536",
"0.52711904",
"0.524763",
"0.524279... | 0.701852 | 0 |
returns the index of a country in the countries vector given a code, aka "VE" for venezuela's index | function findCountryIndexByCode(code){
return countries.findIndex(country => country.code === code)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function countryCode(country)\r\n{\r\n // Placeholder waarde\r\n var code = 'xxx';\r\n \r\n // Itereer over de hele nested array in countries.js (database)\r\n for (var i = 0; i < country_codes.length; i++)\r\n {\r\n \t// Vergelijk om te kijken of het land in countries.js voorkomt\r\n i... | [
"0.63321614",
"0.58758426",
"0.5873301",
"0.5867583",
"0.57651204",
"0.5684677",
"0.55913395",
"0.5493053",
"0.5437803",
"0.53965765",
"0.538811",
"0.5351881",
"0.5350064",
"0.5320877",
"0.53148943",
"0.53104484",
"0.53093517",
"0.53064424",
"0.5299711",
"0.52598065",
"0.5250... | 0.75438523 | 0 |
returns the increment of a number by a given rate percentage has randomness | function increaseByRate(current, irate){
var rate = irate/100;
var increment = Math.ceil((current*generateRandomIntegerInRange(70,130)/100)*rate);
if(increment < 0)
return 0;
else
return increment;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _inc() {\n if (_status() >= 1) {\n return;\n }\n\n var rnd = 0;\n\n // TODO: do this mathmatically instead of through conditions\n\n var stat = _status();\n if (stat >= 0 && stat < 0.... | [
"0.7518717",
"0.75129604",
"0.7415857",
"0.7415857",
"0.7415857",
"0.7415857",
"0.73610777",
"0.7101844",
"0.6848752",
"0.6804418",
"0.6792179",
"0.6717418",
"0.67071944",
"0.66968805",
"0.66861254",
"0.6659879",
"0.6644977",
"0.66047865",
"0.6562786",
"0.65411574",
"0.653868... | 0.77907157 | 0 |
2depending on the previous exercises , write a function that returns the older classmate from mates array. | function older3ars(array){
var older=array[0].age
for (var i = 0; i < array.length; i++) {
if(array[i].age>older){
older=array[i].age
}
}
return older;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findOlder(arr)\n{\n\tvar oldest = arr[0].age;\n\tvar oldClassmate = {};\n\n\tfor(var i=1; i<arr.length; i++)\n\t{\n\t\tif(arr[i].age > oldest)\n\t\t{\n\t\t\toldest = arr[i].age;\n\t\t\toldClassmate = arr[i];\n\t\t}\n\t}\n\n\treturn oldClassmate;\n}",
"function findOldestMale(people) {\n var oldest = ... | [
"0.6833084",
"0.5665437",
"0.5645988",
"0.5499674",
"0.5454805",
"0.54388934",
"0.5432617",
"0.5381694",
"0.5350604",
"0.5340084",
"0.53285104",
"0.5318106",
"0.5234964",
"0.5206377",
"0.51798606",
"0.5157644",
"0.5107696",
"0.50886697",
"0.50761616",
"0.50553274",
"0.5026018... | 0.6063751 | 1 |
if you finished the above, solve the following: write a function that takes array of strings and returns an array of the strings that have the same length ['hi','hello','welcome','hy'] // ==> ["hi","hy"] | function sameLength(array){
var arr=[];
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < array.length; j++) {
if(array[i].length===array[j].length && j!==i){
arr.push(array[i])
}
}
}
return arr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getStringLengthArr(array) {\n var stringLengthArr = [];\n\n if (array) {\n for (a of array) {\n if (!stringLengthArr.includes(a.length)) {\n stringLengthArr.push(a.length);\n };\n };\n }\n\n return stringLengthArr;\n}",
"function shortwords(... | [
"0.69447255",
"0.6863629",
"0.65423286",
"0.64971423",
"0.6495495",
"0.6487422",
"0.6476236",
"0.6473171",
"0.6465899",
"0.6408252",
"0.6402778",
"0.6336894",
"0.6314751",
"0.6310503",
"0.63086486",
"0.6307371",
"0.6298268",
"0.62898064",
"0.62612104",
"0.6252191",
"0.6232001... | 0.7177493 | 0 |
graphEquals: test if two graphs are isomorphic through some bnode mapping. this: one of the graphs to test, referred to as "left" below. right: the other graph to test. m: (optional) writable mapping from left bnodes to write bnodes. returns: true or false side effects: m is populated with a working mapping. | function graphEquals (right, m) {
if (this.size !== right.size)
return false;
m = m || {}; // Left→right mappings (optional argument).
var back = Object.keys(m).reduce(function (ret, from) { // Right→left mappings
ret[m[from]] = from; /... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isEqual(left, right) {\n const OBJECT_STRING = '[object Object]';\n if (typeof left !== 'object' || typeof right !== 'object') {\n return left === right;\n }\n if (left === null || right === null)\n return left === right;\n const leftArray = Array.isArray(left);\n const rig... | [
"0.5573481",
"0.55611986",
"0.5360886",
"0.53465515",
"0.5309839",
"0.5295703",
"0.52737457",
"0.5273395",
"0.5273395",
"0.5273395",
"0.5267667",
"0.5267667",
"0.5267667",
"0.52356565",
"0.52356565",
"0.52356565",
"0.51892686",
"0.5159537",
"0.5122274",
"0.5108259",
"0.509078... | 0.81945395 | 0 |
Create default placeholder if element has not define size | createPlaceholder () {
if (this.element.classList.contains('mip-layout-size-defined')) {
return
}
/* istanbul ignore if */
if (this.element.querySelector('.mip-default-placeholder')) {
return
}
let placeholder = document.createElement('mip-i-space')
placeholder.classList.add('m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPlaceholder() {\n if (usePlaceholder) {\n // Remove the previous placeholder\n if (placeholder) {\n placeholder.remove();\n }\n\n placeholder = angular.element('<div>');\n placeholder.css('height', $elem[0].of... | [
"0.6916693",
"0.6307951",
"0.6116091",
"0.6111884",
"0.6082191",
"0.6081127",
"0.6081127",
"0.6026354",
"0.5958538",
"0.5949509",
"0.58704436",
"0.58273137",
"0.5738731",
"0.5710211",
"0.5705858",
"0.5705858",
"0.5705858",
"0.5690212",
"0.5666079",
"0.56404275",
"0.56319803",... | 0.75536627 | 0 |
Create Magazine object that inherits the Book object Magazine Constructor | function Magazine(title, author, year, month) {
// inherit Book object
Book.call(this, title, author, year);
this.month = month;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Magazine(name, year, author, count, genre) {\r\n // passing Magazigne as \"this\" object to Book using call() method of Book\r\n Book.call(this, name, year, author, count);\r\n this.genre = genre;\r\n}",
"function Magazine(title, author, year, month) {\n // Call the book object and take in the... | [
"0.8366935",
"0.8068208",
"0.8033256",
"0.7813311",
"0.77606",
"0.65634555",
"0.63752174",
"0.63672423",
"0.63567555",
"0.6337887",
"0.63118935",
"0.62763846",
"0.62763846",
"0.62763846",
"0.62763846",
"0.62763846",
"0.6269898",
"0.626101",
"0.62514246",
"0.6230682",
"0.62282... | 0.8273421 | 1 |
Determines how unknown values will be plotted on the chart. Null and Double.NaN are two examples of unknown values. | get unknownValuePlotting() {
return this.i.ou;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get unknownValuePlotting() {\r\n return this.i.ov;\r\n }",
"get skipUnknownValues() {\r\n return this.i.nc;\r\n }",
"function missingLogicEvaluation(){\n $scope.logicEvaluation = dqFactory.completeness.numericalPlot.logicEvaluation;\n var data = [];\n $scope... | [
"0.6852326",
"0.6074791",
"0.59707254",
"0.5967107",
"0.5967107",
"0.5621635",
"0.56185836",
"0.55123246",
"0.5481635",
"0.53710645",
"0.5370175",
"0.53161937",
"0.52966225",
"0.52922565",
"0.5290479",
"0.5280363",
"0.52510595",
"0.5245656",
"0.5216922",
"0.5209598",
"0.52060... | 0.6817312 | 1 |
Returns an array of numbers, each in the range [0, 26), representing the given key. The key is caseinsensitive, and nonletters are ignored. Examples: filterKey("AAA") = [0, 0, 0] filterKey("abc") = [0, 1, 2] filterKey("the $123 EHT") = [19, 7, 4, 4, 7, 19] | function filterKey(key) {
var result = [];
for (var i = 0; i < key.length; i++) {
var c = key.charCodeAt(i);
if (isLetter(c)){
result.push((c - 65) % 32);
}
}
return result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function filterKey(key) {\r\n var result = [];\r\n for (var i = 0; i < key.length; i++) {\r\n var c = key.charCodeAt(i);\r\n if (isLetter(c))\r\n result.push((c - 65) % 32);\r\n }\r\n return result;\r\n}",
"function filterKey(array, key) {\n\treturn array.filter(function(value) {\n\t\treturn value... | [
"0.77747923",
"0.57372767",
"0.5589411",
"0.55005115",
"0.54431003",
"0.53064203",
"0.5286275",
"0.5274863",
"0.52584416",
"0.51371455",
"0.5108347",
"0.5096633",
"0.50812703",
"0.5056546",
"0.502514",
"0.49875987",
"0.49867555",
"0.4980382",
"0.4952553",
"0.49290386",
"0.492... | 0.772364 | 1 |
Returns a promise that resolves to a todo list with the speciefied ID. The todo list contains the todos for that list. The todos are not sorted. If todo list is not found `undefined` is returned. | async loadTodoList(todoListId) {
const FIND_TODOLIST = 'SELECT * FROM todolists WHERE id = $1 AND username = $2';
const FIND_TODOS = 'SELECT * FROM todos WHERE todolist_id = $1 AND username = $2';
let resultTodoList = dbQuery(FIND_TODOLIST, todoListId, this.username);
let resultTodos = dbQuery(FIND_TODO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"*resolveTodo(todoID) {\n return this.todos[todoID];\n }",
"async sortedTodoLists() {\n const FIND_TODOLISTS = 'SELECT * FROM todolists' +\n ' WHERE username = $1' +\n ' ORDER BY lower(title) ASC';\n\n const FIND_TODOS = 'SELECT * FROM todos ' +\n ... | [
"0.6444928",
"0.6426199",
"0.6381159",
"0.635264",
"0.6249238",
"0.62484133",
"0.6203249",
"0.61589915",
"0.61462575",
"0.61189425",
"0.59324175",
"0.5922487",
"0.58817446",
"0.5804697",
"0.5710824",
"0.5704682",
"0.5677036",
"0.5676021",
"0.5672185",
"0.5660922",
"0.5659664"... | 0.64330447 | 1 |
Returns a promise which resolves to a sorted list of todo lists and along with all their todos. Lists are sorted by completion status and title. Todos are unsorted. | async sortedTodoLists() {
const FIND_TODOLISTS = 'SELECT * FROM todolists' +
' WHERE username = $1' +
' ORDER BY lower(title) ASC';
const FIND_TODOS = 'SELECT * FROM todos ' +
' WHERE username = $1';
let resultTodoLists = dbQu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async sortedTodoLists() {\n const ALL_TODOLISTS = \"SELECT * FROM todolists\" +\n \" WHERE username = $1\" +\n \" ORDER BY lower(title) ASC\";\n const FIND_TODOS = \"SELECT * FROM todos WHERE todolist_id = $1\";\n\n let result = await dbQuery(ALL_TODOLIS... | [
"0.7726755",
"0.6979398",
"0.65984404",
"0.63755333",
"0.6131322",
"0.59308654",
"0.5919485",
"0.5782424",
"0.5722735",
"0.5717588",
"0.5706646",
"0.56991404",
"0.5684449",
"0.5651676",
"0.5623055",
"0.5602063",
"0.5592304",
"0.5586986",
"0.55792576",
"0.5553362",
"0.55458987... | 0.7882562 | 0 |
Delete a todo list from todo lists. Returns `true` if success otherwise `false` ID argument must be a number | async deletedTodoList(todoListId) {
const DELETE_TODOLIST = 'DELETE FROM todolists WHERE id = $1 AND username = $2';
let result = await dbQuery(DELETE_TODOLIST, todoListId, this.username);
return result.rowCount > 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async deleteTodoList(todoListId) {\n const DELETE_TODOLIST = `\n DELETE FROM todolists WHERE id = $1 AND username = $2`;\n\n let resultTodoList =\n await dbQuery(DELETE_TODOLIST, todoListId, this.username);\n\n return resultTodoList.rowCount > 0;\n\n }",
"function deleteTodoList(listId) {\n h... | [
"0.7390685",
"0.71570605",
"0.7106588",
"0.70877177",
"0.7079246",
"0.70312953",
"0.6947826",
"0.69450736",
"0.6928248",
"0.68719447",
"0.6864624",
"0.6857922",
"0.6791854",
"0.67766523",
"0.6774813",
"0.67056304",
"0.6675109",
"0.6632657",
"0.65974873",
"0.65822256",
"0.6515... | 0.7260215 | 1 |
Mark all todos on the todo list as done. Returns `true` on success, `false` if the todo list doesn't exist. The todo list ID must be numeric | async completeAllTodos(todoListId) {
const UPDATE_TODOLIST = 'UPDATE todos SET done = TRUE ' +
'WHERE todolist_id = $1 ' +
'AND NOT done ' +
'AND username = $2';
let result = await dbQuery(UPDATE_TODOLIST, todoListId, this.u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function markAllTodos() {\n arrTodos.value.map(todo => todo.done = true)\n }",
"async toggleDoneTodo(todoListId, todoId) {\n const TOGGLE_DONE = `\n UPDATE todos\n SET done = NOT done\n WHERE todolist_id = $1 AND id = $2 AND username = $3`;\n\n let result = await dbQuery(TOGGLE_DONE, tod... | [
"0.70815027",
"0.6747457",
"0.67387605",
"0.66388386",
"0.6578295",
"0.655089",
"0.6401652",
"0.6288296",
"0.62332094",
"0.62276196",
"0.6175205",
"0.6157208",
"0.6150653",
"0.61315906",
"0.6121974",
"0.6103741",
"0.61013687",
"0.61000824",
"0.60965693",
"0.6076275",
"0.60585... | 0.74361014 | 0 |
After Google maps have been loaded Add alt tags to all of it images for SEO needs. altImgMap(); | function altImgMap() {
if (typeof google === 'object' && typeof google.maps === 'object') {
// Get all the images in the google map
var googleMapImages = $("#map img");
// Check which images do not have alt attribute and add an empty one
googleMapImages.each(function( index, value ) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initImageMap() {\r\n $('#imageMap>area').each((_, area) => {\r\n let map = $(area).attr('title');\r\n $(area).off('click').on('click', (_) => {\r\n selectMap(map);\r\n })\r\n });\r\n}",
"function mapFunction() {\n\tvar lt = $(this).attr('data-lat');\n\tvar lg = $(this).attr('data-long');... | [
"0.6762709",
"0.63653946",
"0.63353753",
"0.63287467",
"0.6310106",
"0.62851316",
"0.6219088",
"0.62127274",
"0.6205216",
"0.6204695",
"0.6145388",
"0.6144055",
"0.6144009",
"0.6131708",
"0.6125648",
"0.6123751",
"0.6121248",
"0.6077745",
"0.6072855",
"0.6063382",
"0.60608655... | 0.84931815 | 0 |
Parses object with WHERE clause recursively and generates MongoDB `find` query object | function parseWhere(root) {
const operator = Object.keys(root)[0];
// extract leaf binary expressions
if (operator === 'AND') {
const e1 = parseWhere(root[operator][0]);
const e2 = parseWhere(root[operator][1]);
// eslint-disable-next-line
return { '$and' : [
e1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function find_recursive(doc, key, value, comOperator) {\n for (var attr in doc) {\n if ((typeof doc[key] != \"undefined\") && (typeof comOperator != \"undefined\" ) && comOperator !== \"\") {\n if(comOperator.trim() == \"=\"){\n return eq(doc,key,value)\n }\n ... | [
"0.58853483",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.5785293",
"0.57362044",
"0.57083243",
"0.5686818",
"0.5669604",
"0.5599045",
"0.55980474",
"0.55589306",
"0.5548933",
"0.5534744",
"0.5461206",
"0.53669727... | 0.6396408 | 0 |
Check if user is among fav contacts | function checkFav(){
if (currentManipulatedUser && currentManipulatedUser.fav){
addFav.style.color = "gold";
// console.log(currentManipulatedUser);
return;
}
addFav.style.color = "white";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function favExists(user, favID) {\n let x = user.favorites.length;\n for (let i = 0; i < x; i++) {\n if (user.favorites[i] === favID) {\n //console.log(\"THIS IS HAPPENING BECAUSE IT ALREADY EXISTS\");\n return true;\n }\n }\n return f... | [
"0.6262916",
"0.61726266",
"0.6090629",
"0.6067561",
"0.6063103",
"0.59946",
"0.59289294",
"0.5903693",
"0.5876003",
"0.5875913",
"0.5863218",
"0.5842423",
"0.58201385",
"0.58111465",
"0.5778735",
"0.5757299",
"0.5736364",
"0.57225084",
"0.5674889",
"0.5615964",
"0.5615169",
... | 0.62384063 | 1 |
get the link only for the filtered movies | function linksForFilteredMovies() {
let newMap = new Map();
// for each person
mapCrewMovie.forEach(function (value, key, map) {
let newSet = new Set();
// for each movie linked to one person
value.forEach(function (d) {
// if the movie is in the list of filtered movie, k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function allMovieTitleLinks() {\n return $('.movie .name a')\n}",
"function linkMovie(id) {\n const { location } = props;\n const { lng } = qs.parse(location.search);\n\n dispatch(resetMovieDetails());\n redirect(`/movies/${id}?${qs.stringify({ lng })}`);\n }",
"getRelatedMovie(movies) ... | [
"0.64263576",
"0.6255108",
"0.62183356",
"0.61832684",
"0.6087862",
"0.60524374",
"0.6043972",
"0.6036704",
"0.597858",
"0.5933758",
"0.5886412",
"0.5869295",
"0.5865482",
"0.5853444",
"0.5853083",
"0.58423805",
"0.5800908",
"0.5775897",
"0.5763135",
"0.5762554",
"0.5750168",... | 0.6396734 | 1 |
filter list of linked movie by the department | function filterLinksPerDepartement(dept, _map) {
// if no filter -> do nothing
if (dept != "All") {
let newMap = new Map();
//for each person
_map.forEach(function (value, key, map) {
let newSet = new Set();
// for each movie of that person
value.forEa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"genreFilter(movie){\n return this.genreMovies.filter(e => movie.genre_ids.includes(e.id));\n }",
"function search_movie() {\n console.log(curr_language)\n console.log(curr_genre)\n let filtered = movies\n //filtering every time whenever user choose another category\n filtered = movies.filt... | [
"0.5810943",
"0.58006114",
"0.5722184",
"0.5705254",
"0.5686605",
"0.56041145",
"0.55517745",
"0.5547849",
"0.5530143",
"0.55117196",
"0.548467",
"0.54542154",
"0.54422915",
"0.54407686",
"0.5418542",
"0.53449917",
"0.53301704",
"0.5320847",
"0.5296036",
"0.52411354",
"0.5225... | 0.6754602 | 0 |
remove the company filter | function removeCompanyFilter() {
currentCompany = "";
document.getElementById('reset-company-filter').style.display = "none";
filterAll();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeFilter() {\n vm.filterApplied = null;\n activate();\n }",
"removeAllFilters() {}",
"clearFilter() {\r\n this.refs.propertyGrid.onSelectAll(false, []);\r\n this.props.toggleButtonText(false);\r\n this.stateSet({ clearFilterKey: Math.random(), filt... | [
"0.68716633",
"0.67823476",
"0.66562396",
"0.6509096",
"0.6460428",
"0.64409727",
"0.6409607",
"0.6319755",
"0.6315306",
"0.6306805",
"0.626715",
"0.6232444",
"0.6231088",
"0.6168275",
"0.6123369",
"0.61092293",
"0.61057913",
"0.6104125",
"0.6090173",
"0.60808164",
"0.6074195... | 0.8217846 | 0 |
filter by a define company | function filterCompany(company) {
cleanSearch();
currentCompany = company;
let newMap = new Map();
document.getElementById('reset-company-filter').style.display = "inline-block";
document.getElementById('production-company-name').innerHTML = ("X - " + company);
mapMovie_filtered.forEach(function... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function company_query(frm, cdt, cdn) {\n\tconst row = frm.selected_doc || locals[cdt][cdn];\n\treturn {\n\t\tfilters: {\n\t\t\t\"company\": row.company,\n\t\t\t\"is_group\": 0\n\t\t}\n\t};\n}",
"function filterCompanyNames(input){\n\t\tFilteredSearch.filterCompanyNames(input, function(data){\n\t\t\t$scope.filte... | [
"0.73617864",
"0.6701894",
"0.6564706",
"0.63882256",
"0.6021206",
"0.5958661",
"0.5873983",
"0.5845949",
"0.58052707",
"0.57914627",
"0.5780184",
"0.5736732",
"0.57146484",
"0.5687295",
"0.5686254",
"0.56253976",
"0.5578851",
"0.55691385",
"0.5558978",
"0.55543756",
"0.55463... | 0.6964907 | 1 |
Check if roomName exists, use DOM roomName otherwise, then join room | function joinRoom(roomName) {
disableElements('joinRoom');
// Check if roomName was given or if it's joining via roomName input field
if(typeof roomName == 'undefined'){
roomName = document.getElementById('roomName').value;
}
document.getElementById('roomName').value = roomName;
var da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getJoinedRoom(name)\n{\n var room_count = room.rooms.length\n for (var i = 0; i < room_count ; i++)\n {\n var r = room.getRoomById(room.rooms[i].id)\n if (r)\n {\n var p = r.isWaiting(name)\n if (p) // le joueur est inscrit dans cette room\n {... | [
"0.71198684",
"0.6875809",
"0.68280274",
"0.67895037",
"0.6688516",
"0.66307735",
"0.6594283",
"0.6594134",
"0.65875375",
"0.65799475",
"0.6463742",
"0.64550155",
"0.6403398",
"0.6393873",
"0.63751405",
"0.6368148",
"0.6349302",
"0.63492864",
"0.63266635",
"0.63151103",
"0.63... | 0.717205 | 0 |
Tell room you're leaving and remove all video elements | function leaveRoom(){
disableElements("leaveRoom");
var message = {
id: "leaveRoom"
};
participants[sessionId].rtcPeer.dispose();
sendMessage(message);
participants = {};
var myNode = document.getElementById("video_list");
while (myNode.firstChild) {
myNode.removeChild... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function videoRemove(){\n\tvar videoElement = document.getElementById(\"videoContainerSeasonOne\")\n\tvideoElement.innerHTML = \"\"\n}",
"leaveRoom() {\n debug('videoChat:leaveRoom');\n const localMedia = this.get('stream');\n if (localMedia) {\n (localMedia.getTracks() || []).forEach(t => t.stop()... | [
"0.700962",
"0.6857915",
"0.6786193",
"0.6784279",
"0.665665",
"0.6590478",
"0.65681744",
"0.64963734",
"0.6478795",
"0.6453614",
"0.641523",
"0.6413865",
"0.64104223",
"0.6397883",
"0.6294831",
"0.6290427",
"0.628082",
"0.6272872",
"0.62687624",
"0.6259853",
"0.6243814",
"... | 0.74741954 | 0 |
Request video from all existing participants | function onExistingParticipants(message) {
// Standard constraints
var constraints = {
audio: true,
video: {
frameRate: {
min: 1, ideal: 15, max: 30
},
width: {
min: 32, ideal: 50, max: 320
},
height: {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function requestVideos() {\n return {\n type: \"REQUEST_VIDEOS\"\n }\n}",
"async function getVideos() {\n if (user.length === 0) {\n history.push('/')\n toast.error('You need to log in first. Click on the google button on the nav bar to proceed')\n } else {\n ... | [
"0.6524972",
"0.64694315",
"0.64426935",
"0.642641",
"0.6276755",
"0.62367904",
"0.620425",
"0.6128733",
"0.6108789",
"0.61067265",
"0.6100262",
"0.6058439",
"0.60522896",
"0.6026743",
"0.601518",
"0.6001116",
"0.5990155",
"0.5972636",
"0.5969214",
"0.5968792",
"0.5961602",
... | 0.7049646 | 0 |
Receive video from new participant | function onNewParticipant(message) {
receiveVideoFrom(message.new_user_id)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onExistingParticipants(message) {\n // Standard constraints\n var constraints = {\n audio: true,\n video: {\n frameRate: {\n min: 1, ideal: 15, max: 30\n },\n width: {\n min: 32, ideal: 50, max: 320\n },\n ... | [
"0.7814229",
"0.7264088",
"0.7155959",
"0.7103113",
"0.6976331",
"0.696558",
"0.6923167",
"0.6866269",
"0.6850559",
"0.6849743",
"0.6800209",
"0.67810863",
"0.6768231",
"0.6749105",
"0.67395097",
"0.6723946",
"0.67220986",
"0.67120725",
"0.6663445",
"0.6663445",
"0.6600546",
... | 0.81729007 | 0 |
Destroy videostream/DOM element on participant leaving room | function onParticipantLeft(message) {
var participant = participants[message.sessionId];
participant.dispose();
delete participants[message.sessionId];
console.log("video-" + participant.id);
// remove video tag
//document.getElementById("video-" + participant.id).remove();
var video = docu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function leaveRoom(){\n\n disableElements(\"leaveRoom\");\n var message = {\n id: \"leaveRoom\"\n };\n\n participants[sessionId].rtcPeer.dispose();\n sendMessage(message);\n participants = {};\n\n var myNode = document.getElementById(\"video_list\");\n while (myNode.firstChild) {\n ... | [
"0.7631462",
"0.72655344",
"0.69446224",
"0.6854853",
"0.67568415",
"0.65738535",
"0.65058154",
"0.6499658",
"0.64944357",
"0.6479808",
"0.64561796",
"0.6375091",
"0.6347835",
"0.63385326",
"0.6334777",
"0.63188994",
"0.6307845",
"0.6302693",
"0.6302693",
"0.6302693",
"0.6302... | 0.73618925 | 1 |
If the image height is smaller than the maximum height, crop the image at its exact height Note: The height of the image is not available until it is visible | function adjustHeight() {
var img = slides[currentSlide].img;
if(img.height() < wSettings.image_max_height) {
img.parent().css('height', img.height());
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function filterImageBySize(height, width) {\n _minHeight = 180;\n _minWidth = 180;\n if(height>_minHeight && width > _minWidth)\n return true;\n else\n return false;\n}",
"cropImage(img) {\n const width = img.shape[0];\n const height = img.shape[1];\n const shorterSide = Math.... | [
"0.6237271",
"0.6204364",
"0.6184292",
"0.6184292",
"0.6063413",
"0.59277403",
"0.58993196",
"0.58236104",
"0.57771695",
"0.5761888",
"0.574199",
"0.5729779",
"0.5708323",
"0.5669066",
"0.563273",
"0.5622599",
"0.5578382",
"0.55715114",
"0.5510257",
"0.5484768",
"0.5478684",
... | 0.66802293 | 0 |
Mime class should have no knowledge of the Actor or Level classes to keep it decoupled | function Mime(config){
this.controller = config.controller;
this.x = config.x;
this.y = config.y;
this.width = config.width;
this.height = config.height;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getMimeType() {\n\t\treturn this.mime;\n\t}",
"messageFileListener(msg, type) {\n var file = false;\n\n // track the file request\n this._app._Analytics.trackFile(msg, type);\n\n // get file info\n if (type === \"photo\") {\n // get the highest quality picture\n ... | [
"0.5459254",
"0.5391526",
"0.5346077",
"0.53184587",
"0.53127724",
"0.52743095",
"0.51966304",
"0.5087037",
"0.5031202",
"0.49801758",
"0.49189058",
"0.49032432",
"0.48850626",
"0.48811564",
"0.48667043",
"0.48180017",
"0.4808505",
"0.47994602",
"0.47968635",
"0.47966003",
"0... | 0.59450674 | 0 |
Initialize session time out object | function initializeSessionTimeout() {
objTimeout = new timeoutObj();
// if the keepSessionAlive property is true
if (keepSessionAlive.toUpperCase() == "TRUE") {
// Set timeoutInMilliSeconds to be 1 minute less than the session timeout
objTimeout.timeoutInMilliSeconds = maxInactiveInte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(timeout_in_secs) {\n this.initial_timeout_in_secs = timeout_in_secs\n this.reset()\n }",
"function InitSessionTimer() \n{\n /* mReschke 2010-09-29 */\n warn_sec = 12* 59 * 60 * 1000; //Warning time in milliseconds\n timeout_sec = 12*60 * 60 * 1000; //Actual timeou... | [
"0.70719445",
"0.7050042",
"0.68620425",
"0.66328996",
"0.6583188",
"0.62218636",
"0.6205955",
"0.61937815",
"0.61754864",
"0.6163735",
"0.61274207",
"0.6092208",
"0.60551447",
"0.60541713",
"0.60511184",
"0.6042072",
"0.6027763",
"0.597117",
"0.59406084",
"0.5909433",
"0.589... | 0.7936864 | 0 |
`CircularProgress` Displays a circular progress indicator. Set the `angle` property to set the exact angle in degrees, or the `step` property to an integer (and `stepSize` to the angular factor for `step`.) `size` is the size, in pixels (default 32); this is the size of the element, as a whole. | function CircularProgress(props) {
let visible = props.visible === undefined ? true : props.visible;
let angle = props.angle === undefined ? null : props.angle;
let size = props.size || 32;
if(props.step) {
angle = props.step * (props.stepSize || (90 / 4));
}
let rotate = {};
if(angle) {
rot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CircularProgressWrapper({ size = 180, thickness = 3.6 }) {\n return (\n <Container>\n <CircularProgress size={size} thickness={thickness} />\n </Container>\n );\n}",
"function CircularProgress(props) {\n var _classNames2;\n\n var classes = props.classes,\n className = props.className... | [
"0.68496835",
"0.64447707",
"0.5766377",
"0.5686125",
"0.5659613",
"0.56455857",
"0.56262684",
"0.5626179",
"0.5506795",
"0.5472561",
"0.54684",
"0.5465629",
"0.54572344",
"0.5427905",
"0.5411227",
"0.5389062",
"0.53691846",
"0.5239344",
"0.522163",
"0.52115214",
"0.5203504",... | 0.71687156 | 0 |
if either side of the image is larger than container, resize it image resize function | function resizeImg(){
//console.log('Slide '+idx+' is resized');
if (imgAR>panelAR) { //wider/shorter than default
nImgW = panelW; //match by width
nImgH = Math.round(panelW/imgAR);
positionImg(); //positon image vertically
} else if (imgAR==panelAR) { //same AR
nImgW = panelW; //match ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resizeImage(img,w,h) {\n//check images exist and width&height >0 and custom width >0\nif(img&&img.width&&img.height&&w) {\nif(!h) h=w;\nif(img.width<w&&img.height<h) return;\nvar fit=img.width/img.height>=w/h;\nimg[fit?'width':'height']=fit?w:h;\n}\n}",
"function setSize(img, opt) {\n\n\n opt.wid... | [
"0.6816557",
"0.6748802",
"0.67167085",
"0.66999537",
"0.6686414",
"0.66257864",
"0.6623793",
"0.6600542",
"0.65972245",
"0.64264953",
"0.64137334",
"0.6351409",
"0.6341592",
"0.63141304",
"0.6277008",
"0.62619877",
"0.6253714",
"0.6253714",
"0.6253714",
"0.6253714",
"0.62489... | 0.6752713 | 1 |
u(t) is called 60 times per second. t: Elapsed time in seconds. S: Shorthand for Math.sin. C: Shorthand for Math.cos. T: Shorthand for Math.tan. R: Function that generates rgbastrings, usage ex.: R(255, 255, 255, 0.5) c: A 1920x1080 canvas. x: A 2D context for that canvas. | function u(t, S, C, T, R, c, x) {
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function unit_speed_trajectory(t,x_center,rgb) {\n p.fill(rgb[0],rgb[1],rgb[2]);\n r = p.sqrt(x_center*x_center+1);\n t_0 = p.log(r - x_center); // the \"time\" (0,1) is supposed to be at\n t_shifted = t + t_0;\n e2t = p.exp(2*t_shifted);\n et = p.exp(t_shifted);\n tanht = (e2t - 1)/(e2t + 1);... | [
"0.62906873",
"0.5819019",
"0.57210416",
"0.56943685",
"0.55674666",
"0.5565565",
"0.555437",
"0.55249995",
"0.5408621",
"0.54047877",
"0.54020554",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424",
"0.5345424... | 0.69466805 | 0 |
Play Video //if the video is in full screen, don't mute the sound and play it. | function playVid(musicVid) {
if (document.fullscreenElement) {
document.fullscreenElement.muted = false;
document.fullscreenElement.play();
}
else {
musicVid.muted = true;
musicVid.play();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onPlayerReady(event) {\n event.target.mute();\n event.target.setVolume(0);\n event.target.playVideo(); \n}",
"function onPlayerReady(event) {\r\nevent.target.playVideo();\r\nplayer.mute();\r\n}",
"function OnStart()\n{\n loader.style.display = \"none\";\n video.play();\n video.volume... | [
"0.75390077",
"0.74701875",
"0.7435499",
"0.738813",
"0.7325688",
"0.72689915",
"0.7266325",
"0.72502494",
"0.70666236",
"0.70594597",
"0.7030531",
"0.70234174",
"0.7002015",
"0.69970185",
"0.6989185",
"0.6989185",
"0.6977257",
"0.6933855",
"0.69307154",
"0.6922129",
"0.69208... | 0.76897174 | 0 |
Text to image converter using html2canvas | function barcode2img(){
html2canvas(document.querySelector("#barcodeText")).then(canvas => {
document.body.appendChild(canvas);
var dataURL = canvas.toDataURL("image/jpeg");
document.getElementById("barcodeIMG").src = canvas.toDataURL();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function txtToImg(selString) {\n //Creates canvas element\n var canv = document.createElement('canvas');\n canv.setAttribute(\"type\", \"hidden\");\n canv.id = 'canvas';\n canv.width = 500;\n canv.height = 500;\n canv.style.position = \"a... | [
"0.7434303",
"0.69358695",
"0.65950555",
"0.64801013",
"0.6344737",
"0.62278634",
"0.6042088",
"0.6039921",
"0.60360545",
"0.60075694",
"0.5970684",
"0.59684485",
"0.5880088",
"0.5832818",
"0.581781",
"0.5794463",
"0.5771772",
"0.5768345",
"0.5732771",
"0.56890464",
"0.568837... | 0.7348134 | 1 |
this function will handle all the periodic tasks required for this rest backend | function rppPeriodicTasks() {
getEndpointsDataPeriodicTask();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getEndpointsDataPeriodicTask() {\n const taskSchedule = new schedule.RecurrenceRule();\n\n /* schedule this call in every N seconds*/\n taskSchedule.second = [20, 40];\n schedule.scheduleJob(taskSchedule, function () {\n\n /* This task will be an aysnc task : \n * 1- updates the... | [
"0.66825664",
"0.63917065",
"0.6331764",
"0.625378",
"0.6141334",
"0.61173767",
"0.6096748",
"0.6075606",
"0.60652107",
"0.5925065",
"0.58303887",
"0.5803892",
"0.5803214",
"0.57862353",
"0.57644355",
"0.5715363",
"0.56744766",
"0.56604177",
"0.56472445",
"0.5641557",
"0.5622... | 0.7230168 | 0 |
Create a Bound from a [ClientRect]( object. | static fromBoundingRect(rect) {
let b = new Bound(new Pt_1.Pt(rect.left || 0, rect.top || 0), new Pt_1.Pt(rect.right || 0, rect.bottom || 0));
if (rect.width && rect.height)
b.size = new Pt_1.Pt(rect.width, rect.height);
return b;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Boundary(x, y, w, h) {\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n\tthis.width = w;\r\n\tthis.height = h;\r\n\r\n\tthis.type = \"boundary\";\r\n\tthis.bouncy = false;\r\n}",
"function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {\n return {\n left: bounds.left,\n top: bounds.top,\n right: bounds.r... | [
"0.60707265",
"0.6062211",
"0.604263",
"0.60270154",
"0.6024163",
"0.60198116",
"0.5960669",
"0.58799666",
"0.58799666",
"0.58799666",
"0.58799666",
"0.58799666",
"0.58799666",
"0.5878506",
"0.58309793",
"0.58028746",
"0.57467157",
"0.5743419",
"0.57172656",
"0.56648964",
"0.... | 0.72770494 | 0 |
Clone this bound and return a new one | clone() {
return new Bound(this._topLeft.clone(), this._bottomRight.clone());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function boundClone() {\n var args, val;\n args = Array.prototype.slice.call(arguments);\n val = this.valueOf(); // jshint ignore:line\n return clone(val);\n }",
"clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n ... | [
"0.8081097",
"0.7581088",
"0.7581088",
"0.7525305",
"0.7405961",
"0.7322996",
"0.7311602",
"0.72431874",
"0.72431874",
"0.72048855",
"0.7176205",
"0.71160656",
"0.7087912",
"0.7063761",
"0.7040446",
"0.7038543",
"0.7038543",
"0.7038543",
"0.7038543",
"0.6945471",
"0.694421",
... | 0.7949597 | 1 |
Recalculte size and center | _updateSize() {
this._size = this._bottomRight.$subtract(this._topLeft).abs();
this._updateCenter();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateSize() {\n innerRadius = innerRadiusArg * canvas.width / 2;\n outerRadius = outerRadiusArg * canvas.width / 2;\n \n centerX = centerXArg * canvas.width;\n centerY = centerYArg * canvas.height;\n }",
"_updatePosFromCenter() {\n let half = this._size.$mul... | [
"0.7532664",
"0.745906",
"0.7219259",
"0.6884982",
"0.6847995",
"0.6756757",
"0.6698998",
"0.6669457",
"0.66058224",
"0.6602619",
"0.66021043",
"0.65792596",
"0.6570051",
"0.6558753",
"0.6529058",
"0.649064",
"0.647486",
"0.6464656",
"0.64450103",
"0.6343787",
"0.63433784",
... | 0.770309 | 0 |
Recalculate based on topleft position and size | _updatePosFromTop() {
this._bottomRight = this._topLeft.$add(this._size);
this._updateCenter();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function top_calcul(){\r\n \r\n pose_menu();\r\n \r\n if(xsmall){\r\n top2=$('.g-head').innerHeight() + 524;\r\n }else{\r\n var cons=0;\r\n if(small){\r\n cons=170;\r\n }else if(md){\r\n cons=170;\r\n ... | [
"0.67808455",
"0.6752612",
"0.65468156",
"0.64508384",
"0.64312404",
"0.64312404",
"0.64312404",
"0.6398778",
"0.6374485",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226",
"0.6306226... | 0.74772966 | 0 |
Recalculate based on bottomright position and size | _updatePosFromBottom() {
this._topLeft = this._bottomRight.$subtract(this._size);
this._updateCenter();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_updateSize() {\n this._size = this._bottomRight.$subtract(this._topLeft).abs();\n this._updateCenter();\n }",
"_updatePosFromTop() {\n this._bottomRight = this._topLeft.$add(this._size);\n this._updateCenter();\n }",
"set BottomRight(value) {}",
"get BottomRight() {}",
"g... | [
"0.7307401",
"0.6860654",
"0.65524703",
"0.64389896",
"0.6362028",
"0.61612755",
"0.61350554",
"0.61232376",
"0.6116049",
"0.60795105",
"0.6079319",
"0.6079319",
"0.6079319",
"0.6039223",
"0.595568",
"0.59499854",
"0.5943463",
"0.5943463",
"0.5943463",
"0.5939394",
"0.5893419... | 0.7608431 | 0 |
Recalculate based on center position and size | _updatePosFromCenter() {
let half = this._size.$multiply(0.5);
this._topLeft = this._center.$subtract(half);
this._bottomRight = this._center.$add(half);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_updateSize() {\n this._size = this._bottomRight.$subtract(this._topLeft).abs();\n this._updateCenter();\n }",
"function updateSize() {\n innerRadius = innerRadiusArg * canvas.width / 2;\n outerRadius = outerRadiusArg * canvas.width / 2;\n \n centerX = centerXArg * ca... | [
"0.7333228",
"0.72272766",
"0.70066446",
"0.67452294",
"0.6730618",
"0.65810245",
"0.6565287",
"0.64834833",
"0.64694643",
"0.6423031",
"0.6406638",
"0.6375935",
"0.63749784",
"0.63699937",
"0.6365293",
"0.6349114",
"0.6348855",
"0.63103116",
"0.6295443",
"0.6289591",
"0.6285... | 0.80155635 | 0 |
Strip schema definitions from source files for smaller built file size. We do this by building an AST of source files and removing everything after the module.exports = (.) expr. | function stripSchema(file) {
var data = '';
function visitModuleExportsExpr(traverse, node, path, state) {
jstutils.catchup(node.range[1]+1, state); // Last line is module.exports = (.*);
jstutils.move(data.length, state); // Skip over schema definitions
}
visitModuleExportsExpr.test = function(node, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function normalizeSource (lines) {\n\t_.each(lines, function (line, i) {\n\t\tline = line.replace(/#.*/gi, '');\n\t\tline = line.replace(/\\/\\*.*\\*\\//gi, '');\n\t\tline = line.replace(/^\\s+/gi, '');\n\t\tline = line.replace(/\\s+$/gi, '');\n\t\tline = line.replace(/\\s+/gi, ' ');\n\t\tlines[i] = line;\n\t});\n... | [
"0.58313423",
"0.56852996",
"0.5629201",
"0.5622869",
"0.5543673",
"0.5543673",
"0.5543673",
"0.55366635",
"0.54935193",
"0.54563427",
"0.5432702",
"0.53966916",
"0.5349216",
"0.53459513",
"0.52678144",
"0.52403796",
"0.52289057",
"0.52142316",
"0.5179061",
"0.5179061",
"0.51... | 0.74179995 | 0 |
pixelspermeter is used to describe relation between real world and pixel distances. `pixelSpaceConversion` can be used to convert the ratio from mercator projection to the currently active projection. `pixelSpaceConversion` is useful for converting between pixel spaces where some logic expects mercator pixels, such as ... | pixelSpaceConversion(lat: number, worldSize: number, interpolationT: number): number { // eslint-disable-line
return 1.0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getPixelPerMeter() {\n\t\tlet ppm = new vec2(this.#_fusion.targetOutSize.x/this.#_augmentaScene.scene.x,this.#_fusion.targetOutSize.y/this.#_augmentaScene.scene.y);\n\t\treturn ppm;\n\t}",
"function pixelsToMeters( px, py, zoom )\n {\n var res = this.resolution(zoom);\n var mx = px * res - this.... | [
"0.5672715",
"0.5655239",
"0.5655239",
"0.530684",
"0.504824",
"0.4944455",
"0.48954433",
"0.48954433",
"0.47583428",
"0.47502765",
"0.47110754",
"0.47081795",
"0.4645188",
"0.4622058",
"0.46186057",
"0.46173885",
"0.46158704",
"0.45909685",
"0.45483208",
"0.45407927",
"0.453... | 0.65048313 | 0 |
return first element in scope containing casesensitive text | function getElementByText(scope, text) {
// iterate descendants of scope
for (var all = scope.childNodes, index = 0, element; (element = all[index]); ++index) {
// conditionally return element containing visible, whitespace-insensitive, case-sensitive text (a match)
if (element.nodeType == 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fuelTextExactCI(elem, text) {\n\t\treturn (elem.textContent || elem.innerText || $(elem).text() || '').toLowerCase() === (text || '').toLowerCase();\n\t}",
"getContentsLowercase() {\n return this.$node.text().toLowerCase();\n }",
"function indexText(text) {\n\treturn text.toLowerCase();\n}",
"fu... | [
"0.66719574",
"0.602838",
"0.5825146",
"0.58180773",
"0.57710433",
"0.57290906",
"0.5676539",
"0.5662762",
"0.56234425",
"0.5591411",
"0.5582546",
"0.5582186",
"0.5576519",
"0.5532223",
"0.5516043",
"0.5487233",
"0.5481007",
"0.5465359",
"0.5455419",
"0.5449654",
"0.5440456",... | 0.6065664 | 1 |
set mounted as false clear all timers | componentWillUnmount() {
this._isMounted = false;
clearTimeout(this.intervalID);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"componentWillUnmount() {\n this.clearTimers()\n }",
"componentWillUnmount() {\r\n\t\tthis.stopTimer()\r\n\t\tthis.resetTimer()\r\n\t}",
"unmountActions() {\n clearInterval(this.interval);\n clearInterval(this.timerInterval);\n clearTimeout(this.pauseBetweenClicksTimeout);\n clearInterval(this.c... | [
"0.67815775",
"0.6720962",
"0.65819705",
"0.65605986",
"0.6525879",
"0.65210205",
"0.6496044",
"0.6470418",
"0.6457711",
"0.6451468",
"0.6448171",
"0.6429314",
"0.64156556",
"0.6408289",
"0.63815707",
"0.63763714",
"0.63705826",
"0.63340616",
"0.63333696",
"0.6331708",
"0.632... | 0.68308383 | 0 |
Set/change the background of wanted humidity depending on the level of humidity | setHumidityBackground(){
let status = 'default'
if(this.state.humidity !== 'loading...'){
status = 'low';
if(this.state.humidity > 66 ){
status = 'high';
}else if(this.state.humidity > 33 ){
status = 'normal';
}
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setBackground(weather){\n var background;\n var tempCelsius = getTemp(data.main.temp, false)\n var i = weatherConditions.indexOf(weather);\n if(i == 0){\n var j;\n if( tempCelsius <= 0){\n j = 0;\n }else if(tempCelsius > 0 && tempCelsius <=... | [
"0.67422473",
"0.66654795",
"0.6648624",
"0.65969294",
"0.6544198",
"0.652792",
"0.6521598",
"0.6436949",
"0.63717544",
"0.63550276",
"0.6341994",
"0.63031137",
"0.6287469",
"0.6268876",
"0.62132",
"0.6195469",
"0.619291",
"0.6185393",
"0.6182552",
"0.6177283",
"0.61568785",
... | 0.74725574 | 0 |
Estimates if your plant needs water and if hardware is linked to the user. | estimateWhenToWater(){
let msg = null;
if(this.state.hardwareID !== "-" && this.state.hardwareHumidity > 0){
if(parseInt((this.state.humidity) - parseInt(this.state.hardwareHumidity)) > 0){
msg = "Your plant needs water!"
}else{
msg = "Your plant h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkWaterControl(){\n var d = new Date();\n // swtich between water control systems\n switch(water_ctrl_mode) {\n case ctrl_mode_dumb:\n console.log(\"Water Control Mode: Dumb\")\n if(water_status_on == false){\n if(d.getTime()-last_measured_time >= du... | [
"0.62920684",
"0.5945218",
"0.57416147",
"0.5683672",
"0.5387567",
"0.53420836",
"0.5302323",
"0.5265031",
"0.5234834",
"0.5217403",
"0.5214031",
"0.52074045",
"0.51843077",
"0.5182094",
"0.51669574",
"0.51419806",
"0.5138598",
"0.51364803",
"0.5129374",
"0.5091056",
"0.50802... | 0.69088376 | 0 |
Apply the humidity change to the database | applyHumidityChange(){
userDB.changeWantedHumidity(this.state.humidity, this.props.userID);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function databaseUpdate(){\n\tvar kwh = 0;\n\tvar query = client.query('SELECT timing, lightson FROM time', [], function(err,result){\n\t\tif (err) throw err;\n\t\tvar date = new Date(Number(result.rows[0].timing));\n\t\tvar parseDate = date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate();\n... | [
"0.62282014",
"0.61751616",
"0.59700036",
"0.58871835",
"0.5764361",
"0.5647195",
"0.5607127",
"0.5583659",
"0.5537636",
"0.5519095",
"0.5482299",
"0.546374",
"0.54120195",
"0.5401253",
"0.5383476",
"0.53525394",
"0.534979",
"0.5341181",
"0.5331704",
"0.5324149",
"0.53166807"... | 0.7760938 | 0 |
Starts capture with the given `streamId`. | async function startCapture(streamId) {
stream =
await navigator.mediaDevices.getUserMedia(
{
audio: false,
video: {
mandatory: {
chromeMediaSource: 'tab',
chromeMediaSourceId: streamId
}
}
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function start() {\n startRecordingChunks(webcam_stream, clip_duration, send)\n }",
"function _recordMainStream() {\n if (currentConfig.mediaTypeTab == 'tab-camonly') {\n _recordWebcam();\n }\n else {\n if (currentConfig.mediaSourceTab == 'video-stream-tab') {\n _recordCurrent... | [
"0.64363104",
"0.61300397",
"0.61163026",
"0.60892814",
"0.6082196",
"0.6052804",
"0.6052804",
"0.6021997",
"0.6021997",
"0.60044706",
"0.59733117",
"0.5934053",
"0.5918916",
"0.58940834",
"0.5890596",
"0.5701525",
"0.5695017",
"0.56353396",
"0.56295216",
"0.5603424",
"0.5583... | 0.78265977 | 0 |
Stops the currentlyactive capture. | function stopCapture() {
if (!stream) {
throw new Error('Capture never started');
}
stream.getVideoTracks()[0].stop();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function stopMediaCaptureSession() {\n oMediaCapture.stopRecordAsync().then(function (result) {\n\n }, errorHandler);\n }",
"function stop() {\n\t\t/* Make sure the user is recording. */\n\t\tif( _Nimbb.getState() != \"recording\" ) {\n\t\t \talert(\"You need to record a video.\");\n\t\t \tret... | [
"0.7306286",
"0.7108097",
"0.7042972",
"0.7022861",
"0.6926764",
"0.68343705",
"0.6806302",
"0.6806302",
"0.66842514",
"0.6634125",
"0.6614531",
"0.65136033",
"0.6508591",
"0.649214",
"0.643631",
"0.64322066",
"0.6409608",
"0.6358371",
"0.6353415",
"0.6308487",
"0.6308224",
... | 0.74802834 | 0 |
========================================================================================== Suggestion Modal ========================================================================================== | function suggestionmodalstart() {
let html = ' <!-- suggestion modal -->' +
' <div class="modal" tabindex="-1" role="dialog" id="vitasa_modal_suggestion">' +
' <div class="modal-dialog" role="document">' +
' <div class="modal-content">' +
' <div... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showHelp() { \n var search = $(select).find(':selected').nextAll().andSelf();\n var num_display = 1;\n\n // Clear out div.\n $(suggest_div).find('.suggest-prompt').empty();\n \n // Add help text.\n for (var i = 0; i < Math.min(nu... | [
"0.6491461",
"0.64406514",
"0.64122075",
"0.6361392",
"0.6349023",
"0.63116",
"0.6228591",
"0.61610126",
"0.60737026",
"0.6047876",
"0.60261005",
"0.6022473",
"0.5977578",
"0.5964026",
"0.5958238",
"0.58921427",
"0.5884576",
"0.5882271",
"0.58815",
"0.5804437",
"0.57938683",
... | 0.70640457 | 0 |
========================================================================================== Busy Modal ========================================================================================== | function StartBusy(title) {
let html =
' <!-- busy modal -->\n' +
' <div class="modal" tabindex="-1" role="dialog" id="vitasa_modal_messagebox">' +
' <div class="modal-dialog modal-dialog-centered" role="document">' +
' <div class="modal-content">' +
' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onShowBsModal() {\n isModalInTransitionToShow = true;\n isModalVisible = true;\n }",
"function modalShown(o){\n\t\t/*\n\t\tif(o.template){\n\t\t\t//show spinner dialogue\n\t\t\t//render o.template into o.target here\n\t\t}\n\t\t*/\n\t\tsaveTabindex();\n\t\ttdc.Grd.Modal.isVisible=true;\... | [
"0.7077473",
"0.70355636",
"0.67857724",
"0.6767614",
"0.6749182",
"0.67386657",
"0.67296094",
"0.67241347",
"0.6710125",
"0.6696718",
"0.6651246",
"0.65666085",
"0.65504944",
"0.6547959",
"0.6529696",
"0.6509517",
"0.64850277",
"0.64773065",
"0.6476068",
"0.6455873",
"0.6428... | 0.7136977 | 0 |
/ Use AES to decrypt 'ciphertext' with 'password' using 'nBits' key, in Counter mode of operation for each block outputblock = cipher(counter, key) cipherblock = plaintext xor outputblock | function AESDecryptCtr(ciphertext, password, nBits) {
if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys
var ii=0;
var nBytes = nBits/8; // no bytes in key
var pwBytes = new Array(nBytes);
var i=0;
var pwdUTF8Str = encodeUTF8(password);
var pw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function AES_Decrypt(block, key) {\n var l = key.length;\n AES_AddRoundKey(block, key.slice(l - 16, l));\n AES_ShiftRows(block, AES_ShiftRowTab_Inv);\n AES_SubBytes(block, AES_Sbox_Inv);\n for(var i = l - 32; i >= 16; i -= 16) {\n AES_AddRoundKey(block, key.slice(i, i + 16));\n AES_MixColumns_Inv(block)... | [
"0.6433431",
"0.6412211",
"0.6217762",
"0.6215452",
"0.6212949",
"0.6147131",
"0.614255",
"0.60609293",
"0.60418844",
"0.6039384",
"0.6016768",
"0.5973093",
"0.5957363",
"0.5887798",
"0.58568215",
"0.5832337",
"0.5828153",
"0.5828153",
"0.5828153",
"0.5828153",
"0.5828153",
... | 0.80121225 | 0 |
Get the user's home directory. On windows this looks something like "C:\users\username\" and on UNIX this looks something like "/usr/username/" | static getHomeDirectory() {
const unresolvedUserFolder = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
const homeFolder = path.resolve(unresolvedUserFolder);
if (!fsx.existsSync(homeFolder)) {
throw new Error('Unable to determine the current user\'s home direc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getHomeFolder() {\n\treturn process.env[\n\t\tprocess.platform == 'win32' ?\n\t\t'USERPROFILE' :\n\t\t'HOME']\n}",
"function getUserHomeDirPath() {\n var homedir = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];\n if (homedir)\n return homedir;\n return \".\";\n}",
"functio... | [
"0.83800364",
"0.8363713",
"0.82068926",
"0.8090206",
"0.8090206",
"0.7888125",
"0.7724878",
"0.7537455",
"0.69847125",
"0.69847125",
"0.65075827",
"0.64099663",
"0.57222694",
"0.5641762",
"0.54434675",
"0.540022",
"0.53443295",
"0.5287329",
"0.5287296",
"0.5262558",
"0.52385... | 0.84803754 | 0 |
Returns the values from a Set | static getSetAsArray(set) {
// When ES6 is supported, we can use Array.from() instead.
const result = [];
set.forEach((value) => {
result.push(value);
});
return result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"union(set) {\n const newSet = new Set();\n this.values().forEach(value => {\n newSet.add(value);\n })\n set.values().forEach(value => {\n newSet.add(value);\n })\n\n return newSet;\n }",
"intersection(set) {\n const intersect = new Set();\n set.values().forEach(val => {\n ... | [
"0.7326908",
"0.68484515",
"0.6622855",
"0.6435346",
"0.6415802",
"0.6349566",
"0.62869895",
"0.62836915",
"0.6263506",
"0.6245987",
"0.61780757",
"0.6164436",
"0.6137133",
"0.609674",
"0.6085385",
"0.6078597",
"0.5996223",
"0.5985837",
"0.5983763",
"0.5979679",
"0.5977034",
... | 0.7146177 | 1 |
Retries a function until a timeout is reached. The function is expected to throw if it failed and should be retried. | static retryUntilTimeout(fn, maxWaitTimeMs, getTimeoutError, fnName) {
const startTime = Utilities.getTimeInMs();
let looped = false;
let result;
// tslint:disable-next-line:no-constant-condition
while (true) {
try {
result = fn();
brea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function retry(\n fn,\n options = {\n delay: 1000,\n // sig: (error: Error, retries: number) -> boolean\n check: () => false,\n },\n retries = 0\n) {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n // If the check is satisfied, call reje... | [
"0.6915518",
"0.6861474",
"0.67760587",
"0.66246486",
"0.66246486",
"0.656656",
"0.64509636",
"0.6405047",
"0.6176094",
"0.6114687",
"0.61125475",
"0.60675955",
"0.60675955",
"0.6031093",
"0.5924692",
"0.5915263",
"0.5915118",
"0.5913611",
"0.5874412",
"0.58481306",
"0.584037... | 0.7521126 | 0 |
Creates the specified folder by calling fsx.mkdirsSync(), but using a retry loop to recover from temporary locks that may be held by other processes. If the folder already exists, no error occurs. | static createFolderWithRetry(folderName) {
// Note: If a file exists with the same name, then we fall through and report
// an error.
if (Utilities.directoryExists(folderName)) {
return;
}
// We need to do a simple "fs.mkdirSync(localModulesFolder)" here,
// h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_checkOrCreateDirectory() {\n fs.mkdir(path.join(this.directory, this.path), MASK, (error) => {\n if (error && error.code !== IGNORED_MKDIR_ERROR) {\n throw error;\n }\n });\n }",
"async mkdir (filepath) {\n try {\n await this._mkdir(filepath);\n return\n } catch (err) {\n... | [
"0.70877546",
"0.64935595",
"0.6470844",
"0.6421267",
"0.6382545",
"0.63752246",
"0.6338689",
"0.6315261",
"0.6312104",
"0.6307832",
"0.628563",
"0.6247482",
"0.62188804",
"0.62188804",
"0.61974806",
"0.6171634",
"0.6145866",
"0.6124541",
"0.6088599",
"0.60750985",
"0.6058538... | 0.7873625 | 0 |
Returns true if outputFilename has a more recent last modified timestamp than all of the inputFilenames, which would imply that we don't need to rebuild it. Returns false if any of the files does not exist. NOTE: The filenames can also be paths for directories, in which case the directory timestamp is compared. | static isFileTimestampCurrent(outputFilename, inputFilenames) {
if (!fsx.existsSync(outputFilename)) {
return false;
}
const outputStats = fsx.statSync(outputFilename);
for (const inputFilename of inputFilenames) {
if (!fsx.existsSync(inputFilename)) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function overwriteFile(filename) {\n\tif (fs.existsSync(filename)) {\n\t\tconst stats = fs.statSync(filename);\n\t\tconst lastModified = new Date(stats.mtime);\n\t\tconst now = new Date();\n\n\t\treturn (now.getSeconds() - lastModified.getSeconds() > 2);\n\t} else {\n\t\treturn true;\n\t}\n}",
"function isDuplic... | [
"0.6058325",
"0.5996852",
"0.59319633",
"0.5906015",
"0.5899865",
"0.55720055",
"0.5530477",
"0.55068386",
"0.5494359",
"0.54802114",
"0.54560876",
"0.54560876",
"0.54560876",
"0.54560876",
"0.54560876",
"0.54560876",
"0.54560876",
"0.54296154",
"0.5343217",
"0.5268538",
"0.5... | 0.85469216 | 0 |
Returns the width of the console, measured in columns | static getConsoleWidth() {
const stdout = process.stdout;
if (stdout && stdout.columns) {
return stdout.columns;
}
return 80;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function windowWidth () {\n const maxWidth = 80\n if (typeof process === 'object' && process.stdout && process.stdout.columns) {\n return Math.min(maxWidth, process.stdout.columns)\n } else {\n return maxWidth\n }\n }",
"function windowWidth () {\n const maxWidth = 80\n if (typeof pr... | [
"0.7874416",
"0.7874416",
"0.7874416",
"0.7874416",
"0.67358035",
"0.6537371",
"0.6534763",
"0.64769596",
"0.6458006",
"0.63976854",
"0.6383808",
"0.634848",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
"0.6338125",
... | 0.89763796 | 0 |
Attempts to run Utilities.executeCommand() up to maxAttempts times before giving up. | static executeCommandWithRetry(maxAttempts, command, args, workingDirectory, environment, suppressOutput = false, retryCallback) {
if (maxAttempts < 1) {
throw new Error('The maxAttempts parameter cannot be less than 1');
}
let attemptNumber = 1;
// tslint:disable-next-line:n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function exponentialBackoff(max, delay, toTry, success, fail) {\n try {\n const result = await toTry();\n success(result);\n } catch(error) {\n if (max === 0) {\n return fail();\n }\n time('Retrying in ' + delay + 's... (' + max + ' tries left)');\n setTimeout(function() {\n exp... | [
"0.57534385",
"0.5646475",
"0.56118625",
"0.5599196",
"0.54357564",
"0.540005",
"0.53783506",
"0.5356621",
"0.5328886",
"0.53201324",
"0.5291545",
"0.5290678",
"0.52795845",
"0.52795845",
"0.5264318",
"0.51813406",
"0.51316917",
"0.49923363",
"0.49810353",
"0.4952002",
"0.494... | 0.7658153 | 0 |
Executes the command with the specified commandline parameters, and waits for it to complete. The current directory will be set to the specified workingDirectory. | static executeCommandAsync(command, args, workingDirectory, environment) {
// This is a workaround for GitHub issue #25330. It is not as complete as the workaround above,
// but there doesn't seem to be an easy asynchronous solution.
// https://github.com/nodejs/node-v0.x-archive/issues/25330
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static executeLifecycleCommandAsync(command, workingDirectory, initCwd, captureOutput = false) {\n let shellCommand = process.env.comspec || 'cmd';\n let commandFlags = '/d /s /c';\n let useShell = true;\n if (process.platform !== 'win32') {\n shellCommand = 'sh';\n ... | [
"0.59491605",
"0.58990216",
"0.58349484",
"0.57259065",
"0.56068337",
"0.55843407",
"0.5578115",
"0.5514415",
"0.54275393",
"0.5410514",
"0.5268538",
"0.5268538",
"0.5268538",
"0.5268538",
"0.5268538",
"0.5200462",
"0.5190958",
"0.5190958",
"0.5178844",
"0.5129421",
"0.512709... | 0.638834 | 0 |
Returns the path cost from root to node | getPathCost() {
if (this.parent === null) {
return 0;
} else {
return this.parent.getPathCost() + this.action.cost;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"maxSum() {\n let pathResult = 0; \n \n function maxSumHelper(node) {\n if (node === null) return 0; \n\n // calculate the left sub-tree at the current node.\n let leftSum = maxSumHelper(node.left);\n // calculate the right sub-tree at the current node. \n let rightSum = maxSumHelper... | [
"0.6193014",
"0.61821485",
"0.6137341",
"0.6098145",
"0.60400265",
"0.5979401",
"0.586707",
"0.58471316",
"0.5805278",
"0.5803135",
"0.57694227",
"0.5751824",
"0.5710546",
"0.5696394",
"0.56692",
"0.5567817",
"0.55646014",
"0.55595493",
"0.5547706",
"0.5525845",
"0.5393471",
... | 0.7671648 | 0 |
Returns true if the state occurs anywhere in the path | inPath(state) {
if (state === this.state) {
return true;
}
else if (this.parent === null) {
return false;
}
else {
return this.parent.inPath(state);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkPathState(pathStates, path) {\r\n\tlet hash = path.keys.split('').sort().join('') + '.' + path.curKey;\r\n\tif (pathStates[hash] == null || pathStates[hash] > path.steps) {\r\n\t\tpathStates[hash] = path.steps;\r\n\t\treturn true;\r\n\t} else\r\n\t\treturn false;\r\n}",
"isInPath(x, y) {\n r... | [
"0.6423784",
"0.6414872",
"0.6216082",
"0.6119161",
"0.6102425",
"0.6082944",
"0.5989571",
"0.5967988",
"0.5939742",
"0.5897221",
"0.58899665",
"0.58814794",
"0.5842236",
"0.5717982",
"0.57035375",
"0.5691907",
"0.5683519",
"0.56768733",
"0.5614443",
"0.55920345",
"0.55850255... | 0.7475185 | 0 |
checks for "cf_ccheck" cookie (indicates we've already run the redirect) | function checkedCookies() {
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf('redirected') == 0) {
console.log('already redirected');
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkCookie(cname) {\r\n if (getCookie(cname)==\"\") {return false;}\r\n else {return true;}\r\n}",
"function checkCookie(claveCookie) {\n var nivell = getCookie(claveCookie);\n if (nivell != \"\") {\n return nivell;\n } else {\n return 0;\n }\n}",
"function isCookie() {\r\n let Cooki... | [
"0.66977286",
"0.66404307",
"0.6618345",
"0.65965754",
"0.6444991",
"0.6432521",
"0.64281106",
"0.63964355",
"0.6382716",
"0.63488007",
"0.6337009",
"0.6325145",
"0.6313412",
"0.6309729",
"0.62669796",
"0.62159616",
"0.62058973",
"0.6201584",
"0.6154789",
"0.6070358",
"0.6022... | 0.7336408 | 0 |
Queries the database for the first _x_ audit records [`howMany`] of a given Record type. You can also optionally specify an offset to start at [`startAt`]. | async first(howMany, startAt) {
this._query = this._query.setPath(this.byId);
this._query = this._query.orderByKey().limitToLast(howMany);
if (startAt) {
this._query = this._query.startAt(startAt);
}
const ids = (await this.db.getList(this._query)).map(i => pathJoin(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function dynStart(account) {\n let accountToQuery = account || config.username;\n hivejs.api.getAccountHistory(\n accountToQuery,\n -1,\n 100,\n ...walletOperationsBitmask,\n function (err, result) {\n if (err) {\n console.log(err);\n } else {\n let ebus = result.filter((tx... | [
"0.47027147",
"0.4594905",
"0.4566002",
"0.4511463",
"0.44645703",
"0.44645703",
"0.44094327",
"0.44055954",
"0.44030243",
"0.42668408",
"0.42465365",
"0.42419514",
"0.42275175",
"0.42217925",
"0.41786388",
"0.41693884",
"0.4130912",
"0.41147533",
"0.41108486",
"0.41077387",
... | 0.6526301 | 0 |
Funcao MaskMoney para moeda | function maskMoeda() {
$(function() {
$("#prc_prod").maskMoney({
thousands : '.',
decimal : ','
});
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function MaskMoney(){ // criando função construtora, colocar as inicializacoes\r\n\t\tthis.decimal =$('.js-decimal'); // em função contrutora deve ser trocado var por this, pois o mesmo sera acesso no contexto da aplicacao\r\n\t\tthis.plain =$('.js-plain');\r\n\t}",
"function setValueMaskMoney(elemento, val... | [
"0.7198045",
"0.7118441",
"0.7007897",
"0.6658417",
"0.62597185",
"0.62148136",
"0.61854553",
"0.6148083",
"0.6098448",
"0.6017048",
"0.59776396",
"0.59399337",
"0.5893532",
"0.5889925",
"0.5862508",
"0.58538336",
"0.5786623",
"0.5782763",
"0.57704806",
"0.5756063",
"0.573280... | 0.7382455 | 0 |
Funcao MaskMoney para quantidade | function maskQtd() {
$(function() {
$("#qtd_prod").maskMoney({
thousands : '',
decimal : ','
});
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function maskMoeda() {\n\t$(function() {\n\t\t$(\"#prc_prod\").maskMoney({\n\t\t\tthousands : '.',\n\t\t\tdecimal : ','\n\t\t});\n\t})\n}",
"function setValueMaskMoney(elemento, valor, precision){\n\tvalor = valor.toString().replace('.', ',');\n\telemento.val(valor).focus().blur();\n}",
"function MaskMoney(){ ... | [
"0.6678469",
"0.6608694",
"0.65763146",
"0.62962437",
"0.5915661",
"0.5760122",
"0.558229",
"0.5575922",
"0.55692595",
"0.54595155",
"0.54431766",
"0.5373007",
"0.5369998",
"0.5368739",
"0.5368699",
"0.5309719",
"0.5307314",
"0.5305747",
"0.5296955",
"0.526271",
"0.5244816",
... | 0.7173962 | 0 |
Jaden Smith Case Make a `jadenCase` function that takes a string as parameter and return the string with each words capitilized. Example : "How are you ?" > "How Are You ?" | function jadenCase(s) {
let arr = s.toLowerCase().split(' ');
for (let i = 0; i < arr.length; i++) {
let word = arr[i].split("");
word[0] = word[0].toUpperCase();
arr[i] = word.join("");
}
return arr.join(" ");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function jadenCase(string) {\n let array = string.split(\" \");\n\n for (let i = 0; i < array.length; i++) {\n let word = array[i].split('');\n word[0] = word[0].toUpperCase();\n array[i] = word.join('');\n\n }\n\n return array.join(' ');\n}",
"function jadenCase(string) {\n return string.replace... | [
"0.7502972",
"0.746375",
"0.73786145",
"0.7362569",
"0.7308072",
"0.7295456",
"0.7152624",
"0.7152624",
"0.71098757",
"0.71085244",
"0.70912355",
"0.7051328",
"0.70470124",
"0.70303",
"0.7011756",
"0.6998641",
"0.69929034",
"0.69908017",
"0.69685465",
"0.69647145",
"0.6952698... | 0.76922154 | 0 |
Fill days as headers | function fillDays() {
for (let c = 0; c <= difference; c++) {
let cell = document.createElement("div");
cell.innerText = moment(date1).format("MMM Do ddd zz");
timeGrid.appendChild(cell).className = "grid-item header";
// Fill hour info for each day
fillHours(date1);
// Advance o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CalendarPopup_setDayHeaders() \r\n{\r\n\tfor (var i=0; i<arguments.length; i++) \r\n\t this.dayHeaders[i] = arguments[i];\r\n}",
"function setCalendarHeader(){\n let indexOfToday = $('.today').index(); \n switch (indexOfToday) {\n case 1:\n $(dayN... | [
"0.6687788",
"0.6567281",
"0.62885034",
"0.6267428",
"0.6244969",
"0.6233866",
"0.62274355",
"0.62229186",
"0.6222187",
"0.6199431",
"0.6199431",
"0.6199431",
"0.61943007",
"0.61938345",
"0.61837626",
"0.61816794",
"0.6149382",
"0.6142578",
"0.6109058",
"0.6101418",
"0.605893... | 0.711575 | 0 |
funcion para calcular puntos | function calcularPuntos(){
ganados = Number($("#txtGanados").val());
empatados = Number($("#txtEmpatados").val());
puntos = ganados * 3 + empatados;
$("#pResultado").html("Puntos totales: " + (puntos));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcPerim() {\n\tthis.perimetr=0;\n\tfor(key in this){\n\t\tif(checkisNum(this[key])&&key!=='perimetr'){\n\t\t\tthis.perimetr+=this[key];\n\t\t}\n\t}\n\treturn this.perimetr;\n}",
"function getPelnas(pajamos, mokesciai, mokesciai2){\nvar pelnas = (pajamos - (pajamos * mokesciai)) - (pajamos - (pajamos ... | [
"0.65920466",
"0.6265086",
"0.6130063",
"0.60529494",
"0.6028191",
"0.60001326",
"0.58620447",
"0.5844873",
"0.57783604",
"0.57634604",
"0.57629853",
"0.5759573",
"0.57432634",
"0.5715103",
"0.5705679",
"0.57056165",
"0.57005084",
"0.56996876",
"0.5692725",
"0.56859934",
"0.5... | 0.6391444 | 1 |
Get Adc VAlue in Watts | function getWatts (adcvalue, devider) {
return ((((parseInt(adcvalue)/devider) * 230)/1000)/3600)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function beratBadanWanita(tinggi){\r\n let ideal = (tinggi - 100) - (tinggi -100) * 0.15\r\n return `Wanita = ${ideal} Kg`; \r\n}",
"getCadence() {\n this.cadence = (this.currentSpeed() * 8);\n return this.cadence;\n }",
"getWA(metadata) {\n const { ratings } = metadata;\n const waArray =... | [
"0.585673",
"0.5734135",
"0.569318",
"0.56595564",
"0.5600932",
"0.55983996",
"0.55869937",
"0.55460024",
"0.5518653",
"0.55060774",
"0.5504796",
"0.54434395",
"0.54264843",
"0.54260874",
"0.539822",
"0.5386988",
"0.5380396",
"0.5376187",
"0.53732014",
"0.5361172",
"0.5357523... | 0.7318753 | 0 |
Get Adc VAlue in Peso | function getPeso (adcvalue, devider) {
return ((((parseInt(adcvalue)/devider) * 230)/1000)/3600) *12
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcularIVA(precioSinIVA){\n return precioSinIVA*1.21;\n}",
"function CalPriceIva (value,iva){\n let price = (value+(value*(iva/100)));\n console.log(\"<valor precio iva\",price,\">\" )\n return price;\n }",
"function getBaseCalculo() {\n var pfaEng = config_isEng && isEng ? Number($('#pc... | [
"0.7190649",
"0.71453035",
"0.695064",
"0.67604893",
"0.67446095",
"0.65412617",
"0.652417",
"0.64747137",
"0.64649534",
"0.6436983",
"0.6435832",
"0.6416756",
"0.63692456",
"0.6356118",
"0.6313577",
"0.6309963",
"0.6290445",
"0.62761956",
"0.62664044",
"0.62594455",
"0.62553... | 0.73661834 | 0 |
Function: startScoreboard() This function surrounds runScoreboard() in a try/catch block so it can easily display any error messages to the user through an alert popup. | function startScoreboard(){
try {
runScoreboard();
}
catch (e){
alert("Error: " + e + "\n");
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function startScoreboard(){\n try {\n runScoreboard();\n }\n catch (e){\n alert(\"Error: \" + e + \"\\n\");\n console.error(e.stack);\n }\n}",
"function scoreboard() {\n\n var scoreboard = document.getElementById('scoreboard');\n scoreboard.innerHTML = `${score}pts.`... | [
"0.9096162",
"0.6950288",
"0.65608037",
"0.6523383",
"0.65202063",
"0.6485027",
"0.63748854",
"0.6337352",
"0.6328701",
"0.6287416",
"0.6255484",
"0.62365085",
"0.6232816",
"0.6192428",
"0.61887217",
"0.6163771",
"0.61593914",
"0.6119128",
"0.60980695",
"0.6087282",
"0.607892... | 0.89212465 | 1 |
Function: runScoreboard() This function reads the parameters to get the clock cycles required for each Functional Unit, then parses the code in order to use it to build the scoreboard and display it in a table. | function runScoreboard(){
// Setup
IC = 0;
var clk = 0;
var hardwareLatency = {fpAdder:0, fpMult:0, fpDiv:0, integer:0};
var pipeline = [];
var instList = document.getElementById('instruction_input').value;
var scoreboard = [];
getHardwareLatencies(hardwareLatency);
// Split eac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function runScoreboard(){\n // Setup\n fpRegFile = Array(32).fill(0.0);\n intRegFile = Array(32).fill(0);\n dataMem = [45, 12, 0, 0, 10, 135, 254, 127, 18, 4,\n 55, 8, 2, 98, 13, 5, 233, 158, 167];\n IC = 0;\n var clk = 1;\n var instList = document.getElementById('instruction... | [
"0.65332526",
"0.6487542",
"0.58569926",
"0.582731",
"0.57981396",
"0.5796521",
"0.57174987",
"0.5717481",
"0.5700861",
"0.5690954",
"0.56290257",
"0.5612153",
"0.55982625",
"0.55963933",
"0.558193",
"0.55704665",
"0.55688274",
"0.5558965",
"0.5551479",
"0.5542234",
"0.552132... | 0.7184456 | 0 |
function getHardwareLatencies() This function reads the textareas in the HTML page to obtain the latenies for each type of hardware. Since this project only uses one of each type, | function getHardwareLatencies(hardwareLatency){
hardwareLatency.fpAdder =
parseInt(document.getElementById("fpAdder_clks").value);
hardwareLatency.fpMult =
parseInt(document.getElementById("fpMult_clks").value);
hardwareLatency.fpDiv =
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getHardwareInfo(type) {\n var dcDB = $.grep(dcLocationList, function (e1) { return e1.ID == $(\"#DcLocationId\").val(); }),\n dcTechTitle = dcDB[0]['TechTitle'];\n\n var dcHardwareInfo = {};\n dcTitles.forEach(function (elem, index, dcTitles) {\n if (initparams[elem] && initparams[elem]... | [
"0.5968279",
"0.5500914",
"0.5269637",
"0.51828766",
"0.5173691",
"0.5162938",
"0.512883",
"0.5116123",
"0.50976205",
"0.50718594",
"0.50558937",
"0.50177944",
"0.49231052",
"0.49093908",
"0.490474",
"0.4886597",
"0.48862255",
"0.4862866",
"0.48085287",
"0.47939077",
"0.47923... | 0.66717696 | 0 |
Function: getInstructionType(instruction) This function takes an instruction and breaks it down into components. Parameters: instruction trimmed instruction line from assembly code | function getInstructionType(instruction){
// Make each element uppercase and remove any whitespace on the ends
instruction = instruction.toUpperCase();
var parsed = instruction.trim().split(/[\s,]+/);
var instructionObject;
// Memory Instruction
if (parsed[0] == "L.D"){
instructionObject... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getInstructionType(instruction){\n // Make each element uppercase and remove any whitespace on the ends\n instruction = instruction.toUpperCase();\n var parsed = instruction.trim().split(/[\\s,]+/);\n var instructionObject;\n // Memory Instruction\n if (parsed[0] == \"L.D\"){\n va... | [
"0.70985794",
"0.50384635",
"0.49184588",
"0.48878536",
"0.4861661",
"0.48236394",
"0.47049242",
"0.4631216",
"0.46167377",
"0.46022865",
"0.46022865",
"0.46022865",
"0.4599115",
"0.45944026",
"0.4583072",
"0.45577684",
"0.45338273",
"0.45306805",
"0.44687068",
"0.44687068",
... | 0.7210999 | 0 |
Function: getValue This function returns the number stored in a register file Parameters: input string starting with F, $, or representing the index in the FP Register File, Integer Register File, or an immediate Return value stored in that register index or the immediate value | function getValue(location){
if (location === null){
return null;
}
if (location[0] === 'F'){
var idx = parseInt(location.substring(1));
return (fpRegFile[idx] || 0);
}
if (location[0] === '$'){
var idx = parseInt(location.substring(1));
var v = (intR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getValue(location){\n if (location === null){\n return null;\n }\n if (location[0] === 'F'){\n var idx = parseInt(location.substring(1));\n return (fpRegFile[idx] || 0);\n }\n if (location[0] === '$'){\n var idx = parseInt(location.substring(1));\n \n ... | [
"0.7529022",
"0.6193886",
"0.6175981",
"0.6116732",
"0.59558475",
"0.564154",
"0.5613047",
"0.55652094",
"0.5547969",
"0.5544692",
"0.55410486",
"0.54971707",
"0.547082",
"0.547082",
"0.544922",
"0.5448237",
"0.5430389",
"0.53665185",
"0.53520805",
"0.5344922",
"0.53310424",
... | 0.7495252 | 1 |
Function: setValue This function sets location in the register files/data memory to val. Note this function will make any floating point value an integer before putting it int the integer register file. Parameters: location the location to store to (e.g. F0, $0, or 0($3) for a floating point register, integer register,... | function setValue(location, val){
if (location[0] === 'F'){
var idx = parseInt(location.substring(1));
fpRegFile[idx] = val;
}
if (location[0] === '$'){
var idx = parseInt(location.substring(1));
// Ensure the value is an integer
intRegFile[idx] = Math.floor(val);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setValue(location, val){\n \n \n if (location[0] === 'F'){\n var idx = parseInt(location.substring(1));\n fpRegFile[idx] = val;\n }\n if (location[0] === '$'){\n var idx = parseInt(location.substring(1));\n // Ensure the value is an integer\n intRegFile[id... | [
"0.8119612",
"0.61930096",
"0.6114532",
"0.6106976",
"0.6075322",
"0.5943317",
"0.59048134",
"0.5861021",
"0.5811912",
"0.5737591",
"0.5680974",
"0.5680974",
"0.5680974",
"0.5680974",
"0.5680974",
"0.5680974",
"0.5680974",
"0.5671882",
"0.56240976",
"0.55711967",
"0.55711967"... | 0.8118093 | 1 |
Function: executeInstr(inst, inputA, inputB, destLoc) This function executes the instruction and returns the result. This function will also store the value in the destination location. parameters: inst the instruction command to execute srcVal the source register value, not the register index e.g 123, not $4 (Assume $... | function executeInstruction(inst, srcVal, trgtVal, destLoc){
if (inst === "L.D"){
return setValue(destLoc, srcVal);
}
if (inst === "S.D"){
return setValue(trgtVal, srcVal);
}
if (inst === "BEQ"){
if (srcVal === trgtVal){
IC = getValue(destLoc);
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function executeInstruction(inst, srcVal, trgtVal, destLoc){\n if (inst === \"L.D\"){\n return srcVal;\n }\n if (inst === \"S.D\"){\n return srcVal;\n }\n if (inst === \"BEQ\"){\n if (srcVal === trgtVal){\n return true;\n }\n return false;\n }\n if... | [
"0.8324851",
"0.5800737",
"0.5690557",
"0.5016038",
"0.48591214",
"0.47718546",
"0.46381053",
"0.44994867",
"0.44434687",
"0.44417274",
"0.4412644",
"0.4314364",
"0.43136716",
"0.42900878",
"0.42340204",
"0.42231205",
"0.4179032",
"0.4173508",
"0.4170183",
"0.41297403",
"0.41... | 0.83875775 | 0 |
Function: deepCopy(obj) By default javascript passes anything more than a primitive type by reference, so this function is used to create an identical copy by making a new object with the same keys and values. Parameters: obj the obj to be copied Returns: New object with identical keyvalue pairs as obj | function deepCopy(obj){
var newObj = {};
Object.keys(obj).forEach(function(property){
newObj[property] = obj[property];
});
return newObj;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clone(obj) {\n if ((typeof obj) !== 'object') return obj;//optional check, handles primitives\n var copy = {};\n for (var key in obj) {\n\tcopy[key] = obj[key];\n }\n return copy;\n}",
"function deepCopy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}",
"function deepCopy(obj) {\... | [
"0.819698",
"0.79966426",
"0.7971398",
"0.7950286",
"0.79410887",
"0.7903711",
"0.789107",
"0.78835815",
"0.78764236",
"0.783977",
"0.78368473",
"0.7818788",
"0.7795423",
"0.7770878",
"0.7753413",
"0.7753413",
"0.77432334",
"0.77416885",
"0.77324915",
"0.7727102",
"0.7716773"... | 0.8237071 | 1 |
Function: printScoreboard(sb) This function takes an array of instructions and prints the scoreboard to the HTML table called scoreboard_table Parameters: sb the array of intstructions with clk cycles of each stage's completion | function printScoreboard(sb){
var table = document.getElementById("scoreboard_table");
while (table.childNodes.length > 0) {
table.removeChild(table.childNodes[0]);
}
var headers = ["Inst", "Dest", "Src", "Trgt", "Issue",
"Read", "Exec", "WB"];
var row = document.crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function printScoreboard(sb){\n var table = document.getElementById(\"scoreboard_table\");\n while (table.childNodes.length > 0) {\n table.removeChild(table.childNodes[0]);\n }\n \n var headers = [\"Inst\", \"Dest\", \"Src\", \"Trgt\", \"Issue\",\n \"Exec\", \"WB\", \"Commit... | [
"0.77678627",
"0.676518",
"0.64015687",
"0.639905",
"0.59617823",
"0.59115344",
"0.59112775",
"0.59083784",
"0.58661467",
"0.5840889",
"0.5815988",
"0.5806901",
"0.57979923",
"0.57048875",
"0.5665291",
"0.56625015",
"0.5640962",
"0.5577518",
"0.55545914",
"0.5552106",
"0.5551... | 0.75832015 | 1 |
Function; printRegisterFile(regFile, htmlTable, title) This function builds an HTML table from a register file (array) Parameters: regFile the array of data to be displayed htmlTable the HTML id of the table title the title to be displayed above the table | function printRegisterFile(regFile, htmlTable, title){
var rfTable = document.getElementById(htmlTable);
// Remove any previous cells in the table
while (rfTable.childNodes.length > 0) {
rfTable.removeChild(rfTable.childNodes[0]);
}
if (title){
var tableTitle = document.createElement... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function printHTML() {\n const html = render(employeeArr);\n fs.writeFile(outputPath, html, (err) => {\n if (err) throw err;\n console.log(\"HTML successfully generated and saved to ./output.\");\n return;\n });\n}",
"function printTables(membersArray, tbodyId, criteria1, criteria2) {\n let tbody ... | [
"0.53389114",
"0.5192972",
"0.51727253",
"0.507614",
"0.50438863",
"0.50174814",
"0.49220908",
"0.4864121",
"0.48543498",
"0.48204654",
"0.48098412",
"0.48066503",
"0.48050633",
"0.47879374",
"0.47622594",
"0.47620502",
"0.47561496",
"0.4733742",
"0.47196722",
"0.47183618",
"... | 0.87438846 | 1 |
Load a P12 file, decodes it using the password and returns the private key handle | function amtcert_loadP12File(file, password, func) {
try {
// Encode in Base64 so Forge API can parse it.
var p12Der = window.forge.util.decode64(btoa(file));
var p12Asn1 = window.forge.asn1.fromDer(p12Der);
var p12 = window.forge.pkcs12.pkcs12FromAsn1(p12Asn1, password);
//... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"decryptWalletFromFile(filename) {\n console.warn(`Reading password from ${filename}`)\n const password = FileSystem.readFileSync(filename, 'utf8');\n return this.decryptWallet(password.trim().split(' '));\n }",
"restorePrivateKey(splitKey1, splitKey2) {\n // convert to byte array i... | [
"0.57016253",
"0.564085",
"0.5610421",
"0.55771744",
"0.55478036",
"0.5500917",
"0.54052097",
"0.5380768",
"0.53249323",
"0.5287219",
"0.52673703",
"0.52459127",
"0.5239238",
"0.52265865",
"0.5166936",
"0.51553386",
"0.5131119",
"0.51078993",
"0.509507",
"0.5086154",
"0.50816... | 0.68169296 | 0 |
Extended Key Usage OID's 1.3.6.1.5.5.7.3.1 = TLS Server certificate 1.3.6.1.5.5.7.3.2 = TLS Client certificate 2.16.840.1.113741.1.2.1 = Intel AMT Remote Console 2.16.840.1.113741.1.2.2 = Intel AMT Local Console 2.16.840.1.113741.1.2.3 = Intel AMT Client Setup Certificate (ZeroTouch) Generate a certificate with a set o... | function amtcert_createCertificate(certAttributes, caPrivateKey, DERKey, issuerAttributes, extKeyUsage) {
// Generate a keypair and create an X.509v3 certificate
var keys, cert = forge.pki.createCertificate();
if (!DERKey) {
keys = forge.pki.rsa.generateKeyPair(2048);
cert.publicKey = keys.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function test_certificate() {\n\ttry {\n\t var caEc = cert_util.generateEcKeypair('secp256r1');\n\n\t var ec_cert = new EC_CERT(caEc);\n\t // var ec_cert = new EC_CERT(); // default curve is 'secp256r1'\n\t ec_cert.initTBSCert();\n\t \n\t var clientEc = cert_util.generateEcKeypair('secp256r1');\n\t \n\t ec... | [
"0.6157593",
"0.5965072",
"0.59300315",
"0.59256804",
"0.5751276",
"0.572861",
"0.5561716",
"0.55480486",
"0.5542925",
"0.5520057",
"0.54699177",
"0.5445817",
"0.5423298",
"0.5397637",
"0.5364953",
"0.5252336",
"0.5197756",
"0.5171801",
"0.5166979",
"0.5166444",
"0.5144758",
... | 0.61542577 | 1 |
Show route on map | function showTripOnMap() {
// Route data: dst from, dst to, via points
if (!window.routeData) return false;
var routeData = jQuery.parseJSON(window.routeData);
if (!routeData.from || !routeData.to) return false;
var request = {
origin: routeData.from.country + ',' + routeData.from.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showRoute(route) {\r\n // create line to represent route\r\n var polyroute = new google.maps.Polyline({\r\n strokeColor: '#3366FF',\r\n strokeWeight: 7\r\n });\r\n\r\n // for ensuring correct bounds/zoom level\r\n var bounds = new google.maps.LatLngBounds();\r\n\r\n $(route.legs).each(function... | [
"0.7744921",
"0.76242733",
"0.7445243",
"0.7436011",
"0.74289143",
"0.73125505",
"0.7290256",
"0.7237877",
"0.72344637",
"0.70415556",
"0.70199436",
"0.6980107",
"0.694482",
"0.68377703",
"0.67342407",
"0.67308795",
"0.67193115",
"0.67069525",
"0.6692616",
"0.6688068",
"0.667... | 0.7850994 | 0 |
Parse a Date formatted has String to a native object | function parseDateString(dateString) {
// Pass through when a native object is sent
if(dateString instanceof Date) {
return dateString;
}
// Caste string to date object
if(String(dateString).match(matchers)) {
// If looks like a milisecond value cast to number before
// final casti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseDateString(dateString) {\n // Pass through when a native object is sent\n if(dateString instanceof Date) {\n return dateString;\n }\n // Caste string to date object\n if(String(dateString).match(matchers)) {\n // If looks like a milisecond valu... | [
"0.7380266",
"0.73430514",
"0.7316617",
"0.72303134",
"0.7202951",
"0.71968085",
"0.7185232",
"0.7173262",
"0.7090728",
"0.7088609",
"0.70495516",
"0.6990837",
"0.6957088",
"0.69394857",
"0.69388974",
"0.6933807",
"0.69045466",
"0.6896393",
"0.6872449",
"0.68635774",
"0.68539... | 0.7378134 | 1 |
Returns an escaped regexp from the string | function escapedRegExp(str) {
var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
return new RegExp(sanitize);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function escapedRegExp(str) {\n var sanitize = str.toString().replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1');\n return new RegExp(sanitize);\n }",
"function escapeRegExp(string) {\n\t\treturn string.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, \"\\\\$1\");\n\t}",
"function escapeRegExp(string) ... | [
"0.76780176",
"0.76481354",
"0.7644358",
"0.7625788",
"0.75824946",
"0.7542552",
"0.7539015",
"0.7516376",
"0.75138605",
"0.75097007",
"0.7509626",
"0.75087965",
"0.74978346",
"0.74936336",
"0.7456898",
"0.74447787",
"0.742722",
"0.7379151",
"0.7375592",
"0.7370797",
"0.73533... | 0.77389014 | 0 |
puts an x or an o into the grid | function fillGrid (e){
if (e.target["innerText"] !="x" && e.target["innerText"]!="o"){
e.target["innerText"] = filler
if (filler=="x") {
if (inRow(e.target.index, linesX, posX)) alert("X wins!!!")}
else if (inRow(e.target.index, linesO, posY)) alert ("O wins!!!")
//filler = (filler=="o")? "x": "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gridInput(){\n if (this.textContent === ''){\n this.textContent = 'X';\n }\n else if (this.textContent === 'X'){\n (this.textContent) = 'O';\n }\n else{\n this.textContent = '';\n }\n }",
"function draw(i, o) {\n with(context) {\n x = i % grid * size, y = ~~(i / grid) *... | [
"0.6450019",
"0.6401938",
"0.6338638",
"0.6331208",
"0.62239414",
"0.6201156",
"0.6162112",
"0.6156328",
"0.61171776",
"0.60980356",
"0.60398024",
"0.59906733",
"0.59711444",
"0.59524775",
"0.5947111",
"0.588973",
"0.5842856",
"0.582236",
"0.5817832",
"0.5812144",
"0.58032477... | 0.6662989 | 0 |
removes _ from enum values | function formatEnumValue(value) {
value = value.split('_');
if (value[1]) {
value = value[1].toLowerCase();
return value.charAt(0).toUpperCase() + value.slice(1);
}
return value[0].toLowerCase();
} //* ** Enum Dropdown ***/ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toEnumName(value) {\n var result = '';\n var wasLower = false;\n for (var i = 0; i < value.length; i++) {\n var c = value.charAt(i);\n var isLower = /[a-z]/.test(c);\n if (!isLower && wasLower) {\n result += '_';\n }\n result += c.toUpperCase();\n wasLower = isLower;\n }\n if (... | [
"0.58542275",
"0.57121736",
"0.5643023",
"0.54657376",
"0.5382774",
"0.5350363",
"0.5334164",
"0.53288794",
"0.53111637",
"0.5251224",
"0.52281815",
"0.51579225",
"0.51579225",
"0.51579225",
"0.51579225",
"0.51579225",
"0.5156429",
"0.51452315",
"0.5143347",
"0.5142328",
"0.5... | 0.5995795 | 0 |
Sends the image to Imgur to be stored and then Vision. Use if image is greater than 4MB. Requires a base64Image string with the prepending tags striped out. | function sendImageImgur(image, orientation = 1) {
var base64result = image.replace(/^data:image\/[a-z]+;base64,/, "");
console.log("Image is greater than 4MB, wait for Imgur");
var form = new FormData();
form.append("image", base64result);
var settings = {
"async": true,
"crossDomai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sendImageDirect(image, orientation = 1) {\n var base64result = image.replace(/^data:image\\/[a-z]+;base64,/, \"\");\n console.log(\"Image is less than 4MB\")\n queryVisionAPI(base64result);\n}",
"function processBase64Image(dataString) {\n var matches = dataString.match(/^data:([A-Za-z-+\\... | [
"0.6974071",
"0.6565745",
"0.64864016",
"0.62616336",
"0.62484986",
"0.6211549",
"0.6177285",
"0.61240405",
"0.6101954",
"0.60887027",
"0.60813427",
"0.6074716",
"0.6042076",
"0.6004809",
"0.5935207",
"0.5926802",
"0.5925031",
"0.59203005",
"0.5894603",
"0.5877894",
"0.587372... | 0.67547715 | 1 |
from Resets the orientation of an base64 image url string based on the orientation from getOrientaion or this image srcBase64 is a base64 url string srcOrientation is a number between 2 and 8 callback is the function to perform after the orientaion has finished | function resetOrientation(srcBase64, srcOrientation, callback) {
console.log("Transforming image, please wait");
var img = new Image();
img.onload = function() {
var width = img.width,
height = img.height,
canvas = document.createElement('canvas'),
ctx = canvas.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fixImageOrientation(img64){\n return new Promise((resolve, reject) => {\n sharp(Buffer.from(img64, 'base64'))\n .rotate() //rotate based on exif value\n .toBuffer()\n .then(data => resolve(data.toString('base64')))\n .catch(err => reject(err));\n })... | [
"0.6622281",
"0.5757861",
"0.57312655",
"0.5676999",
"0.56173855",
"0.55815285",
"0.5506543",
"0.54904914",
"0.54780364",
"0.5418387",
"0.53953606",
"0.53848016",
"0.5364215",
"0.520403",
"0.5162543",
"0.51417166",
"0.51405686",
"0.510401",
"0.50951475",
"0.50951475",
"0.5076... | 0.7567558 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.