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 |
|---|---|---|---|---|---|---|
Check if the currently selected text is in the article_text div Returns false or true | function checkSelectedText() {
var parentEl = getSelectionParentElement();
article_text = document.getElementById('article-text'),
body = document.getElementsByTagName('body')[0];
if (parentEl === null) {
return false;
}
while (parentEl !== body) {
var classList = parentE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"hasTextSelection() {\n if (this.start_.node && this.end_.node)\n return AutomationPredicate.text(this.start_.node) &&\n AutomationPredicate.text(this.end_.node);\n }",
"function checkSelectedText(e) {\n var selectedText = (document.all)\n ? document.selection.createRange().tex... | [
"0.7253824",
"0.70789284",
"0.6799841",
"0.67656773",
"0.67155737",
"0.67155737",
"0.6522464",
"0.6413695",
"0.6400841",
"0.6278764",
"0.6201274",
"0.6131257",
"0.61175567",
"0.6114175",
"0.6053636",
"0.6011211",
"0.6011211",
"0.6010245",
"0.58757484",
"0.587564",
"0.587444",... | 0.84110415 | 0 |
called when user finishes drawing. Attempts to send session paths to new users who are waiting to receive them in the newUsers queue. | function checkForNewUsers(socket, sessionID) {
return new Promise((response, reject) => {
// get newUsers array for the session of socket who called function
let newUsers = sessions.get(sessionID).newUsers;
// send all waiting sockets the session paths
while(newUsers.length) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetUser() {\n\n errorMessage.style.visibility = \"hidden\";\n countMoves = 0;\n while(user.path.length > 1) {\n drawPathLine(\"white\", user.curPosition(), user.prevPosition());\n user.path.pop();\n }\n user = new User();\n user.path.push(cellMap.get(coords[0]));\n}",
"function sendCanvasU... | [
"0.5533931",
"0.55132836",
"0.5493741",
"0.5409149",
"0.5288695",
"0.52231365",
"0.5082336",
"0.508165",
"0.5068569",
"0.5055768",
"0.505009",
"0.5029132",
"0.5021242",
"0.50164676",
"0.4967342",
"0.4947829",
"0.4921274",
"0.49188673",
"0.48858926",
"0.48753127",
"0.4864952",... | 0.6117425 | 0 |
lists all sleep data | static async listSleepData() {
const results = await db.query(
`
SELECT s.id,
s.user_id,
s.bed_time,
s.wake_up_time
FROM single_sleep_tracker as s
ORDER BY s.id DESC
`
);
return results.rows;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _list() {\r\n\t\tvar len = _events.length,\r\n\t\t\ti, out = '';\r\n\t\tfor (i = 0; i < len; i += 1) {\r\n\t\t\tout += _events[i].name + ' ' + _events[i].time + '\\n';\r\n\t\t}\r\n\t\tconsole.log(out);\r\n\t}",
"function getSleep(steps, ser) {\n\t up.sleeps.get({}, function(err, body) {\n\t //co... | [
"0.62900203",
"0.6142292",
"0.5729358",
"0.56609327",
"0.5655324",
"0.5640562",
"0.5592064",
"0.5590866",
"0.5504161",
"0.5493128",
"0.5487433",
"0.5486208",
"0.54655725",
"0.5460397",
"0.53954035",
"0.53665346",
"0.5362727",
"0.5356059",
"0.52953213",
"0.52631915",
"0.524712... | 0.734248 | 0 |
list all sleep data for a single user in decending order by when they were created. | static async listSleepDataSingleUser(user) {
const userId = await db.query(`SELECT id FROM users WHERE email = $1`, [
user.email,
]);
const results = await db.query(
`
SELECT s.id,
s.user_id,
s.bed_time,
s.wake_up_time
FROM single_sleep_tracker as s
WHERE s.user_id = $1
OR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static async listSleepData() {\n\t\tconst results = await db.query(\n\t\t\t`\n\t\t\t\tSELECT s.id,\n\t\t\t\t\t\ts.user_id,\n\t\t\t\t\t\ts.bed_time,\n\t\t\t\t\t\ts.wake_up_time\n\t\t\t\tFROM single_sleep_tracker as s\n\t\t\t\tORDER BY s.id DESC\n\t\t\t`\n\t\t);\n\n\t\treturn results.rows;\n\t}",
"function getUser... | [
"0.78889084",
"0.5890677",
"0.5857118",
"0.58426446",
"0.5732838",
"0.5701437",
"0.5634843",
"0.5632818",
"0.5630372",
"0.5545865",
"0.55337274",
"0.5520198",
"0.5489177",
"0.54543895",
"0.54427356",
"0.5401907",
"0.5389002",
"0.5386949",
"0.53726184",
"0.5366312",
"0.5364292... | 0.7595904 | 1 |
deletes a sleep data for a user | static async deleteSleepData(id) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteSleepSession(id, sleep_id) {\n return db(\"users_sleep\")\n .where({ uid: id })\n .andWhere({ id: sleep_id })\n .del()\n .then((deleted) => deleted)\n .catch((err) => err);\n }",
"async function clear (user) {\n if (await getStatus() !== 'open') {\n throw new Error(... | [
"0.6885198",
"0.6447258",
"0.63558674",
"0.6241665",
"0.6185976",
"0.6170967",
"0.6159469",
"0.6157534",
"0.61500144",
"0.61049855",
"0.6092449",
"0.60500616",
"0.60370326",
"0.60010344",
"0.59892315",
"0.5974175",
"0.5956191",
"0.59471023",
"0.5927578",
"0.58887446",
"0.5888... | 0.71175575 | 0 |
Constructor sets object parameters of time of year, max budget, and array of expenses. | constructor(month, budget, list) {
// Properties of budget items.
let time;
let maxBudget;
let expenses = [];
// setter for time.
this.setTime = function(t) {
time = t;
}
// set max budget.
this.setMaxBudget = function (m) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static initialize(obj, baseReq, stock, money, initPrice, maxSupply, maxPrice, maxMoney, earliestCancelTime) { \n obj['base_req'] = baseReq;\n obj['stock'] = stock;\n obj['money'] = money;\n obj['init_price'] = initPrice;\n obj['max_supply'] = maxSupply;\n obj['max_price'] ... | [
"0.61222965",
"0.5877503",
"0.58674884",
"0.5652214",
"0.5601328",
"0.5579536",
"0.5541399",
"0.5505789",
"0.5503333",
"0.5469139",
"0.54184353",
"0.53541857",
"0.5284838",
"0.5244007",
"0.5215953",
"0.519509",
"0.518101",
"0.5178044",
"0.51749396",
"0.5158209",
"0.513209",
... | 0.7656627 | 0 |
Checks if the month has positive or negative cash flow. | cashFlow()
{
if(this.getMaxBudget()>=this.sumOfExpenses())
{
return true;
}
else
{
return false;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateMonth(oMon) {\n var isValidMon = false,\n existMonths = shareData.curFyMonths;\n angular.forEach(existMonths, function (month, i) {\n if (month.value == oMon) {\n isValidMon = true;\n }\n })\n ... | [
"0.60288596",
"0.597265",
"0.5965869",
"0.5906647",
"0.5832823",
"0.58276826",
"0.58218503",
"0.5794859",
"0.5756383",
"0.57207716",
"0.5706046",
"0.56960964",
"0.56960964",
"0.5690407",
"0.56858987",
"0.56858987",
"0.56644136",
"0.5657909",
"0.56275666",
"0.5625179",
"0.5617... | 0.653951 | 0 |
Calculate the amount of space available within each month. | calculateSpace()
{
return (this.getMaxBudget() - this.sumOfExpenses());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _computeTotalDaysOfMonth(_year,_month){var _totalDaysOfMonth=new Date(_year,_month+1,0).getDate();return _totalDaysOfMonth}",
"function totalBilled() {\n total = months * rate\n return total;\n}",
"function calculateMonthlyCosts() {\n var totalMonthlyCosts = 0;\n for (var i = 0; i < people.len... | [
"0.6508376",
"0.6322202",
"0.6299424",
"0.61773086",
"0.59313536",
"0.5927678",
"0.5910779",
"0.5908748",
"0.5888152",
"0.57850623",
"0.57798",
"0.5778962",
"0.5729465",
"0.57235163",
"0.5706039",
"0.56914765",
"0.5691028",
"0.5681998",
"0.56566304",
"0.5629479",
"0.5626873",... | 0.7196227 | 0 |
To join schools(reports) must have schoolReportKey | join_schools({ commit }, values) {
commit('join', values)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addSiteSchoolComputes(siteSchools, schools) {\n _.forEach(siteSchools, function (siteSchool) {\n // Lookup the school associated with the site in the list of schools\n var foundSchool = _.findWhere(schools, { code: siteSchool.code });\n\n if (foundSc... | [
"0.51190346",
"0.50451624",
"0.5038482",
"0.5033187",
"0.5010435",
"0.5003571",
"0.4969805",
"0.4962337",
"0.48857728",
"0.48721746",
"0.4858345",
"0.48385042",
"0.47937346",
"0.4790856",
"0.47500256",
"0.47167987",
"0.46641698",
"0.4622997",
"0.4608376",
"0.46049818",
"0.460... | 0.5835863 | 0 |
[1,3,6,10] RUN LENGTH ENCODING | function runLengthEncoding(str) {
let encodedChars = [];
let currentRun = 1;
for (let i = 1; i < str.length; i++) {
let currentChar = str[i];
let prevChar = str[i - 1];
if ((currentChar !== prevChar) || currentRun === 9) {
encodedChars.push(currentRun.toString());
encodedChars.push(prevChar);
curr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function runLengthEncoder(list) {\n\tvar runLengthEncodedList = [];\n\tvar unit = [];\n\tfor (var i = 0; i < list.length; i++) {\n\t\t// counter set to 1 because there will always be at least 1 of each unit.\n\t\tvar runLengthCounter = 1;\n\t\twhile(list[i] == list[i + 1]) {\n\t\t\ti++;\n\t\t\trunLengthCounter++;\... | [
"0.70385736",
"0.6308845",
"0.61664987",
"0.6164424",
"0.6126909",
"0.5960225",
"0.58840996",
"0.58730936",
"0.5852127",
"0.5749135",
"0.57210034",
"0.57210034",
"0.57210034",
"0.5666836",
"0.5650767",
"0.56172395",
"0.55949163",
"0.55861723",
"0.5581923",
"0.5567739",
"0.551... | 0.6906658 | 1 |
determines the closest point to a given place on a given path note that this determines the closest point on a cartesian plane, so it is only accurate for local distances; as geographic distance increases, this method will be less accurate | function closestPointOnPath_Cartesian( place, path, cb ) {
var min = Number.MAX_VALUE;
var closestPoint = null;
for( var i=0; i<path.length-1; i++ ) {
var v = { x: path[i].lng(), y: path[i].lat() };
var w = { x: path[i+1].lng(), y: path[i+1].lat() };
var p1 = { x: place.geometry.location.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"closest(points) {\n if (points.length === 1) {\n return Point.create(points[0]);\n }\n let ret = null;\n let min = Infinity;\n points.forEach((p) => {\n const dist = this.squaredDistance(p);\n if (dist < min) {\n ret = p;\n ... | [
"0.69109356",
"0.6880976",
"0.6765672",
"0.6560778",
"0.65561366",
"0.6451072",
"0.6375786",
"0.6338328",
"0.6334341",
"0.6205874",
"0.619585",
"0.6189388",
"0.6185738",
"0.6169951",
"0.616541",
"0.6129398",
"0.6122111",
"0.611145",
"0.6079303",
"0.60330856",
"0.6023156",
"... | 0.8158433 | 0 |
Clear boxes currently on the map | function clearBoxes() {
if (boxpolys != null) {
for (var i = 0; i < boxpolys.length; i++) {
boxpolys[i].setMap(null);
}
}
boxpolys = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearBoxes() {\n if (boxpolys != null) {\n for (var i = 0; i < boxpolys.length; i++) {\n boxpolys[i].setMap(null);\n };\n };\n boxpolys = null;\n }",
"function clearBoxes() {\n if (boxpolys != null) {\n for (var i = 0; i < boxpolys.length; i++) {\n boxpolys[i].setMap(... | [
"0.8820778",
"0.87778926",
"0.87778926",
"0.85852784",
"0.7726049",
"0.7724388",
"0.77160084",
"0.75459397",
"0.7531643",
"0.7470941",
"0.741388",
"0.7386736",
"0.73833007",
"0.7372871",
"0.73683965",
"0.7354714",
"0.7354714",
"0.7354714",
"0.7354714",
"0.7354714",
"0.7333394... | 0.8825145 | 0 |
Returns satoshi match price in consistent units of debt/collateral | _getMatchPrice() {
return (
(this.inverted
? this.getSqueezePrice()
: parseFloat((1 / this.getSqueezePrice()).toFixed(8))) *
this.precisionsRatio
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_getMatchPrice() {\n return (this.inverted ? this.getSqueezePrice() : parseFloat((1 / this.getSqueezePrice()).toFixed(8))) * this.precisionsRatio;\n }",
"getPrice(distance) {\n let price = 83 * distance // Rp 83 per km\n if (price < 10000) {\n price = 10000\n }\n return Math.round(... | [
"0.70288247",
"0.6162863",
"0.6054212",
"0.6023321",
"0.6019991",
"0.59160423",
"0.59130675",
"0.58817595",
"0.584635",
"0.57773316",
"0.576716",
"0.5709622",
"0.5697324",
"0.5697195",
"0.5697012",
"0.5686622",
"0.56423664",
"0.5629764",
"0.5575412",
"0.5573521",
"0.5573043",... | 0.6924537 | 1 |
get the system version and device platform created by Yaliang 4/25/2015 | function getDeviceInfo(){
devicePlatform = device.platform;
deviceVersion = device.version;
deviceIsIOS = (devicePlatform == "iOS");
deviceIsAndroid = (devicePlatform == "android") || (devicePlatform == "Android") || (devicePlatform == "amazon-fireos")
if (deviceIsIOS) {
if (deviceVersion.in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getPlatformInfo () {\n switch (this.props.platform) {\n case 'darwin':\n return 'Mac';\n case 'win32':\n return 'Windows';\n case 'linux':\n return 'Linux';\n default:\n return '';\n }\n }",
"function getSystemData() {\n return String(browser.execute(... | [
"0.7352878",
"0.7311912",
"0.7217394",
"0.71883297",
"0.71829444",
"0.7178216",
"0.71722215",
"0.6998005",
"0.697767",
"0.695145",
"0.6922589",
"0.6922589",
"0.68872094",
"0.6814239",
"0.6797502",
"0.6793372",
"0.67852587",
"0.6785113",
"0.6779107",
"0.6740837",
"0.6715596",
... | 0.7365174 | 0 |
Gestisce la pressione della ricerca del cepsite | function ricercaCespite(){
var oggettoPerChiamataAjax = unqualify(this.$fieldset.serializeObject());
this.$alertErrori.slideUp();
this.$divRisultati.slideUp();
this.$spinnerRicerca.addClass('activated');
selectedDatas = {};
this.$pulsanteSelezionaTutto.removeProp('checked');... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRaspored() {\n var data, dataL;\n data = fetchRasp(smjena);\n dataL = data.length;\n trajanje = trajanjeFn(data[0]);\n\n // Biranje između učenika i profesora\n if (osoba == \"Učenik\") {\n getUcenik(data, dataL);\n } else if (osoba == \"Profesor\" && smjena != \"A/B\") {\n ... | [
"0.58744514",
"0.5775628",
"0.56742746",
"0.55330783",
"0.549224",
"0.5486774",
"0.5481604",
"0.5453884",
"0.5437075",
"0.53567207",
"0.53480905",
"0.53311217",
"0.528015",
"0.5277873",
"0.52737904",
"0.5231185",
"0.51906747",
"0.51905626",
"0.5177395",
"0.5172131",
"0.517162... | 0.58251745 | 1 |
Accepts a string path and returns an Express.Middleware which verifies if the audience for jwt included that path along with the issuer etc. | function createRuleValidator(path) {
return function (req, res, next) {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
var token = req.headers.authorization.split(' ')[1];
return _jsonwebtoken2.default.verify(token, req.webtaskContext.data.EXTENSION_SECRE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function authenticationRequired(req, res, next) {\n const authHeader = req.headers.authorization || '';\n const match = authHeader.match(/Bearer (.+)/);\n\n if (!match) {\n res.status(401);\n return next('Unauthorized');\n }\n\n const accessToken = match[1];\n const audience = sampleConfig.resourceServ... | [
"0.640247",
"0.62741035",
"0.6076654",
"0.60706925",
"0.6038892",
"0.5991966",
"0.5921957",
"0.58944535",
"0.5828982",
"0.58230567",
"0.5741616",
"0.56758016",
"0.5656256",
"0.562685",
"0.5559642",
"0.5530057",
"0.5515624",
"0.551248",
"0.54421663",
"0.540783",
"0.54061943",
... | 0.6841165 | 0 |
function to print weather in sentence form | function printWeather(weather) {
//Wind string starts with 'From', so slice out F from string and print f.
const printString = `Current temperature in ${weather.current_observation.display_location.full} is ${weather.current_observation.temperature_string}, with winds f${weather.current_observation.wind_string.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function printWeather(weather) {\r\n const message = `The temp in ${weather.current_observation.display_location.full} is ${weather.current_observation.temp_f}F`;\r\n console.log(message);\r\n}",
"function printWeather(weather) {\n var temp = (weather.list.main.temp -32)*(5/9);\n var message = \"Current temp... | [
"0.7903981",
"0.73422736",
"0.7323145",
"0.70331484",
"0.679224",
"0.67418975",
"0.67272",
"0.65797365",
"0.65193987",
"0.645909",
"0.6452079",
"0.6420702",
"0.64203644",
"0.6395814",
"0.6375385",
"0.63691187",
"0.63180965",
"0.6264423",
"0.6245243",
"0.6241277",
"0.62221545"... | 0.7805229 | 1 |
Check validation student code, student name of search form | function isValidSearchForm() {
var code = $("#code-search").val();
var name = $("#name-search").val();
var checkCode = isValidCodeSearch(code);
var checkName = isValidNameSearch(name);
$("#invalid-code-search").html("");
$("#invalid-name-search").html("");
if (!checkCode || !checkName) {
if (!checkCode) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function searchStudents() {\n\t\tclearClass();\n\t\t$('.no-student').hide();\n\t\t$('.student-item').hide();\n\t\tcounter = 0;\n\t\tcount = 1;\n\t\tvar input = $('input').val();\n\t\tinput = input.toLowerCase();\n\t\tif(input.length === 0){\n\t\t\tloadFirstPage();\n\t\t\t\n\t\t}else{\n\t\t\tfor(i = 1; i <=studentI... | [
"0.716476",
"0.6904129",
"0.6515319",
"0.6480792",
"0.64803475",
"0.64320546",
"0.6389865",
"0.63479733",
"0.634562",
"0.6234732",
"0.6218634",
"0.61997455",
"0.61292815",
"0.61158574",
"0.61069494",
"0.5999839",
"0.59773004",
"0.59288985",
"0.5900832",
"0.5889489",
"0.588056... | 0.7353643 | 0 |
Check validation student's name, student's date of birh of create new student form | function isValidCreateForm() {
var name = $("#name-create").val();
var date = $("#date-create").val();
var checkName = isValidName(name);
var checkDate = isValidDate(date);
$("#invalid-name").html("");
$("#invalid-date").html("");
if (!checkName || !checkDate) {
if (!checkName) {
$("#invalid-name").html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateName(clone, student) {\n clone.querySelector(\"h3\").textContent = `${student.firstName}`;\n\n if (student.middleName !== null) {\n clone.querySelector(\"h3\").textContent += ` ${student.middleName}`;\n }\n\n if (student.nickName !== null) {\n clone.querySelector(\"h3\").textContent += ... | [
"0.65689707",
"0.620495",
"0.6182175",
"0.6176324",
"0.6146664",
"0.6137135",
"0.6136316",
"0.60877776",
"0.6009924",
"0.59910506",
"0.59557074",
"0.59341556",
"0.59218365",
"0.5919741",
"0.5903774",
"0.5889014",
"0.5857382",
"0.58537984",
"0.5845816",
"0.5829356",
"0.5810512... | 0.7098995 | 0 |
Check validation name, date, score of Update Form | function isValidUpdateForm() {
var name = $("#name-update").val();
var date = $("#date-update").val();
var score = $("#scores-update").val();
var checkName = isValidName(name);
var checkDate = isValidDate(date);
var checkScore = isValidScore(score);
$("#invalid-name-update").html("");
$("#invalid-date-updat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateEdit(){\n\t\n\t//check to see if the user left the name field blank\n\tif (document.getElementById(\"e_name\").value == null || document.getElementById(\"e_name\").value == \"\"){\n\t\t\n\t\t//finding the error element to insert a warning message to screen\n\t\tdocument.getElementById(\"e_nameerro... | [
"0.63022697",
"0.6280334",
"0.6235043",
"0.62195915",
"0.6135952",
"0.6130722",
"0.61267775",
"0.6104443",
"0.6069854",
"0.6064438",
"0.5969051",
"0.5959598",
"0.5936241",
"0.5922455",
"0.5910567",
"0.59100455",
"0.5879264",
"0.5865672",
"0.58627254",
"0.58500403",
"0.5839571... | 0.7319324 | 0 |
Help functions pinMenu() Makes menu pinned. | function pinMenu() {
pinned = true;
sessionStorage.setItem('offcanvas-pinned', true);
// Adjust content area padding-left
$(".sv-grid-ksgs12").first().addClass('pinned'); // So CSS can adjust padding rule accordingly
// Turn off CSS animation (important on ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function unPinMenu() {\n pinned = false;\n sessionStorage.setItem('offcanvas-pinned', false);\n $(\".sv-grid-ksgs12\").first().removeClass('pinned'); // So CSS can adjust padding rule accordingly\n $(\".ked-navigation .sidebar\").css({\n transition: ''\n ... | [
"0.6467344",
"0.6044588",
"0.59335524",
"0.582378",
"0.5804994",
"0.57948786",
"0.57649744",
"0.57390463",
"0.56737",
"0.56527984",
"0.55990404",
"0.5577514",
"0.55574",
"0.5546173",
"0.55460936",
"0.55415285",
"0.5539166",
"0.55056703",
"0.54897654",
"0.5468931",
"0.545994",... | 0.7623702 | 0 |
pinMenu() Makes menu unpinned. | function unPinMenu() {
pinned = false;
sessionStorage.setItem('offcanvas-pinned', false);
$(".sv-grid-ksgs12").first().removeClass('pinned'); // So CSS can adjust padding rule accordingly
$(".ked-navigation .sidebar").css({
transition: ''
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pinMenu() {\n pinned = true;\n sessionStorage.setItem('offcanvas-pinned', true);\n // Adjust content area padding-left\n $(\".sv-grid-ksgs12\").first().addClass('pinned'); // So CSS can adjust padding rule accordingly\n // Turn off CSS animation (impo... | [
"0.69657046",
"0.58726287",
"0.5818229",
"0.58157265",
"0.5696246",
"0.5691289",
"0.567437",
"0.56405973",
"0.55667055",
"0.5533408",
"0.55315435",
"0.5522669",
"0.54751223",
"0.54744023",
"0.5455905",
"0.5453397",
"0.54243577",
"0.5396975",
"0.5387861",
"0.53867346",
"0.5335... | 0.74881536 | 0 |
Loads the specified file name and returns its contents in the resolved promise. If an error occurs, the Promise is rejected with that err object. | function loadFile(filename) {
return new Promise((resolve, reject) => {
fs.readFile(filename, 'utf8', (err, data) => {
if (err) {
reject(err);
}
resolve(data);
});
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadFile(fn) {\n return new Promise ( (res, rej) => {\n fs.readFile(fn, (err, data) => {\n if (err) {\n rej(err);\n };\n res(data);\n })\n\n })\n}",
"function readFile(filename){\n return new Promise(function(resolve,reject){\n fs.readFile(filename,'utf8',function... | [
"0.7450181",
"0.7361729",
"0.7113645",
"0.7080123",
"0.7021091",
"0.6999997",
"0.6986836",
"0.6799019",
"0.67787486",
"0.6746002",
"0.6736354",
"0.66987115",
"0.66966766",
"0.66299886",
"0.65761346",
"0.65730083",
"0.6570246",
"0.65607053",
"0.6550152",
"0.6538104",
"0.653692... | 0.7783232 | 0 |
Creates all of the DB fixtures. | function createDbFixtures(db) {
return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
logger.info('Dropping all tables...', 'createDbFixtures()');
db.run('DROP TABLE IF EXISTS shopping_list_item');
db.run('DROP TABLE IF EXISTS shopping_list')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function seedTestDb() {\n console.info(`seeding test db`);\n const seedData = [];\n\n for (let i = 1; i <= 10; i++) {\n seedData.push({\n author: {\n firstName: faker.name.firstName(),\n lastName: faker.name.lastName()\n },\n title: fak... | [
"0.6870241",
"0.6748878",
"0.6734655",
"0.67227685",
"0.64746886",
"0.64066",
"0.64003146",
"0.6382833",
"0.63770515",
"0.6330635",
"0.63110876",
"0.629965",
"0.62302333",
"0.62285316",
"0.6226334",
"0.6182829",
"0.61728525",
"0.61662734",
"0.6151417",
"0.60907",
"0.6088938",... | 0.6859346 | 1 |
Handles brand table: inserts a single row into the table using the specified DB module | function handleBrandRowForSqlDb(db, fields) {
// Brand description
let description = fields[1];
// Manufacturer (optional)
let manufacturer = (fields[3]) ? fields[3] : null;
// Address (optional)
let address = (fields[4]) ? fields[4] : null;
// Website (optional)
let website = (fields[5]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleItemRowForSqlDb(db, fields) {\n // UPC\n let upc = fields[2];\n // Brand description\n let brandDescription = fields[3];\n // Item description\n let itemDescription = fields[4];\n // Insert the row\n db.run('INSERT INTO item (upc, description, brand_id) VALUES (?, ?, (SELECT ... | [
"0.6191833",
"0.60389256",
"0.6033408",
"0.5823731",
"0.5779035",
"0.5770387",
"0.57083666",
"0.5681953",
"0.5663672",
"0.5556327",
"0.5546297",
"0.5475382",
"0.5459168",
"0.5416698",
"0.5333551",
"0.5331327",
"0.5305346",
"0.5298177",
"0.52925354",
"0.52240515",
"0.5219594",... | 0.67137426 | 0 |
Handles item table: inserts a single row into the table using the specified DB module and the fields provided | function handleItemRowForSqlDb(db, fields) {
// UPC
let upc = fields[2];
// Brand description
let brandDescription = fields[3];
// Item description
let itemDescription = fields[4];
// Insert the row
db.run('INSERT INTO item (upc, description, brand_id) VALUES (?, ?, (SELECT id FROM brand... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function insertModules( tx ) {\n\tvar query = \"\";\n\tvar localData = parsedData.products;\n\t\n\tconsole.log( \"Inserting data into \" + tableModules + \" table.\" );\n\tfor( var i = 0; i < localData.length; i++ ) {\n\t\tquery = \"INSERT INTO \" + tableModules + \"(name, description, category, cost, quantity, im... | [
"0.6458707",
"0.6176581",
"0.61576617",
"0.61110264",
"0.61085147",
"0.6068656",
"0.60593516",
"0.6024863",
"0.5902085",
"0.5834478",
"0.58176214",
"0.57623076",
"0.57536983",
"0.5750179",
"0.5734515",
"0.5732755",
"0.5723568",
"0.5714153",
"0.5709989",
"0.5703644",
"0.569297... | 0.7166819 | 0 |
Ufos fliegen von allein nach einer bestimmten Zeit rein. | function addUfoRechts() {
let neu = new abschlussaufgabe.UfosRechts(x, y, color, colorbody, colorAlien, status);
abschlussaufgabe.ufos.push(neu);
n++;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doesburgRuimZichtTrein(){\r\n \r\n that.MIDDEN.removeEventListener(\"doesburgRuimZichtTrein\", doesburgRuimZichtTrein);\r\n that.MIDDEN.removeEventListener(\"doesburgRuimZichtFiets\", doesburgRuimZichtFiets);\r\n \r\n maakBestemming(\"Station Dieren\"... | [
"0.572814",
"0.56438917",
"0.55591834",
"0.555414",
"0.5426748",
"0.5395355",
"0.53925776",
"0.5370177",
"0.5291671",
"0.51700866",
"0.5154709",
"0.5115443",
"0.50808495",
"0.502997",
"0.50154865",
"0.50108486",
"0.5002088",
"0.49931484",
"0.49686095",
"0.4942055",
"0.4926864... | 0.6324152 | 0 |
The higher the number of iterations, the more precise the value of pi calculated | function calculate_pi(pi, count) {
for(var i = 0; i <= num_iterations; i++) {
pi += (4/count) - (4/(count+2));
count += 4;
}
return pi;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcPI(iterations){\n\n // This is a constant which has a value that can't change\n const piVal = 3.14159;\n\n // You assign names to numbers, text and functions\n // Variable names can't start with a number, contain\n // spaces, but can contain letters, numbers, underscores\n // or $ (A... | [
"0.73715967",
"0.7324036",
"0.7235137",
"0.6890916",
"0.6862754",
"0.6806797",
"0.67588747",
"0.66732854",
"0.6637508",
"0.65024096",
"0.64021826",
"0.6384876",
"0.61531574",
"0.61367416",
"0.61341816",
"0.6120894",
"0.6064143",
"0.602032",
"0.5982218",
"0.59290814",
"0.59234... | 0.80418384 | 0 |
seleccionar modelo de la carpeta | selectModel(){
var estado=$(this).attr('data-estado');
var id=$(this).attr('data-id');
if(estado=='inactivo'){
homeFunctions.modelosSeleccionados.push(id);
$(this).attr('data-estado','activo');
}else{
homeFunctions.modelosSeleccionados.splice(homeFunct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function selectModel() {\n var data = await tf.io.listModels();\n var table = document.querySelector('#roidata');\n var tx = db.transaction('models_store', 'readonly');\n var store = tx.objectStore('models_store');\n var modelCount = 0;\n empty(table);\n\n // Update table data\n (function(callback) ... | [
"0.61486804",
"0.60905904",
"0.59867835",
"0.5966323",
"0.59378123",
"0.5910162",
"0.5864246",
"0.5859648",
"0.58483607",
"0.58072084",
"0.5792601",
"0.57925254",
"0.5761369",
"0.57549024",
"0.5753526",
"0.57254106",
"0.57022274",
"0.5699995",
"0.56948113",
"0.5683301",
"0.56... | 0.70980406 | 0 |
create function to load array and call placeNumbers() | function setup() {
cells = new Array([document.getElementById("cell00"),
document.getElementById("cell01"),
document.getElementById("cell02"),
document.getElementById("cell03")],
[document.getElementById("cell10"),
document.getElementById("cell11"),
document.getElementById("cell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storeNumbers(inputNum){\r\n arrayNumberOpt.push(inputNum);\r\n \r\n}",
"function numbers (){\n memory.map((each,index)=>{\n \n if(d.test(each) && d.test(memory[index+1])){\n memory.splice(index,1)\n me... | [
"0.6140321",
"0.6051949",
"0.5822516",
"0.5780922",
"0.56639457",
"0.56611925",
"0.5634432",
"0.55639935",
"0.5521622",
"0.5489538",
"0.54602385",
"0.54458094",
"0.543958",
"0.54215324",
"0.54103863",
"0.53717923",
"0.53254366",
"0.5306288",
"0.53040516",
"0.52662736",
"0.526... | 0.6437848 | 0 |
create function to place random numbers in the cells | function placeNumbers() {
var numbers = new Array();
for (var i = 0; i <= 16; i++)
numbers[i] = i;
var randomLoc;
var temp;
for (i = 0; i < 16; i++) {
randomLoc = Math.floor(Math.random() * 15 + 1);
temp = numbers[i];
numbers[i] = numbers[randomLoc];
numbers[r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function randomCell() {\r\n return Math.floor(Math.random() * 4)\r\n}",
"function numberGenerator(){\n\n let numberNode = document.getElementById('displayNumber')\n let randomNumber = Math.floor(Math.random()*99)\n if (numberNode.innerText===randomNumber){\n\n numberNode.innerText=Math.floor(Mat... | [
"0.7817687",
"0.71950376",
"0.7106396",
"0.708395",
"0.70487636",
"0.7025179",
"0.69456786",
"0.6902963",
"0.6803292",
"0.67933595",
"0.6782088",
"0.67590576",
"0.67492795",
"0.6698995",
"0.66908425",
"0.6681047",
"0.66787696",
"0.6670965",
"0.665837",
"0.66176015",
"0.660613... | 0.75257784 | 1 |
create the function that will check, each time a cell is clicked, if the move is legal and will, if it is not legal, display an alert if the move is legal, the function should call the swap() function it should also check to see if this move is a winner, i.e., call checkWinner() | function doClick(row, col) {
var top = row - 1;
var bottom = row + 1;
var left = col - 1;
var right = col + 1;
swapped = false;
if (top != -1 && cells[top][col].innerHTML == "")
swap(cells[row][col], cells[top][col]);
else if (right != 4 && cells[row][right].innerHTML == "")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clickCell(x,y) {\n if (grid[x][y]>0) {\n alert(\"Dont Try To Cheat Bud!!!!!\");\n } \n\n\n// Clicking Of Boxes\n else {\n if (currentPlayer==1) {\n document.getElementById(\"cell_\"+x+\"_\"+y).style.color=\"#3F88C5\";\n document.getElementById(\"cell_\"+x+\"_\"+y).innerHTML=\"X\";\n ... | [
"0.73361665",
"0.7271175",
"0.72555465",
"0.72038627",
"0.717861",
"0.71740675",
"0.7039678",
"0.70174915",
"0.6990598",
"0.69901437",
"0.69481957",
"0.6935858",
"0.69034255",
"0.68961155",
"0.68895185",
"0.68770623",
"0.68697983",
"0.6857768",
"0.68417156",
"0.6835108",
"0.6... | 0.80218244 | 0 |
Create new JWT Cipher instance | function JwtCipher() {
BaseCipher.apply(this, arguments);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function JwtCipher() {\n // TODO: think about token and payload attributes in object\n BaseCipher.apply(this, arguments);\n}",
"createJWT() {\n const header = {\n alg: \"RS384\",\n typ: \"JWT\",\n kid: \"3ab8b05b64d799e289e10a201786b38c\"\n };\n const headerStr = JSON.stringify(header);... | [
"0.7501355",
"0.67131937",
"0.664408",
"0.66328424",
"0.6570755",
"0.65287083",
"0.6486476",
"0.648217",
"0.6464648",
"0.6453824",
"0.63997704",
"0.63712776",
"0.6359358",
"0.6340051",
"0.63160545",
"0.62019306",
"0.62019306",
"0.62019306",
"0.61921865",
"0.6183261",
"0.61821... | 0.69724005 | 1 |
const dotenv = require('dotenv').config() npx hardhat run scripts/deploy.js network rinkeby | async function deployTellorx(_network, _pk, _nodeURL) {
console.log("deploy tellor 3")
await run("compile")
var net = _network
///////////////Connect to the network
let privateKey = _pk;
var provider = new ethers.providers.JsonRpcProvider(_nodeURL)
let wallet = new ethers.Wallet(privateKe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function main() {\n if(bre.network.name.indexOf(\"sidechain\")>=0 || bre.network.name.indexOf(\"sokol\")>=0){\n const Liker = await deploy(\"Liker\")\n const NiftyRegistry = await deploy(\"NiftyRegistry\")\n const NiftyInk = await deploy(\"NiftyInk\")\n const NiftyToken = await deploy(\"NiftyTok... | [
"0.62458915",
"0.5859429",
"0.5761977",
"0.57000875",
"0.55637115",
"0.5557716",
"0.5547593",
"0.55063295",
"0.54965055",
"0.547904",
"0.5475143",
"0.5449727",
"0.543948",
"0.54310924",
"0.54185843",
"0.5381491",
"0.53423923",
"0.53342056",
"0.5328909",
"0.5317564",
"0.531199... | 0.6246271 | 0 |
make initial chart with x: study_time, y: grade | function makeChart1(dataset, gradeType) {
//grade type select
function grade(d){
switch(gradeType){
case "First Period Grade": return d.grade_1;
case "Second Period Grade": return d.grade_2;
case "Final Grade": return d.grade_F;
}
}
const MAX_RADIUS = 15; //max... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeChart(students) { // takes in an array of students\n\n var progressScores = [];\n var dictSheet = {Sheet5:[] , Sheet4:[] , Sheet3:[] ,Sheet2:[], Sheet1:[], Sheet8:[], Sheet7:[], Sheet6:[], Sheet12:[], Sheet11:[], Sheet10:[], Sheet9:[], Sheet17:[], Sheet16:[], Sheet15:[], ... | [
"0.6712651",
"0.6318941",
"0.60848767",
"0.60664606",
"0.59915257",
"0.5984788",
"0.594712",
"0.59435815",
"0.59111077",
"0.5898368",
"0.5895352",
"0.5883158",
"0.5828611",
"0.5826382",
"0.5825016",
"0.5814507",
"0.5759495",
"0.5758266",
"0.5753145",
"0.57378966",
"0.5730123"... | 0.64446235 | 1 |
Filter a DB and return the pages a user is mentioned in. | async function getUserMentionPages(database, user) {
const response = await notion.databases.query({
database_id: database,
filter: {
"property": "People",
"people": {
"contains": user.id,
},
},
});
return response.results;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function byPage(req, res, next) {\n\n\tvar time = req.params.time;\n\ttime = time === '0' ? new Date() : time;\n\tvar number = req.params.number || 100;\n\tvar user = req.user;\n\n\tvar shortList;\n\n\tif (req.body && req.body.length && req.body.length > 0) {\n\t\tshortList = req.body;\n\t}\n\n\tuser.allAuthorized... | [
"0.6060344",
"0.56205314",
"0.5488822",
"0.527252",
"0.52303076",
"0.52163553",
"0.5210773",
"0.52032155",
"0.5169645",
"0.51673055",
"0.51597816",
"0.51533115",
"0.51275474",
"0.5062927",
"0.50610405",
"0.50594014",
"0.5033407",
"0.5016463",
"0.4987903",
"0.49720696",
"0.495... | 0.71593773 | 0 |
Get all people from the Operating Manuals table | async function getOperatingManualEntries() {
const response = await notion.databases.query({
database_id: PEOPLE_DB,
});
return response;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPersons() {\n Person.find({}).then((persons) => {\n persons = persons\n .map((person) => {\n return `${person.name} ${person.number}`;\n })\n .join(\"\\n\");\n\n console.log(`Phonebook:\\n${persons}`);\n mongoose.connection.close();\n });\n}",
"function getAllPeople(s... | [
"0.59329706",
"0.5827414",
"0.5810908",
"0.5634131",
"0.56321555",
"0.5554172",
"0.54884243",
"0.547695",
"0.54263806",
"0.54032725",
"0.53794503",
"0.53775615",
"0.53750986",
"0.5363746",
"0.53317696",
"0.531599",
"0.53134537",
"0.5312907",
"0.52918786",
"0.529105",
"0.52906... | 0.5882799 | 1 |
Create a new child page for an individual user. | async function createUserPage(user, studio) {
let results = await getUserMentionPages(CLIENTS_DB, user);
const userProjectCount = results.length;
const response = await notion.pages.create({
parent: {
database_id: MASTER_DB,
},
properties: {
"People": {
"people": [user],
},... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function create_new_page( path, params, k, err ) {\n\n if (!$.perc_fakes.page_service.create_page) {\n $.perc_pathmanager.get_folder_path(path, function(fp){\n createPage(fp, params, k, err);\n }, err);\n }\n else {\n if (false)\n ... | [
"0.6167921",
"0.5895759",
"0.5822577",
"0.5822159",
"0.5818629",
"0.5792045",
"0.5735539",
"0.5656892",
"0.5642094",
"0.56316566",
"0.5621535",
"0.5569998",
"0.55635244",
"0.5508431",
"0.54804367",
"0.54804367",
"0.54804367",
"0.5479136",
"0.54771423",
"0.5475909",
"0.5459171... | 0.6075777 | 1 |
Update availability and projects of all users | async function updateAvailablity() {
let projectEndDates = [];
let estAvailableDate;
// Get all entries from the IC table
// TODO: Swap this out with PEOPLE_DB (our Operating Manual table)
const entries = await notion.databases.query({
database_id: MASTER_DB,
});
entries.results.forEach(async (entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function invalidateUsers(project){\n //look for members\n project.getUsers().then(function(users){\n var x;\n for (x in users) {\n users[x].ProjectUser.active = false;\n users[x].ProjectUser.save();\n }\n });\n}",
"function updateProjectStatus() {\n projects.forEach(el => {\n if (... | [
"0.63985705",
"0.6367657",
"0.59456265",
"0.5914704",
"0.5747696",
"0.5735615",
"0.5643893",
"0.5636609",
"0.56071204",
"0.56050557",
"0.55937296",
"0.5590317",
"0.5584975",
"0.55618906",
"0.55489004",
"0.5539384",
"0.55344796",
"0.5531673",
"0.5531109",
"0.54964083",
"0.5493... | 0.654373 | 0 |
Al poner esta funcion en la consola se nos mostraran todos los libros que tenemos | function mostrarLibros() {
console.log('Estos son tus libros, crack');
console.log(arrayLibros);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static mostrarLibros(){\n //le consulta a la clase datos y trae lo que hay en el localStorage y lo devuelve como un arreglo\n const libros = Datos.traerLibros();\n //recorrer el arreglo y le envío a la funcion, le envio el libro que es un elemento del arreglo y le envio como parametro al otro ... | [
"0.73976743",
"0.64602214",
"0.6272602",
"0.62378687",
"0.6102503",
"0.6078608",
"0.5986836",
"0.59497166",
"0.59301865",
"0.58911043",
"0.58875066",
"0.5858347",
"0.58492047",
"0.5840744",
"0.5815315",
"0.58141077",
"0.5809631",
"0.577675",
"0.5775891",
"0.57658476",
"0.5757... | 0.6519413 | 1 |
Esta funcio solo nos mostrara a los autores de los libros | function mostrarAutores(){
console.log('Estos son los autores de los libros: ');
var autores = [];
for (var libro of arrayLibros) {
autores.push(libro.obtAutor());
}
// Ese atributo de "sort" se usa para acomodarlos en orden alfabetico
console.log(autores.sort());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static mostrarLibros(){\n //le consulta a la clase datos y trae lo que hay en el localStorage y lo devuelve como un arreglo\n const libros = Datos.traerLibros();\n //recorrer el arreglo y le envío a la funcion, le envio el libro que es un elemento del arreglo y le envio como parametro al otro ... | [
"0.5861468",
"0.56145626",
"0.5614161",
"0.5561504",
"0.55511796",
"0.54899704",
"0.54219276",
"0.53221554",
"0.53221554",
"0.529137",
"0.5284133",
"0.5272501",
"0.526714",
"0.52648574",
"0.52556354",
"0.5251506",
"0.52460676",
"0.5245316",
"0.5233773",
"0.52262324",
"0.52244... | 0.5946463 | 0 |
Function only used if there is no(t) (enough) data for the duallinegraph | function noDataGraph() {
d3.selectAll(".dualgraphVis").remove();
var margin = {top: 10, right: 80, bottom: 10, left: 80},
width = 600 - margin.left - margin.right,
height = 40 - margin.top - margin.bottom;
d3.select("#title3")
.attr("width", width + margin.right)
.attr("height", height + margin.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fndrawGraph() {\r\n setOptionValue();\r\n\t\t\t\tlayout = new Layout(\"line\", options);\r\n//\t\t\t\talert(\"called.........fngraph............\");\r\n\t\t\t\tvar atempDataPopulation;\r\n\t\t\t\tvar atempPopulationlefive;\r\n\t\t\t\tvar atemparrPopulationbetFive;\r\n\t\t\t\tvar atemparrpop... | [
"0.62296295",
"0.59050566",
"0.58248776",
"0.57932484",
"0.5785431",
"0.57522845",
"0.5696793",
"0.5678965",
"0.5677244",
"0.564673",
"0.5580447",
"0.5575127",
"0.5569301",
"0.55612344",
"0.5554584",
"0.55512184",
"0.5486707",
"0.54852253",
"0.54603875",
"0.54544055",
"0.5453... | 0.6383015 | 0 |
find node's ref by name | function findNode(name) {
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].name === name) {
return nodes[i];
}
}
return null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNodeByName(node, name) {\n\tfor (var i=0;i<node.childNodes.length;i++) {\n\t\tif (node.childNodes[i].name==name)\n\t\t\treturn node.childNodes[i];\n\t}\n}",
"function nodeByName(name, root) {\n return dojo.query(\"[name='\" + name + \"']\", root)[0];\n}",
"query(name) {\n for (let node of... | [
"0.6559467",
"0.6529456",
"0.63633615",
"0.63391376",
"0.6335392",
"0.62759125",
"0.61599636",
"0.61558634",
"0.61433285",
"0.6083563",
"0.6048036",
"0.5995623",
"0.5946483",
"0.5912718",
"0.58662254",
"0.57761127",
"0.57238805",
"0.56771064",
"0.5615294",
"0.5615294",
"0.554... | 0.7007032 | 0 |
Calls a method on the Server by sending a message on the Bus. Returns a promise with the result of the remote procedure call. | callRemote(method, ...params) {
const id = this.lastId++;
const promise = Q.defer();
this.currentMessages[id] = promise;
this.bus.postMessage({
id,
method,
params
}, this.target);
setTimeout(() => {
delete this.currentMessages[id];
promise.reject({code: -200, mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"sendMessage() {\n // This function is called before sending a method (including resending on\n // reconnect). We should only (re)send methods where we don't already have a\n // result!\n if (this.gotResult())\n throw n... | [
"0.6031233",
"0.585897",
"0.57547253",
"0.5707994",
"0.56077754",
"0.55542904",
"0.5546738",
"0.5535287",
"0.54885495",
"0.5474342",
"0.5474342",
"0.5468205",
"0.54560506",
"0.5447531",
"0.54345167",
"0.54345167",
"0.54342073",
"0.5429275",
"0.5389158",
"0.53864235",
"0.53852... | 0.70769787 | 0 |
test for 3 squares | function threeSquares(t){ //t=1 for player1, t=2 for player2
j=1;
while (j<n+1){
i=1;
while (i<n+1){
if (state[i][j]==t){
for (l=j;l<n+1;l++){
if (l==j){start=i+1}else{start=1;}
for (k=start;k<n+1;k++){
if (state[k][l]==t){
if (0<k+l-j && k+l-j<n+1 && 0<l-k+i && l-k+i<n+1 &&
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkRowForThree() {\n for (i = 0; i < 62; i++) {\n //if we use indexes to draw our row, it would look like this\n let rowOfThree = [i, i + 1, i + 2];\n //this is the color to eliminate\n let decidedColor = squares[i].style.backgroundImage;\n\n //below is a variable to confirm ... | [
"0.70596564",
"0.6978215",
"0.6889313",
"0.6878417",
"0.68396646",
"0.68316436",
"0.6797027",
"0.67672646",
"0.6726729",
"0.6691389",
"0.66620475",
"0.65808415",
"0.6560611",
"0.65482557",
"0.64712715",
"0.6441363",
"0.6415006",
"0.64004993",
"0.636194",
"0.63615376",
"0.6333... | 0.70659083 | 0 |
saves users profile and displays profile saved toast | function saveProfile (user) {
userService.saveProfile(user);
toastService.showToast(user.displayName + 'profile saved!');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveProfileInformation(){\n\tvar name = document.getElementById(\"profileName\").value;\n\tvar age = document.getElementById(\"userAge\").value;\n\tvar phoneNumber = document.getElementById(\"userPhone\").value;\n\tvar mailId = document.getElementById(\"userMail\").value;\n\tvar address = document.getElem... | [
"0.70859903",
"0.7017332",
"0.69895035",
"0.69691205",
"0.694631",
"0.6859013",
"0.6830958",
"0.68281",
"0.67398435",
"0.67193",
"0.6713508",
"0.66712517",
"0.66520834",
"0.6594825",
"0.65735954",
"0.6560961",
"0.6548889",
"0.6543532",
"0.6487065",
"0.6484189",
"0.64815235",
... | 0.7506044 | 0 |
Save the message to the db and send all sockets but the sender. | function _sendAndSaveMessage(message, socket, fromServer) {
var messageData = {
text: message.text,
user: message.user,
createdAt: new Date(message.createdAt),
chatId: chatId,
_id: parseInt((Math.random() * 100) + 1)
};
messagesDB.push(messageData);
var emitter ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"saveMessages () {\n this._context.db.get('clients')\n .find({ id: this.id })\n .assign({\n messages: this.messages.map(msg => { return {\n _telegramMessage: msg._telegramMessage,\n groupMessage: msg.groupMessage\n }})\n })\n .write()\n }",
"saveMessage() {\... | [
"0.6569025",
"0.6528313",
"0.6442493",
"0.6435981",
"0.642421",
"0.6360033",
"0.63105446",
"0.6221983",
"0.62133175",
"0.620693",
"0.6193941",
"0.6172248",
"0.6123215",
"0.6044958",
"0.6044749",
"0.6043608",
"0.60087675",
"0.60069275",
"0.5989907",
"0.5967227",
"0.59663373",
... | 0.7054565 | 0 |
Renders the cards as a stack with props.stackDepth cards deep. | renderStack() {
//Get the next stack of cards to render.
let cards = this.state.cards.slice(currentIndex[this.guid], currentIndex[this.guid] + this.props.stackDepth).reverse();
return cards.map((card, i) => {
let offsetX = 20;
if (this.props.isShell) {
offsetX = this.props.stackOffset... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CardStack() {\n _classCallCheck(this, CardStack);\n\n this.stack = [];\n }",
"renderCards() {\n\t\t// check if there are no more cards left\n\t\tif (this.state.index >= this.props.data.length) {\n\t\t\treturn this.props.renderNoMoreCards();\n\t\t}\n\n\t\treturn this.props.data.map((item, i) => {\... | [
"0.68748564",
"0.67206407",
"0.6614329",
"0.6526389",
"0.6397076",
"0.6299493",
"0.6215061",
"0.62116325",
"0.60418206",
"0.60233676",
"0.6018825",
"0.601466",
"0.6007644",
"0.5983148",
"0.5963463",
"0.5930044",
"0.5913408",
"0.58954537",
"0.58336145",
"0.5831785",
"0.5762486... | 0.6925514 | 0 |
Draws the buttons GUI | function drawButtons() {
bctx.fillStyle = "lightgray";
bctx.fillRect(0, 0, W /2, H);
// iterates through all the rects and draws them
for (let i = 0; i < rects.length; i++) {
if (Number(rects[i].type) >= 0) {
bctx.fillStyle = ((Number(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function draw_Buttons() {\r\n btnDown.drawButton(context1.context);\r\n btnUp.drawButton(context1.context);\r\n btnLeft.drawButton(context1.context);\r\n btnRight.drawButton(context1.context);\r\n btnFire.drawButton(context1.context);\r\n btnMiddle.drawButton(context1.context);\r\n }",
"functi... | [
"0.7779904",
"0.7170611",
"0.7139793",
"0.7008196",
"0.68751234",
"0.6755538",
"0.6679035",
"0.6616403",
"0.65842205",
"0.6552735",
"0.654347",
"0.6529492",
"0.64823323",
"0.6473629",
"0.64718485",
"0.6455731",
"0.64451355",
"0.6437236",
"0.6426478",
"0.64260644",
"0.64173406... | 0.7234646 | 1 |
calls async function of asyncGetPledges | function getPledges() {
try{
// this needs to be in a try catch or it doesnt work?!?!
// no error is thrown in the catch!
(async() => {
await asyncGetPledges()
})()
} catch (e) {
console.log(e.message)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function asyncGetPledges() {\n\ttry {\n\t\tconst fin = document.getElementById('fin').checked\n\t\tconst admin = checkIfAdmin() ? 1 : 0\n\n\t\tconst options = { headers: { fin: fin, off: offset, admin: admin } }\n\t\tconst response = await fetch('/list', options)\n\t\tconst json = await response.json()\n\n\t... | [
"0.75011057",
"0.5917858",
"0.56236964",
"0.5604094",
"0.55895007",
"0.55530494",
"0.555221",
"0.553893",
"0.55295855",
"0.5528103",
"0.55253375",
"0.54906154",
"0.5446142",
"0.54194826",
"0.5403604",
"0.5396098",
"0.5390623",
"0.53862876",
"0.5370795",
"0.5345618",
"0.534351... | 0.8124594 | 0 |
gets list of pledges from server | async function asyncGetPledges() {
try {
const fin = document.getElementById('fin').checked
const admin = checkIfAdmin() ? 1 : 0
const options = { headers: { fin: fin, off: offset, admin: admin } }
const response = await fetch('/list', options)
const json = await response.json()
await getPledgesSuccess(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPledges() {\n\ttry{\n\t\t// this needs to be in a try catch or it doesnt work?!?!\n\t\t// no error is thrown in the catch!\n\t\t(async() => {\n\t\t\tawait asyncGetPledges()\n\t\t})()\n\t} catch (e) {\n\t\tconsole.log(e.message)\n\t}\n}",
"function list() {\n return request({\n url: `/nodes`,\n... | [
"0.66747797",
"0.60501564",
"0.6001579",
"0.58941704",
"0.5853854",
"0.5737158",
"0.5680058",
"0.5663385",
"0.56484383",
"0.55815643",
"0.5575189",
"0.55279297",
"0.5470921",
"0.5442229",
"0.54038686",
"0.53973925",
"0.53489727",
"0.53301686",
"0.5324737",
"0.5299949",
"0.529... | 0.66007215 | 1 |
for each pledge retrieved, calculates values and calls function to be displayed | async function displayPledges(data) {
for ( const p of data ) {
// prepare pledgeHTML
p.moneyRaised = p.moneyRaised === null ? 0 : p.moneyRaised
const url = getURLfromImgName(p.image)
const img = getURLforImage(p.image)
console.log(img)
//const daysRemaining = getDaysRemaining(p.deadline)
const daysRema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcResults() {\n\t\trbAge.innerText = parseInt(currentAge)+parseInt(yearsToRetirement);\n\t\trbIncome.innerText = rawNestAmount*targetRetirementIncomePercentage;\n\t\trbInterest.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t\trbBalance.innerText... | [
"0.61216384",
"0.60569286",
"0.5947514",
"0.5908006",
"0.5906337",
"0.586457",
"0.5798625",
"0.5773935",
"0.57491505",
"0.5747762",
"0.5745532",
"0.5743329",
"0.572361",
"0.5693019",
"0.5673192",
"0.56705016",
"0.56621313",
"0.5647786",
"0.56371975",
"0.562721",
"0.5618819",
... | 0.70254076 | 0 |
Gets all existing properties from components list | function getAvailableProperties(components, onResult) {
var propertiesMap = {};
async.each(components,
function (component, callback) {
viewer.getProperties(component.dbId, function (result) {
for (var i = 0; i < result.properties.length; i++) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function componentProperties() {\n return attachableComponents.map(({ compiled : { Component: { name }}}, i) => \n `this.component${name}${i} = register(new (this.constructor.components.get('${name}')))`\n ).join(\"\\n\");\n }",
"function componentProps(){\n\t\tvar props = {};\n\t\tlog(arguments);\n\... | [
"0.6989422",
"0.66742295",
"0.65934193",
"0.6394517",
"0.6374875",
"0.6323275",
"0.6303313",
"0.62723994",
"0.6234034",
"0.62126356",
"0.61201155",
"0.60688037",
"0.6063561",
"0.60288846",
"0.59952295",
"0.59762913",
"0.5971201",
"0.5969161",
"0.59479487",
"0.5938656",
"0.592... | 0.70356524 | 0 |
Get all leaf components | function getAllLeafComponents(callback) {
function getLeafComponentsRec(parent) {
var components = [];
if (typeof parent.children !== "undefined") {
var children = parent.children;
for (var i = 0; i < children.length; i++) {
var c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"GetComponentsInChildren() {}",
"GetComponentsInChildren() {}",
"GetComponentsInChildren() {}",
"GetComponentsInChildren() {}",
"getLeafNodes() {\n return this.model.getLeafs();\n }",
"LeafNodes() {\r\n\r\n\t\tif(this.isEmpty()){\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\telse{\r\n\t\t\tvar result ... | [
"0.699599",
"0.699599",
"0.699599",
"0.699599",
"0.6731047",
"0.65373033",
"0.6411502",
"0.6354671",
"0.6354671",
"0.6354671",
"0.6354671",
"0.61997795",
"0.61694914",
"0.6106092",
"0.6086522",
"0.60853136",
"0.606538",
"0.60618925",
"0.60509396",
"0.6022023",
"0.6015021",
... | 0.7876666 | 0 |
Depthfirst search until a streak of `lengthLeft` has been found. Should be initialised with at least one item in `shapeToFill`. | function findShape(shapeToFill, neighborIndexes, lengthLeft) {
if (lengthLeft === 0) return true;
const lastIndex = shapeToFill[shapeToFill.length - 1];
for (const index of neighborIndexes[lastIndex]) {
if (shapeToFill.includes(index)) continue;
shapeToFill.push(index);
if (findShape(shapeToFill, nei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function minwidth(shape){\n //default first to false\n var first = false\n var count = 0\n //whilst theres nothing found then keep looping\n while (first == false && count < (shape.length -1)){\n for(var row = 0; row < shape.length; row++){\n //checks if first collum for that row i... | [
"0.50114363",
"0.49372646",
"0.48872736",
"0.4801737",
"0.47950217",
"0.4767349",
"0.47330827",
"0.4730209",
"0.47013816",
"0.46997863",
"0.4674116",
"0.46703118",
"0.4662474",
"0.465257",
"0.46446773",
"0.46373188",
"0.46355745",
"0.4623939",
"0.46227968",
"0.46190467",
"0.4... | 0.63521236 | 0 |
Displays Results for Recipe | function displayResults(responseJson) {
let recipeinfo = `
<img src= ${responseJson.recipes[0].image} class="imgStyle" alt="Recipe Photo">
<h2><span> ${responseJson.recipes[0].title}</span></h2>
<p><span> Make Time: ${responseJson.recipes[0].readyInMinutes}</span></p>
`
$('.recipeScreen').htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayRecipes() {\n console.log(\"My recipes: \", recipes);\n}",
"function showResults() {\n let bigString = \"\";\n\n for (let i = page; i < page + 10; i++) {\n let result = results[i];\n\n let smallURL = result.recipe.image;\n if (!smallURL) smallURL = \"Media/gif_finder_i... | [
"0.7093848",
"0.6795365",
"0.66479284",
"0.6584153",
"0.65807587",
"0.6554213",
"0.6541439",
"0.65240943",
"0.6508277",
"0.6449557",
"0.6438683",
"0.64379233",
"0.64242566",
"0.6420089",
"0.64027035",
"0.63819426",
"0.6374153",
"0.6373892",
"0.63582695",
"0.6352954",
"0.63057... | 0.69288695 | 1 |
polyInterface: handle to the interface address: Your node address, withouth the leading 'n999_' primary: Same as address, if the node is a primary node name: Your node name | constructor(polyInterface, primary, address, name) {
super(nodeDefId, polyInterface, primary, address, name);
this.subscribeEvents = subscribe;
this.ringInterface =
require('../lib/ringInterface.js')(Polyglot, polyInterface);
// Commands that this controller node can handle.
// S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(polyInterface, primary, address, name) {\n logger.info('HomeKit Node => constructing one');\n super(nodeDefId, polyInterface, primary, address, name);\n\n logger.debug(\"saving bridgeIsStarted\")\n\n // Commands that this node can handle.\n // Should match the 'accepts' section... | [
"0.58609974",
"0.5324407",
"0.52285045",
"0.51383084",
"0.50176096",
"0.49547198",
"0.4884246",
"0.48830587",
"0.4790869",
"0.47881272",
"0.4776428",
"0.47651252",
"0.47646493",
"0.47387522",
"0.46837306",
"0.4658558",
"0.46569017",
"0.464207",
"0.46276346",
"0.46212122",
"0.... | 0.5731282 | 1 |
NOTE FROM PRADEEP If the device is wired, which means there is no battery to charge, then battery_life will be in mVolts. Examples: lpd_v1,lpd_v2, hp_cam_v1 and v2, jbox, stickup_cam_elit etc. For dual powered devices, i.e, that requires a charge such as a solar panel or just a new battery the battery_life will be in p... | isPercent(device) {
// if (mvDevices.includes(device.kind)) {
// return false; // Devices return battery_life in mV
// }
// Assume it is returning in percentage if between 0 and 100.
// Otherwise, mV
return device.battery_life <= 100;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBatteryState() {\n\t\tvar batteryLevel = Math.floor(battery.level * 100);\n\t\tdocument.getElementById(\"str-battery-status\").innerHTML = batteryLevel + \"%\";\n }",
"function handleBatteryLevelChanged(event) {\n let value = event.target.value;\n let a = [];\n // Convert raw data bytes to hex ... | [
"0.5923525",
"0.59037",
"0.56801844",
"0.5679981",
"0.5650717",
"0.56284434",
"0.5590349",
"0.5559466",
"0.55164963",
"0.5516295",
"0.55160564",
"0.55130506",
"0.5500397",
"0.54780436",
"0.54764235",
"0.5460415",
"0.5441993",
"0.5424254",
"0.54163486",
"0.5416091",
"0.5370894... | 0.6298964 | 0 |
Check if the player found the cat. | function checkCatFound() {
//If the player and the Zombie lands on the cats position the player still loses.
if (xPosition === xCatPos && yPosition === yCatPos && xPosition === xZombiePos && yPosition === yZombiePos) {
gameOver();
}
//The player found a cat.
else if (xPosition === xCatPos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function winnerIsCat() {\n\t\tif (turn===9 && winnerIsX()===false) {\n\t\t$(\"#peaches\").hide();\n\t\t$(\"#grumpy\").show();\n\t}\n}",
"function isCat(text) {\n text = text.toLowerCase();\n return text.indexOf(\"cat\") != -1;\n}",
"function checkCat(cat, pointValue) {\n for (let i = 0; i < gameLogic.le... | [
"0.63093895",
"0.6000299",
"0.59017456",
"0.57910514",
"0.56730103",
"0.56569654",
"0.56281275",
"0.55608076",
"0.5540249",
"0.55335224",
"0.5494695",
"0.5468989",
"0.5438875",
"0.5412425",
"0.53900784",
"0.53881925",
"0.53751755",
"0.5357703",
"0.53525615",
"0.5349116",
"0.5... | 0.77147496 | 0 |
get a JavaScript program from the editor. this returns a nonnull string object. | getProgramFromEditor() {
return this.editorArea.getDoc().getValue()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getSourceFromEditor() {\n return this.getProgramFromEditor()\n }",
"get WindowsEditor() {}",
"get LinuxEditor() {}",
"get program() {\n return this.currentProgram;\n }",
"get OSXEditor() {}",
"get pythonScript() {\n return this.getStringAttribute('python_script');\n }",
"functio... | [
"0.71337616",
"0.61936754",
"0.6114533",
"0.60423017",
"0.58878535",
"0.58357173",
"0.57427883",
"0.57195395",
"0.5696479",
"0.56281453",
"0.56204456",
"0.53689414",
"0.53569144",
"0.53487635",
"0.53378725",
"0.5322573",
"0.5280871",
"0.5223462",
"0.5219059",
"0.521138",
"0.5... | 0.7611045 | 0 |
this may return '' when no backup is found. | restoreAutoSaved() {
const text = localStorage.getItem(this.backupFileName)
if (text === null)
return ''
else
return String(text)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPossibleBackupPath(path) {\n const pathObject = parse(path)\n pathObject.base = '.~' + pathObject.base\n return format(pathObject)\n}",
"function getBackupSheetName(name){\n return name + \".\" + (new Date()).toString();\n}",
"async _getKeyBackupInfo() {\n const now = (new Date()).... | [
"0.5853298",
"0.5775762",
"0.57138443",
"0.56575555",
"0.56535953",
"0.5559557",
"0.5429158",
"0.539328",
"0.52246815",
"0.5214924",
"0.5195926",
"0.51430416",
"0.51161337",
"0.50903726",
"0.5079866",
"0.5030121",
"0.5021976",
"0.4939945",
"0.4880446",
"0.48560193",
"0.482152... | 0.5961492 | 0 |
split fc based on geographical location use intersect or containedIn function and filter on result | function splitLoc(fc, bound) {
var fbound = ee.Feature(bound);
var fc_inside = function(f){
return ee.Feature(f).set('inbound',ee.Feature(f).intersects(fbound));
};
fc = fc.map(fc_inside);
return [fc.filter(ee.Filter.eq('inbound', true)),
fc.filter(ee.Filter.neq('inbound', true))];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function filterCollection(imgcoll, start_date, end_date, poly){\n return imgcoll.filterDate(start_date, end_date)\n .filterBounds(poly.centroid()); //using the polygon only would go bananas\n // .filter(ee.Filter.lt('CLOUD_COVER', 10));\n}",
"function getEntriesInRegion(lat, lon, m... | [
"0.5747189",
"0.56607854",
"0.5481519",
"0.5408135",
"0.5397873",
"0.53943837",
"0.5367094",
"0.5363992",
"0.53257155",
"0.53221047",
"0.53195083",
"0.5172615",
"0.51725054",
"0.5153227",
"0.50833577",
"0.505913",
"0.5055747",
"0.50476885",
"0.49903908",
"0.49889928",
"0.4977... | 0.79498273 | 0 |
Data Creating a new Mosaic First we create an object to represent the form data. We're using knockout to represent the model and bind that model to the input fields on the page. The object containts the name and description of the mosaic, and info about the target person, structured to match google's "person" data stru... | function Mosaic(){
var self = this;
self.name= ko.revertibleObservable().extend({ required: true });
self.description= ko.revertibleObservable().extend({ required: true });
self.target= {
name : {
givenName : ko.revertibleObservable().extend({ required: true }),
familyName : ko.rev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createNewMosaic() {\n if( mosaicData.isValid() ) {\n $.post(\"/createmosaic\", ko.toJS(mosaicData)).done(handleNewMosaic);\n }\n }",
"function createMetaData(){\n var title = document.getElementById(\"title\").value;\n var composer = document.getElementById(\"composer\").value;\n va... | [
"0.7291291",
"0.6555577",
"0.6407292",
"0.602063",
"0.59226644",
"0.5836169",
"0.5527771",
"0.5525469",
"0.5524589",
"0.5520477",
"0.54649746",
"0.5445276",
"0.5384571",
"0.5384228",
"0.5375627",
"0.53719044",
"0.53627074",
"0.53450185",
"0.5313566",
"0.52844167",
"0.52770156... | 0.67484707 | 1 |
Create a new mosaic based on the knockout data | function createNewMosaic() {
if( mosaicData.isValid() ) {
$.post("/createmosaic", ko.toJS(mosaicData)).done(handleNewMosaic);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setUpMosaicDialog() {\n /**\n After we load the template, we bind it to the form div, to set up the\n knockout 2-way binding and add it to the DOM\n **/\n var dialog = this.dialog;\n ko.applyBindings(mosaicData,dialog[0]);\n $(\"body\").append(dialog);\n /**\n Finally we set the... | [
"0.692544",
"0.6328974",
"0.60987276",
"0.60965484",
"0.6094292",
"0.5634345",
"0.5592379",
"0.55916536",
"0.5564901",
"0.5544031",
"0.5509782",
"0.5509599",
"0.54787624",
"0.54654",
"0.5403098",
"0.53598154",
"0.53460264",
"0.53283966",
"0.5261311",
"0.5257307",
"0.52461296"... | 0.7972986 | 0 |
Process the new mosaic after its been passed to the server | function handleNewMosaic (data) {
var message;
if (data && data.key) {
document.location.href = "/mosaicpage/"+data.key+"/";
}
else {
message = "Failed to create mosaic" + mosaicData.name;
$("#message").html(message);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createNewMosaic() {\n if( mosaicData.isValid() ) {\n $.post(\"/createmosaic\", ko.toJS(mosaicData)).done(handleNewMosaic);\n }\n }",
"function doMosaic(e){\n // check if tile setting are valid. Do nothing if not\n if(TILE_WIDTH < 1 || TILE_HEIGHT < 1){\n console.error('Invalid T... | [
"0.7485373",
"0.6562704",
"0.63086784",
"0.6287893",
"0.58991945",
"0.55997515",
"0.55599666",
"0.55221254",
"0.53637785",
"0.5358496",
"0.53244996",
"0.5316894",
"0.5294285",
"0.523646",
"0.52355784",
"0.5142118",
"0.51174307",
"0.50587535",
"0.49936697",
"0.4988576",
"0.497... | 0.7215492 | 1 |
To generate HTML div content corresponding to task to view on Webpage | createHTMLtask() {
const htmlstring = '<div class="task" draggable="true" id="' + this.id + '" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">' +
'<big><strong>' + this.name + " " + '</strong></big>' +
this.date.replace('T', ' ').substring(0, 19) +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showTasks( tasks ) {\n\n taskList=tasks;\n // Empty content string\n var taskContent = '';\n\n $.each(tasks, function(task){\n\ttaskContent +=\"<div class=task id=task\"+ tasks[task].task_id +\">\";\n\ttaskContent +=\"<div class=taskLabel> task_id </div><div class=taskSample>\"+tasks[task].tas... | [
"0.700638",
"0.6849314",
"0.68057126",
"0.6645667",
"0.6604521",
"0.6550051",
"0.6508648",
"0.64895016",
"0.6488757",
"0.6488381",
"0.6482016",
"0.64807075",
"0.6395889",
"0.639009",
"0.63790923",
"0.633552",
"0.6334037",
"0.63312995",
"0.63284993",
"0.6328479",
"0.6230699",
... | 0.74048966 | 0 |
To generate a minimized version of description that fits on div of task in webpage. | minimizeDescription() {
var shortdescription = "";
for (var i = 0; i < 28 && this.description[i] !== '\n'; i++) {
shortdescription += this.description.charAt(i);
}
shortdescription += "...";
return shortdescription;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ShowDescription() {\n\tcurrentTaskNumber = 'tdl_' + localStorage.getItem('CurrentTask');\n\tvar task = ucFirst(JSON.parse(localStorage.getItem(currentTaskNumber))[0]);\n\tvar description = JSON.parse(localStorage.getItem(currentTaskNumber))[1];\n\t\n\t//if (task.length > 13)\n\t\t//task = task.substr(0, 1... | [
"0.65142244",
"0.63024724",
"0.62099665",
"0.6202537",
"0.60563797",
"0.6046572",
"0.601918",
"0.5935545",
"0.587743",
"0.581415",
"0.57830703",
"0.5777602",
"0.5771237",
"0.5766576",
"0.5759444",
"0.57373184",
"0.5731458",
"0.57126975",
"0.57118946",
"0.56736875",
"0.5671122... | 0.64563227 | 1 |
To create HTML part for viewTask Modal | createViewModal() {
const htmlstring = '<div class="modal-content">' +
'<div class="modal-header">' +
' <span id="closeview" class="closeview">×</span>' +
' <h2>' + this.name + '</h2>' +
'</div>' +
'<div class="modal-body">' +
' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createHTMLtask() {\n const htmlstring = '<div class=\"task\" draggable=\"true\" id=\"' + this.id + '\" ondragstart=\"drag(event)\" ondrop=\"drop(event)\" ondragover=\"allowDrop(event)\">' +\n '<big><strong>' + this.name + \" \" + '</strong></big>' +\n this.date.replace('T', ' ').substr... | [
"0.7140041",
"0.65881413",
"0.64235526",
"0.641306",
"0.6307632",
"0.60886705",
"0.60485744",
"0.60420537",
"0.6025225",
"0.5990486",
"0.59714997",
"0.5966672",
"0.5959099",
"0.5950287",
"0.59444594",
"0.5931157",
"0.5921053",
"0.5918827",
"0.59023625",
"0.58940095",
"0.58845... | 0.725835 | 0 |
To increment priority of a task over the next one above Function Hoisting | function incrementPriority(taskid) {
var task = {};
task = array[taskid - 1];
var oldp = task.priority;
var oldstatus = task.status;
if (task.priority === 1 && numberOfPrioStatus(task.status, 1) === 1) {
alert("Already maximum priority");
} else if (task.priority === 1) {
for (i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function decrementPriority(taskid) {\n var task = {};\n task = array[taskid - 1];\n var oldp = task.priority;\n var oldstatus = task.status;\n var maxPriorityOfStatus = maxPrio(taskid);\n\n if (oldp === maxPriorityOfStatus && numberOfPrioStatus(oldstatus, oldp) === 1) {\n alert(\"Already l... | [
"0.65183467",
"0.62561226",
"0.6135046",
"0.60464984",
"0.60345596",
"0.5831477",
"0.5818935",
"0.5753555",
"0.5693836",
"0.5676142",
"0.5589763",
"0.55726457",
"0.5545839",
"0.5537661",
"0.5517048",
"0.5501232",
"0.5469407",
"0.54611707",
"0.5442045",
"0.5440518",
"0.5393514... | 0.6860476 | 0 |
No decrement if already lowest priority && number of task with same priority is = 1 Decrement value of priority of task with task id if maxPrio and more than one task exist with same prio / To decrement priority of a task over the next one below Function Hoisting | function decrementPriority(taskid) {
var task = {};
task = array[taskid - 1];
var oldp = task.priority;
var oldstatus = task.status;
var maxPriorityOfStatus = maxPrio(taskid);
if (oldp === maxPriorityOfStatus && numberOfPrioStatus(oldstatus, oldp) === 1) {
alert("Already lowest priority... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function incrementPriority(taskid) {\n var task = {};\n task = array[taskid - 1];\n var oldp = task.priority;\n var oldstatus = task.status;\n\n if (task.priority === 1 && numberOfPrioStatus(task.status, 1) === 1) {\n alert(\"Already maximum priority\");\n } else if (task.priority === 1) {... | [
"0.7860286",
"0.6912979",
"0.65074235",
"0.6486199",
"0.6322919",
"0.62618583",
"0.6039693",
"0.59832746",
"0.5917239",
"0.5903663",
"0.58458763",
"0.56319803",
"0.5558218",
"0.55043006",
"0.54514873",
"0.54318327",
"0.54030776",
"0.5360907",
"0.53327274",
"0.5325011",
"0.532... | 0.83803344 | 0 |
To get the maximum priority value existing in each phase or the task's status Function Hoisting | function maxPrio(taskid) {
var taskstatus = "";
taskstatus = array[taskid - 1].status;
if (taskstatus === "todo") {
return todoMaxPrio;
} else if (taskstatus === "progress") {
return progressMaxPrio;
} else if (taskstatus === "done") {
return doneMaxPrio;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"currentPriority(actionContext) {\n const { value: priority, error } = this.priority.tryGetValue(actionContext.state);\n if (error) {\n return -1;\n }\n return priority;\n }",
"function incrementmaxPrio(taskstatus) {\n if (taskstatus === \"todo\") {\n todoMaxPri... | [
"0.6327839",
"0.6156121",
"0.60997456",
"0.6034754",
"0.59379506",
"0.5868521",
"0.5627055",
"0.5617556",
"0.56095314",
"0.5581998",
"0.5577726",
"0.55729026",
"0.54714394",
"0.5466627",
"0.5440571",
"0.54373163",
"0.5434261",
"0.5433343",
"0.54325163",
"0.5412077",
"0.540301... | 0.74197966 | 0 |
Maps attributes to their visual encodings. | function mapAttributes() {
sizeValue = attributeMappings[sizeIndex].value;
sizeName = attributeMappings[sizeIndex].name;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mapAttributes() {\n yValue = attributeMappings[yIndex].value;\n yAxisName = attributeMappings[yIndex].name;\n\n buildVis();\n }",
"_visitAttributesOf(el) {\n const explicitAttrNameToValue = {};\n const implicitAttrNames = this._implicitAttrs[el.name] || [];\n ... | [
"0.65073884",
"0.5634696",
"0.5634696",
"0.5634696",
"0.5634696",
"0.5622375",
"0.5567153",
"0.5483335",
"0.5452243",
"0.53761137",
"0.53651947",
"0.53651947",
"0.5360184",
"0.5353727",
"0.5329923",
"0.53296965",
"0.53296965",
"0.5321382",
"0.5315862",
"0.53021294",
"0.528104... | 0.59449977 | 1 |
Recycle Component or Create a new One. | new( name ){
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let idx = this.names.get( name );
if( idx == undefined ){ console.error( "Component name unknown : %s", name ); return null; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let c, com = this.items[ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"reg( com ){\r\n\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\t\t// Validate that component does not exists\r\n\t\tif( this.names.has( com.name ) ){\r\n\t\t\tconsole.error( \"Component Name Already Exists : %s\", com.name);\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\t//~~~~~~~~~~~~~~~~~... | [
"0.60730296",
"0.6062649",
"0.6045352",
"0.59909695",
"0.59745306",
"0.58535594",
"0.5799876",
"0.577658",
"0.57493126",
"0.5696073",
"0.56031054",
"0.55876404",
"0.5548443",
"0.55411905",
"0.5520863",
"0.55068177",
"0.5499129",
"0.5499129",
"0.5499129",
"0.5499129",
"0.54991... | 0.6623736 | 0 |
Add a User Created Component Instances to Com Storage If Com doesn't exist, it will auto register it. | push( com ){
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// User Created Component Instance, Check if its registered
let cname = com.constructor.name,
idx = this.names.get( cname );
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// If registered already, just add it as a new insta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"add_com( e_id, com ){\r\n\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\t\tlet e = this.entities.instances[ e_id ];\r\n\t\tif( !e ){ console.error( \"Can Not Found Entity \", e_id ); return null; }\r\n\r\n\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\t\tif( typeof com == \"stri... | [
"0.6015049",
"0.58892876",
"0.56729877",
"0.5631928",
"0.5567447",
"0.54812646",
"0.5464015",
"0.5454797",
"0.5423978",
"0.53562",
"0.5342774",
"0.5337822",
"0.52820224",
"0.5280378",
"0.5266467",
"0.5266467",
"0.5255105",
"0.5216163",
"0.51862586",
"0.51862586",
"0.51862586"... | 0.6891578 | 0 |
Get the Type ID by name | get_type_id( name ){ return this.names.get( name ); } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTypeIDByName(name) {\n\tswitch(name)\n\t{\n\tcase \"LAMP\": return 2;\n\tcase \"TV\": return 3;\n\tcase \"Kettle\": return 4;\n\tcase \"Water Heater\": return 5;\n\tcase \"Air Conditioner\": return 6;\n\tdefault: return 1; //undefined\n\t}\n}",
"function getType(name){\n return types.filter(fu... | [
"0.835333",
"0.7367555",
"0.67857695",
"0.67183137",
"0.6695874",
"0.66891825",
"0.6625146",
"0.6460649",
"0.63764936",
"0.63329786",
"0.6260319",
"0.6260024",
"0.6211931",
"0.6186791",
"0.61666876",
"0.6119111",
"0.6077474",
"0.60516876",
"0.60166925",
"0.60155934",
"0.59923... | 0.88182414 | 0 |
Get Registration Object by com name | get_reg( name ){ return this.items[ this.names.get( name ) ]; } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"reg( com ){\r\n\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\t\t// Validate that component does not exists\r\n\t\tif( this.names.has( com.name ) ){\r\n\t\t\tconsole.error( \"Component Name Already Exists : %s\", com.name);\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\t//~~~~~~~~~~~~~~~~~... | [
"0.61850154",
"0.59891045",
"0.57847923",
"0.5687436",
"0.5648677",
"0.54270333",
"0.54149675",
"0.5387067",
"0.53861475",
"0.53824157",
"0.5333919",
"0.53146243",
"0.5305852",
"0.52203935",
"0.5209566",
"0.5207733",
"0.51585996",
"0.5156238",
"0.5156238",
"0.5150842",
"0.514... | 0.61588997 | 1 |
RSpec style describe takes an arbitrary number of arguments that are contactenated as strings the last argument is the configuration object which can have before: after: callbacks | function describe() {
var args = $.makeArray(arguments),
// configuration function
config = (args.length > 0 && args[args.length - 1]['before']) ? args.pop() : {},
spec = new QUnit.Spec(args.join(' '));
spec['before'] = config['before'] || config['setup'];
spec['after'] = config['after'] ||... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"it(label, f) {\n const description = `${this.describeLabel}: ${label}`;\n this.testCases.push({description, f});\n }",
"function startDescribe(app) {\n let result = `describe('React VT Tests', () => {${newLine}`; \n result += `${oneSpace}let wrapper;${newLine}`; \n result += `${oneSpace}beforeEach(() =... | [
"0.5814764",
"0.57584727",
"0.56946397",
"0.5680719",
"0.5600463",
"0.5592546",
"0.54424286",
"0.5419093",
"0.54138035",
"0.5406493",
"0.5382552",
"0.53725225",
"0.52920514",
"0.5278675",
"0.5222744",
"0.5175726",
"0.5166555",
"0.51538545",
"0.51523125",
"0.515182",
"0.511078... | 0.7461605 | 0 |
== Retrieve Emplyee names by ID and add to the row == \\ | function getNames(dataRow){
var names = recal("FirstName") || employeeData();
if(dataRow.employeeID){
var ID = dataRow.employeeID;
dataRow.firstName = names[ID];
};
// log("First Name Function Called", dataRow.firstName)
return dataRow
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getEmployees() {\n const query = 'SELECT CONCAT (employee.first_name, \" \", employee.last_name) as name FROM employee'\n\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n addEmployee(res)\n })\n}",
"function queryEmployeeInfo() {\n employeeInfo = {};\n ... | [
"0.6298918",
"0.6201879",
"0.61388147",
"0.61037683",
"0.60636705",
"0.6055787",
"0.60059965",
"0.57960564",
"0.57878196",
"0.57858187",
"0.577992",
"0.5765185",
"0.57629603",
"0.57478726",
"0.57395774",
"0.5733752",
"0.56877697",
"0.56821436",
"0.56816256",
"0.56756765",
"0.... | 0.6559697 | 0 |
transform mouse coordinates in a string according to this spec: works for any videobox position | function mouseCoordToHex(x, y) {
var ratio_x, ratio_y;
x = x - allCanvas.pointer.offset().left;
y = y - allCanvas.pointer.offset().top;
if (framesize.decoded.height === 0) {
ratio_x = x / getWidth();
ratio_y = y / getHeight();
} else {
var calculated_height = framesize.decoded.hei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function xyToTransform(x, y) {\n if (playerInfo.playingAs == \"white\")\n return \"translate(\" + y * 12.5 + \"vw,\" + x * 12.5 + \"vw)\";\n else\n return \"translate(\" + (7 - y) * 12.5 + \"vw,\" + (7 - x) * 12.5 + \"vw)\";\n }",
"function dispMouseCoord(){\t\t\t\t\t//used... | [
"0.62198186",
"0.60284984",
"0.59402555",
"0.5884947",
"0.5874657",
"0.5867916",
"0.5840097",
"0.58369184",
"0.5835625",
"0.5790247",
"0.57883066",
"0.57712275",
"0.57601106",
"0.5759884",
"0.57341033",
"0.5705613",
"0.5701221",
"0.5664596",
"0.5664596",
"0.56600094",
"0.5648... | 0.63621026 | 0 |
todo we have analog this function.It is createUpdatedCitiesList(). Look on logic. | createDataListForRefreshInformation() {
let citiesData = this.state.cities;
if (citiesData.length === 0) {
return
}
let yandex = this.state.source.yandexFlag;
let gismeteo = this.state.source.gismeteoFlag;
let weather = this.state.source.weatherFlag;
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createUpdatedCitiesList(city) {\n let citiesData = this.state.cities;\n let yandex = this.state.source.yandexFlag;\n let gismeteo = this.state.source.gismeteoFlag;\n let weather = this.state.source.weatherFlag;\n let source = [];\n let cities = [];\n let citiesAndSo... | [
"0.7757201",
"0.66200054",
"0.6522282",
"0.64306206",
"0.6413716",
"0.6204207",
"0.6166364",
"0.61583513",
"0.6156147",
"0.61273575",
"0.60481256",
"0.5999716",
"0.59778917",
"0.5971188",
"0.5960453",
"0.5920265",
"0.58873737",
"0.5861659",
"0.58274055",
"0.5803052",
"0.57622... | 0.66542476 | 1 |
Split a data attribute by | and return the trimmed parts | parts(key) {
var raw = this.param(key);
var parts = raw.split('|');
for (var i = 0; i < parts.length; ++i) {
parts[i] = parts[i].trim();
}
return parts;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cleanInput(data) {\n\tvar newdata = data.toString().replace(/(\\r\\n|\\n|\\r)/gm,\"\");\n\tnewdata = newdata.replace(/\\|/gm, \" \");\n\tnewdata = newdata.replace(/\\s+/g, \" \");\n\tnewdata = newdata.split(\" \");\n\treturn newdata;\n}",
"_splitAndNormalize(data) {\n return data\n .split(/\\r?\... | [
"0.6287181",
"0.5536289",
"0.5487008",
"0.5388946",
"0.5364177",
"0.53335214",
"0.51899064",
"0.5172845",
"0.5105746",
"0.50846237",
"0.50625116",
"0.5045308",
"0.5044583",
"0.50163674",
"0.4972518",
"0.49631634",
"0.4937995",
"0.49346837",
"0.49168658",
"0.49138674",
"0.4911... | 0.57996655 | 1 |
rewrite var = stack.pop() to ValueLocal | function rewriteStackPop(current, previous) {
for (var i=0;i<current.length;++i) {
var val = current[i];
if(val.type === forth.Types.JsCode) {
var match = /^[ ]*var[ ]+(.+)[ ]+=[ ]+stack\.pop\([ ]*\)[ ;]*$/.exec(val.body);
if(match !== null) {
modified = true;
val.type = forth.Types.ValueLocal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getVar(){\n var r = varStack[0];\n varStack.shift();\n return r;\n}",
"pop_return_stack() {\n let result = this.return_stack.pop()\n return result\n }",
"pop() {\n if (this.length === 0) {\n throw new Error('Stack has no values');\n\n return;\n }\n\n this.length-... | [
"0.6952834",
"0.6528064",
"0.6523144",
"0.6520067",
"0.64884377",
"0.64364535",
"0.64242417",
"0.63655734",
"0.63488364",
"0.63430035",
"0.6307469",
"0.6256063",
"0.6249247",
"0.6245009",
"0.6237452",
"0.6237452",
"0.6225571",
"0.62016135",
"0.61914814",
"0.6173624",
"0.61562... | 0.7453603 | 0 |
remove empty code tree entries | function removeEmptyCodeTreeEntries(current) {
for (var i=0;i<current.length;++i) {
var val = current[i];
if((val.type === forth.Types.ValueLocal && val.values.length === 0) ||
(val.type === forth.Types.ValueLocalTemp && val.values.length === 0) ||
(val.type === forth.Types.Body && val.body.length == 0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pruneEmptyBranches(d) {\n for (var c = d.children.length; c > 0;) {\n var kid = d.children[--c];\n if (!kid.value) {\n if (kid.children) {\n pruneEmptyBranches(kid);\n } else {\n d.children.splice(c, 1);\n }\n }\n... | [
"0.661862",
"0.6412338",
"0.63356316",
"0.63081807",
"0.6176477",
"0.606732",
"0.5991909",
"0.591767",
"0.58988947",
"0.58696693",
"0.5847275",
"0.57854277",
"0.57805234",
"0.57742083",
"0.57500386",
"0.57500386",
"0.57459235",
"0.57459235",
"0.57333666",
"0.57087684",
"0.565... | 0.7852546 | 0 |
Simulate loading with a RAF loop | function loadLoop() {
progress(GameState.calculateGenerationProgress());
requestAnimationFrame(loadLoop);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"load() {\n this.loadEventLoop(600)\n }",
"async load () {}",
"function run() {\r\n\t// Initialize the loader before anything happens\r\n\tloader.init();\r\n}",
"function startLoad() {\n loadInterval = setInterval(updateLoad, 50);\n}",
"function ani_loop2 () {\n var q = d3.queue();\n if (... | [
"0.7080954",
"0.64442146",
"0.6074854",
"0.5998493",
"0.5997728",
"0.5958655",
"0.5957836",
"0.5893663",
"0.58728606",
"0.58687997",
"0.58687997",
"0.58488816",
"0.58432204",
"0.58310366",
"0.5796615",
"0.57701063",
"0.5754266",
"0.5745768",
"0.5739175",
"0.5726068",
"0.56857... | 0.7130411 | 0 |
requires id, sessionID, type, rating, attempts. Options object may contain height, color, and notes | constructor(id, sessionId, type, rating, attempts, isSent = true, options){
this.id = id;
this.sessionId = sessionId;
this.type = type;
this.rating = rating;
this.isSent = isSent;
this.attempts = attempts;
this.height = options && options["height"] ? options["height"] : null;
this.notes ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function options(id, options) {\n id = parseInt(id);\n log.info(\"TURTLES - Set options for #\"+ id);\n log.debug(\"TURTLES - Options: \", options);\n if (instances[id] == null){\n log.error(\"TURTLES - Unknown instance: #\" + id);\n return;\n }\n\n ... | [
"0.5756421",
"0.551876",
"0.5429475",
"0.5429475",
"0.5429475",
"0.5284872",
"0.5284872",
"0.49726105",
"0.4967502",
"0.49660662",
"0.49546885",
"0.49477944",
"0.49232158",
"0.49155122",
"0.49113798",
"0.48994428",
"0.4849669",
"0.4834548",
"0.48197064",
"0.48093936",
"0.4790... | 0.76679343 | 0 |
Sets quarantine flag for job | quarantineJob(job, message){
this.store.find('job', job.id + '/quarantine?message=' + message).then(
() => {
this.refresh(job.id); // Refresh children of current model
},
(errorObject) => {
job.set('quarantined', false);
this.controller.set('error', errorObjec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"unQuarantineJob(job){\n job.set('current_flow_step', this.controller.get('newFlowStep'));\n this.store.find('job', job.id + '/unquarantine?step=' + job.current_flow_step).then(\n () => {\n this.refresh(job.id); // Refresh children of current model\n },\n (errorObject) => {\n... | [
"0.6726317",
"0.5295687",
"0.5119936",
"0.5116239",
"0.49161276",
"0.48967302",
"0.4861129",
"0.4858531",
"0.4826418",
"0.48212945",
"0.47685105",
"0.47438025",
"0.4727384",
"0.47138306",
"0.4710787",
"0.4710787",
"0.4700427",
"0.46668792",
"0.46542585",
"0.46438956",
"0.4631... | 0.6162216 | 1 |
Resets quarantine flag for job | unQuarantineJob(job){
job.set('current_flow_step', this.controller.get('newFlowStep'));
this.store.find('job', job.id + '/unquarantine?step=' + job.current_flow_step).then(
() => {
this.refresh(job.id); // Refresh children of current model
},
(errorObject) => {
jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"quarantineJob(job, message){\n this.store.find('job', job.id + '/quarantine?message=' + message).then(\n () => {\n this.refresh(job.id); // Refresh children of current model\n },\n (errorObject) => {\n job.set('quarantined', false);\n this.controller.set('error'... | [
"0.63828367",
"0.5788706",
"0.5190702",
"0.51402694",
"0.511334",
"0.50856113",
"0.50856113",
"0.50856113",
"0.5082259",
"0.5069957",
"0.5066017",
"0.5066017",
"0.5049201",
"0.50424653",
"0.50424653",
"0.50424653",
"0.5029385",
"0.5024985",
"0.5024985",
"0.5024985",
"0.502498... | 0.7204704 | 0 |
Write a function sum that accepts an unlimited number of integer arguments, and adds all of them together. The function should reject any arguments that are not integers, and sum the remaining integers. sum(1, 2, 3) // > 6 sum(1, "2", 3) // > 4 | function sum() {
return [...arguments].reduce((total, el) => {
total += Number.isInteger(el) ? el : 0;
return total;
}, 0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sumOfInput(...input) {\n let numbers = input.filter(value => Number.isInteger(value));\n\n if (numbers.length > 0)\n result = numbers.reduce((previousVal, currentVal) => {\n return previousVal + currentVal;\n });\n else result = 0;\n\n /*\n Using raw loops if required \n \n var siz... | [
"0.8013058",
"0.7676065",
"0.7644741",
"0.74714035",
"0.73837227",
"0.7369852",
"0.7336079",
"0.7330752",
"0.7314314",
"0.7281267",
"0.7271053",
"0.72671753",
"0.7250403",
"0.724993",
"0.7239225",
"0.72321355",
"0.7227284",
"0.72246283",
"0.7223858",
"0.72114223",
"0.72030824... | 0.77955353 | 1 |
makeMoons: lib: code.org library Create seven moons with semirandom coordinates, size, and color. Then, store them in an array for use while drawing. Written by Keegan Brown and Daniel Noon | makeMoons(lib) {
for (var i=0;i<7;i++) {
let newMoon = {
s: Math.random()*12,
x: Math.random()*(lib.width),
y: lib.randomNumber(50, lib.height - 50),
r: 62+lib.randomNumber(0,50),
g: 39+lib.randomNumber(0,30),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drawMoon(){\n fill('white');\n ellipse(random(width),80,80,80);\n}",
"smolMoons (lib){\n for (var i=0;i<7;i++){\n let moon = this.madeMoons[i];\n var size = moon.s;\n lib.moveTo(moon.x, moon.y);\n lib.penRGB(moon.r, moon.g, moon.b);\n l... | [
"0.66592205",
"0.6649686",
"0.64524657",
"0.6363338",
"0.6209259",
"0.6073304",
"0.60707706",
"0.6064885",
"0.604478",
"0.5998046",
"0.59943146",
"0.59929615",
"0.5966326",
"0.58882034",
"0.5883876",
"0.58456314",
"0.58444285",
"0.58384365",
"0.5830053",
"0.58025473",
"0.5783... | 0.7369862 | 0 |
background: lib: code.org library Draw a big black dot for the background of the void of space. Written by Keegan Brown | background(lib){
lib.moveTo(lib.width/2,lib.height/2);
lib.penColor("black");
lib.dot(500);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function background(){\n //background\n ctx.fillStyle = '#000000';\n ctx.fillRect(0, 0, width, height);\n //grid of dots\n ctx.fillStyle = '#AAAAAA';\n for(var h = 50; h < height; h += 50){\n for(var w = 50; w < width; w += 50){\n drawDot(w, h);\n }\n }\n}",
"function Background() {\n\tctx.begi... | [
"0.76345444",
"0.74492776",
"0.71509516",
"0.71221197",
"0.7109607",
"0.7079465",
"0.7070357",
"0.7036387",
"0.70354456",
"0.6964423",
"0.69472593",
"0.69466585",
"0.69386125",
"0.6923065",
"0.6909359",
"0.68857366",
"0.6884459",
"0.68732023",
"0.6859045",
"0.6821053",
"0.680... | 0.7634969 | 0 |
stars: lib: code.org library Draw the stars, then move the stars to the right for the next frame. It then calls smolMoons for convenience. Written by Keegan Brown with edits by Daniel Noon | stars(lib) {
for (let i=0; i<100; i++){
var star = this.madeStars[i];
lib.penColor("white");
lib.moveTo(star.x,star.y);
lib.dot(star.size);
star.x += .25;
if (star.x > this.lib.width + 5) {
star.x = -5;
star.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drawStarsMove(mX, mY) {\r\n // Clear Canvas\r\n ctx.clearRect(0, 0, winWidth, winHeight);\r\n\r\n // Redraw all stars\r\n for(i=0; i<starCnt; i++) {\r\n // Calculate distance to mouse pointer\r\n xDist = mX - stars[i].x;\r\n yDist = mY - stars[i].y;\r\n xDist2 = xDi... | [
"0.73826146",
"0.71826094",
"0.71584177",
"0.7025796",
"0.6989173",
"0.69725657",
"0.68159485",
"0.6809761",
"0.68074423",
"0.6774428",
"0.67541754",
"0.6684716",
"0.66452396",
"0.661955",
"0.660831",
"0.6584292",
"0.65737545",
"0.655624",
"0.6556199",
"0.65554",
"0.655495",
... | 0.72740036 | 1 |
flipFlop: y: ycoordinate to mirror over the center of the canvas. Helper function to abstract the task of mirroring the height of a moon to simulate an orbit. Written by Daniel Noon | flipFlop(y) {
let difference = y - this.lib.height / 2;
return this.lib.height / 2 - difference;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mirrorY(y) {\n return window.innerHeight - y;\n}",
"_reverseY() {\n this._dy = -this._dy;\n }",
"function flipY( geometry ) {\n\n const uv = geometry.attributes.uv;\n\n for ( let i = 0; i < uv.count; i ++ ) {\n\n uv.setY( i, 1 - uv.getY( i ) );\n\n }\n\n return geometry;\... | [
"0.67644763",
"0.56215113",
"0.55591923",
"0.54993695",
"0.54871875",
"0.54815084",
"0.54195046",
"0.5416415",
"0.5406464",
"0.53997093",
"0.5395467",
"0.53191954",
"0.5314535",
"0.5312117",
"0.5306301",
"0.53014416",
"0.5300689",
"0.5253246",
"0.52345014",
"0.5199526",
"0.51... | 0.7055456 | 0 |
smolMoons: lib: code.org library Draws all the moons that are smaller than 6 pixels in radius. Then, it moves them to the right before checking if it should change the moon into a big moon. Written by Keegan Brown | smolMoons (lib){
for (var i=0;i<7;i++){
let moon = this.madeMoons[i];
var size = moon.s;
lib.moveTo(moon.x, moon.y);
lib.penRGB(moon.r, moon.g, moon.b);
let movingLeft = true;
let behind = false;
if (moon.s < 6) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"moons (lib){\n for (var i=0;i<7;i++){\n let moon = this.madeMoons[i];\n var size = moon.s;\n lib.moveTo(moon.x, moon.y);\n lib.penRGB(moon.r, moon.g, moon.b);\n let movingLeft = true;\n let behind = false;\n \n if (moon.... | [
"0.742018",
"0.6160838",
"0.60108614",
"0.5996444",
"0.5992383",
"0.59655464",
"0.5948439",
"0.59295493",
"0.5924903",
"0.5905351",
"0.58982337",
"0.58185804",
"0.5786845",
"0.574226",
"0.5736374",
"0.571155",
"0.5700175",
"0.5697055",
"0.5695762",
"0.56709427",
"0.56526005",... | 0.8063797 | 0 |
moons: lib: code.org library Draws all the moons that are larger than or equal to 6 pixels in radius. Then, it moves them to the left before checking if it should change one into a small moon. Written by Keegan Brown | moons (lib){
for (var i=0;i<7;i++){
let moon = this.madeMoons[i];
var size = moon.s;
lib.moveTo(moon.x, moon.y);
lib.penRGB(moon.r, moon.g, moon.b);
let movingLeft = true;
let behind = false;
if (moon.s < 6) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"smolMoons (lib){\n for (var i=0;i<7;i++){\n let moon = this.madeMoons[i];\n var size = moon.s;\n lib.moveTo(moon.x, moon.y);\n lib.penRGB(moon.r, moon.g, moon.b);\n let movingLeft = true;\n let behind = false;\n \n if (m... | [
"0.7860955",
"0.6330136",
"0.6289768",
"0.61206454",
"0.61012495",
"0.60457456",
"0.60050446",
"0.5950047",
"0.5939463",
"0.5921812",
"0.58338314",
"0.58235925",
"0.57590944",
"0.57508314",
"0.5747013",
"0.5733956",
"0.5714216",
"0.5702964",
"0.57025826",
"0.5690226",
"0.5686... | 0.7686026 | 1 |
creates a new todo (used with post route) to add to the db (gets atatched to the enter key press listener) | function createTodo() {
//Get the input text
var userInput = $('#todoInput').val();
//post to API -> ends up in db
$.post('/api/todos', {
name: userInput
})
.then(function(newTodo){
//db returns the create todo
//now put it on the page
addTodo(newTodo);
//clear the input form
$('#todoInput').val('');
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function keyboardNewTodo(event) {\n if (event.key == \"Enter\") {\n addTodo();\n }\n}",
"function addTodo(event) {\n // this function gets called when someone submits the form\n // we don't the form to redirect to other page. So, let's\n // prevent that\n event.preventDefault();\n\n /... | [
"0.7421811",
"0.7346793",
"0.7336742",
"0.7290876",
"0.7204351",
"0.70599204",
"0.7035186",
"0.70172197",
"0.697713",
"0.6928889",
"0.6915888",
"0.6888659",
"0.6865619",
"0.6853463",
"0.6846893",
"0.6813725",
"0.6810132",
"0.6809491",
"0.6802899",
"0.6758603",
"0.67487705",
... | 0.74299103 | 0 |
Shuffle function to randomly perform 10 moves | shuffle(moves = 10, prevDirection) {
if (moves <= 0) {
this._setIsRunning(false);
return;
}
let ctx = this;
let direction = getRandomInt(-2, 2);
let emptyCell = this.getCellForNumber(0);
let adjacentCell = this.getAdjacentCellWithPosition(emptyCell, direction);
if (adjacentCell &... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function shuffle() {\n\t\tfor(let i = 0; i < 1000; i++){\n\t\t\tlet arr = findMovablePieces(xCoordinate,yCoordinate);\n\t\t\tlet rand = parseInt(Math.random() * arr.length);\n\t\t\tswap(arr[rand]);\n\t\t}\n\t}",
"function shuffle() {\r\n\t// random pieces are moved 200 times\r\n\tfor(var i = 0; i < 200; i++) {\r... | [
"0.758129",
"0.7292214",
"0.72147745",
"0.71905917",
"0.7160125",
"0.7072021",
"0.70179766",
"0.69450825",
"0.69088656",
"0.6791187",
"0.6768687",
"0.6753597",
"0.67525923",
"0.6743285",
"0.6702207",
"0.6691099",
"0.6686565",
"0.6674022",
"0.66286904",
"0.6624023",
"0.6615810... | 0.7369773 | 1 |
Use this function to generate board with a specific estimated moves | generateBoard(moves = 10, prevDirection) {
// Generate grid[][] from puzzle
let grid = [];
for (let i = 0; i < this.n; i++) {
grid[i] = [];
for (let j = 0; j < this.n; j++) {
grid[i].push(this.grid[i][j].id)
}
}
// Create board and solver objects
let board = new Board(g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"makeMove(board, isXNext, isHardModeOn) {\n const marker = isXNext ? 'X' : 'O';\n let bestMove = null;\n const open = this.isOpen(board);\n\n if (open.length === 0) {\n // console.log('No move to make!');\n return board;\n }\n if (isHardModeOn) {\n if (isXNext) {\n let bestSc... | [
"0.6984075",
"0.6759887",
"0.6745708",
"0.668608",
"0.6673524",
"0.66509616",
"0.66503656",
"0.6593938",
"0.6577424",
"0.65454954",
"0.65339243",
"0.6529095",
"0.648901",
"0.6486439",
"0.64817965",
"0.6446938",
"0.640916",
"0.6397123",
"0.6378047",
"0.6371019",
"0.6323506",
... | 0.76270425 | 0 |
Let's define a function to make writing values to cells easier... | function writeToCell(sheet, CellRange, WriteValue) {
sheet.getRange(CellRange).setValue(WriteValue);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setCellValue(cell, value){\n cell.innerHTML = value\n}",
"function setCell(column, row, value) {\n var s = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = s.getSheetByName('Data');\n //sheet.appendRow([column, row, value]);\n sheet.getRange(getSheetTranslation(column)+row).setValue(value);\n}"... | [
"0.6479106",
"0.643985",
"0.61780125",
"0.60210425",
"0.5973716",
"0.5941549",
"0.59227455",
"0.59122425",
"0.59078306",
"0.5886057",
"0.5884216",
"0.584989",
"0.5818645",
"0.5815695",
"0.58122885",
"0.57972544",
"0.5796103",
"0.57805187",
"0.5757825",
"0.5755625",
"0.5743891... | 0.69936264 | 0 |
Calculate average of last 3 value changes | function average_change(row, col, numrow, numcol) {
var change_array = historic_data.getRange(row, col, numrow, numcol).getValues()[0] // returns column array
var change_total = 0
for (var i = 0; i < change_array.length; i ++) {
change_total += change_array[i]
}
var avg_change = Math.round(change_total/ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getAverageM3() {\n\t var days = this.getDays();\n\t var m3 = this.getM3();\n\n\t var averageM3 = days > 0 ? m3/days : m3;\n\n\t return Math.round(averageM3 * 100) / 100;\n\t}",
"function getAverage (data) {\n return data.reduce((acc, curr) => (acc += curr), 0) / data.length\n}",
"function avg(arr) {\n ... | [
"0.6786044",
"0.635181",
"0.6315033",
"0.63006204",
"0.62456185",
"0.6244608",
"0.62385297",
"0.6237768",
"0.62139463",
"0.6187657",
"0.6181659",
"0.6160483",
"0.61518264",
"0.6148411",
"0.61472857",
"0.61338377",
"0.61112547",
"0.61023885",
"0.6096062",
"0.60849273",
"0.6073... | 0.647024 | 1 |
Delete's a customer using an id. | async deleteCustomerById(id) {
if (!id) {
return {msg: 'No id was specified..', payload: 1}
}
try {
return !!await customers.destroy({
where: {
id: id
}
})
} catch (e) {
return false;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"delete(id) {\n if (!id) {\n return Promise.reject(new Error('invalid_id'));\n }\n return this.iugu.makeRequest('DELETE', `/customers/${id}`).begin();\n }",
"function deleteCustomer(customerID) {\n // console.log(\"id \" + carID);\n API.deleteCustomer(customerID).then(function... | [
"0.79274106",
"0.7667467",
"0.7262984",
"0.70584345",
"0.7003821",
"0.69053245",
"0.683904",
"0.6659552",
"0.665011",
"0.6627282",
"0.66114545",
"0.65577084",
"0.6537039",
"0.650338",
"0.64780474",
"0.6438465",
"0.6436847",
"0.64281976",
"0.6425645",
"0.6407132",
"0.64012367"... | 0.8193542 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.